forked from halo-battle/game
Version 0.7
This commit is contained in:
parent
e0f55450e1
commit
c117da6d77
148 changed files with 1914 additions and 801 deletions
|
|
@ -4,6 +4,7 @@ $g=$_SESSION['galaxy'];
|
|||
$s=$_SESSION['ss'];
|
||||
$p=$_SESSION['pos'];
|
||||
$race=$_SESSION['race'];
|
||||
require_once('../fonctions.php');
|
||||
require('../connectBDD.php');
|
||||
require_once 'noms.php';
|
||||
|
||||
|
|
@ -34,14 +35,16 @@ if ($mine_h > 0) $energie_h = ceil((exp($mine_h*0.31)*10)); else $energie_h= 0;
|
|||
if ($centrale_f > 0 ) $energie_f = ceil((($centrale_f*80+(exp($centrale_f*0.38)*11)))); else $energie_f = 1; // pour pas avoir div by 0
|
||||
if ($centrale_s > 0 ) $energie_s = ceil((($centrale_s*20+(exp($centrale_s*0.3)*10)))); else $energie_s = 0;
|
||||
|
||||
$nrj = $energie_m+$energie_c+energie_h;
|
||||
//Calcul de la consomation d'énergie
|
||||
$nrj = $energie_m+$energie_c+$energie_h;
|
||||
|
||||
//Calcul de la production d'énergie
|
||||
$t = $energie_f+$energie_s;
|
||||
|
||||
$coeff=($energie_s+$energie_f+$energie_m+$energie_c+$energie_h)/($energie_s+$energie_f);
|
||||
|
||||
if ( $coeff < 0 ) $coeff = 0;
|
||||
if ( $coeff > 1 ) $coeff = 1;
|
||||
if ($coeff < 0) $coeff = 0;
|
||||
if ($coeff > 1) $coeff = 1;
|
||||
|
||||
|
||||
if ($metal >= $cap) $prod_met=0;
|
||||
|
|
@ -78,29 +81,46 @@ mysql_query("UPDATE planete SET timestamp='$temps_actuel', metal='$a', cristal='
|
|||
$pseudoz = $ressource['pseudo'];
|
||||
|
||||
$req = mysql_query("SELECT id, galaxie, ss, position, nom_planete FROM planete WHERE id_user='$id'");
|
||||
$reqIsol = mysql_query("SELECT id FROM planete WHERE id_user='$id' AND isolement != '0'");
|
||||
|
||||
$RES_IMAGE = $image;
|
||||
$Aplan_ref = ''; $Aplan_value = ''; $Aplan_more = '';
|
||||
for ($i=0; $i < mysql_num_rows($req); $i++) {
|
||||
$x = mysql_query("SELECT id, galaxie, ss, position, nom_planete FROM planete WHERE id_user='$id' ORDER BY id LIMIT $i,8");
|
||||
for ($i=0; $i < mysql_num_rows($req); $i++) {
|
||||
$x = mysql_query("SELECT * FROM planete WHERE id_user='$id' ORDER BY id DESC LIMIT $i,1");
|
||||
$d = mysql_fetch_array($x);
|
||||
|
||||
$Aplan_value .= $d['id'].' ';
|
||||
if ($d['galaxie'] == $_SESSION['galaxy'] && $d['ss'] == $_SESSION['ss'] && $d['position'] == $_SESSION['pos']) $Aplan_more .= 'selected ';
|
||||
$Aplan_ref .= $d['nom_planete'].' ['.$d['galaxie'].':'.$d['ss'].':'.$d['position'].'];';
|
||||
if ($d['isolement'] != 0 && $d['isolement']+(mysql_num_rows($req)-10)*7200 <= time()) {
|
||||
$Aplan_value .= $d['id'].' ';
|
||||
if ($d['galaxie'] == $_SESSION['galaxy'] && $d['ss'] == $_SESSION['ss'] && $d['position'] == $_SESSION['pos']) $Aplan_more .= ' selected="selected";';
|
||||
else $Aplan_more .= ';';
|
||||
$Aplan_ref .= $d['nom_planete'].' ['.$d['galaxie'].':'.$d['ss'].':'.$d['position'].'];';
|
||||
$nextIsol = $d['isolement'] + (mysql_num_rows($req)-10)*7200 + rand(83000,170000);
|
||||
mysql_query("UPDATE planete SET isolement='$nextIsol' WHERE id_user='$id' AND galaxie='".$d['galaxie']."' AND ss='".$d['ss']."'AND position='".$d['position']."'");
|
||||
}
|
||||
elseif ($d['isolement']+(mysql_num_rows($req)-10)*7200 < time() || $d['isolement'] == 0) {
|
||||
$Aplan_value .= $d['id'].' ';
|
||||
if ($d['galaxie'] == $_SESSION['galaxy'] && $d['ss'] == $_SESSION['ss'] && $d['position'] == $_SESSION['pos']) $Aplan_more .= ' selected="selected";';
|
||||
else $Aplan_more .= ';';
|
||||
$Aplan_ref .= $d['nom_planete'].' ['.$d['galaxie'].':'.$d['ss'].':'.$d['position'].'];';
|
||||
}
|
||||
elseif ($d['galaxie'] == $_SESSION['galaxy'] && $d['ss'] == $_SESSION['ss'] && $d['position'] == $_SESSION['pos']) {
|
||||
$time = time();
|
||||
mysql_query("UPDATE planete SET isolement='$time' WHERE id_user='$id' AND galaxie='".$d['galaxie']."' AND ss='".$d['ss']."'AND position='".$d['position']."'");
|
||||
}
|
||||
|
||||
}
|
||||
$Aplan_value = split(' ',trim($Aplan_value));
|
||||
$Aplan_more = split(' ',trim($Aplan_more));
|
||||
$Aplan_more = split(';',trim($Aplan_more));
|
||||
$Aplan_ref = split(';',trim($Aplan_ref));
|
||||
|
||||
$NOM_METAL = $ressourc[0];
|
||||
$NOM_CRISTAL = $ressourc[1];
|
||||
$NOM_HYDROGENE = $ressourc[2];
|
||||
$NOM_ENERGIE = $ressourc[3];
|
||||
$RES_METAL = floor($a);
|
||||
$RES_CRISTAL = floor($b);
|
||||
$RES_HYDROGENE = floor($c);
|
||||
$RES_ENERGIE = $nrj.'/'.$t;
|
||||
$RES_METAL = separerNombres(floor($a));
|
||||
$RES_CRISTAL = separerNombres(floor($b));
|
||||
$RES_HYDROGENE = separerNombres(floor($c));
|
||||
$RES_ENERGIE = separerNombres($nrj).'/'.separerNombres($t);
|
||||
|
||||
mysql_close();
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue