= $need_fer && $cristal >= $need_cristal && $ro >= $need_ro) return 'Construire';
else return 'Construire';
}
function ressources($fer, $cristal, $ro, $need_fer, $need_cristal, $need_ro) {
require 'includes/noms.php';
$return = '';
if ($need_fer > 0) {
if ($fer <= $need_fer) {
$z=floor($fer)-$need_fer;
$return .= ''.$ressourc[0].' : '.separerNombres($need_fer).' ';
}
else $return .= $ressourc[0].' : '.separerNombres($need_fer).' ';
}
if ($need_cristal > 0) {
if ($cristal <= $need_cristal) {
$z=floor($cristal)-$need_cristal;
$return .= ''.$ressourc[1].' : '.separerNombres($need_cristal).' ';
}
else $return .= $ressourc[1].' : '.separerNombres($need_cristal).' ';
}
if ($need_ro > 0) {
if ($ro <= $need_ro) {
$z=floor($ro)-$need_ro;
$return .= ''.$ressourc[2].' : '.separerNombres($need_ro).'';
}
else $return .= $ressourc[2].' : '.separerNombres($need_ro).'';
}
return $return;
}
function sec($time) {
$output = '';
$tab = array ('jour' => '86400', 'heure' => '3600', 'minute' => '60', 'seconde' => '1');
foreach ($tab as $key => $value) {
$compteur = 0;
while ($time > ($value-1)) {
$time = $time - $value;
$compteur++;
}
if ($compteur != 0) {
$output .= $compteur.' '.$key;
if ($compteur > 1) $output .= 's';
if ($value != 1) $output .= ' ';
}
}
return $output;
}
function ress_tem($fer, $cristal, $ro, $need_fer, $need_cristal, $need_ro, $mine_m, $mine_c, $mine_h) {
if ($mine_m < 0) $prod_met = 40;
else $prod_metal = ceil((($mine_m*32)+(pow(1.41,$mine_m)*exp(0.066*$mine_m))*$coeff)*3.7) + 40;
if ($mine_c < 0) $prod_cri = 20;
else $prod_cristal = (floor(($mine_c*13)+(pow(1.36,$mine_c)*exp(0.0675*$mine_c))*$coeff)*7) + 20;
if ($centrale_f > 0) $conso_hy = ceil(($centrale_f*5+(exp($mine_m*0.3)*10))*$coeff);
else $conso_hy=0;
if ($mine_h < 0) $prod_hydrogene = 0.0000000001;
else $prod_hydrogene = (ceil((($mine_h*12)+(pow(1.394,$mine_h)*exp(0.072*$mine_h))*$coeff)*5));
$w = $prod_hydrogene - $conso_hy;
if ($mine_h == 0) { $w=1; $ro=0; $need_ro=0; }
if (($prod_hydrogene-$conso_hy) < 0) { $w= 1; $ro=0; $need_ro=0; }
$tem1 = abs(floor($fer)-$need_fer)/$prod_metal;
$tem2 = abs(floor($cristal)-$need_cristal)/$prod_cristal;
$tem3 = abs(floor($ro)-$need_ro)/$w;
$tem = max($tem1,$tem2,$tem3);
echo ceil($tem);
}
$template->set_filenames(array('batiments' => 'batiments.tpl'));
if (!isset($_GET['err'])) $_GET['err'] = '';
$ERREUR = '';
if ($_GET['err'] == 1) $ERREUR = '
Ce batiment est déjà en cours de construction, vous ne pouvez pas le rajouter dans la file d\'attente |
';
elseif ($_GET['err'] == 2) $ERREUR = 'La production à la chaîne a été arrêtée |
';
$tr = 0;
$a=0; $b=0; $c=0;
// Batiment n°1 : Purificateur de métal/Générateur de Métal/Usine de métallurgie ; planete.mine_m
$i = 0;
$nom_bdd = 'mine_m';
if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = '';
$n=(${$nom_bdd}-1); $a=ceil(exp(0.4*$mine_m)*190); $b=ceil(exp(0.4*$mine_m)*90);
if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; }
elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente';
elseif ($case <= 0) $action = 'Planète pleine';
else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c);
if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); }
if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(1.7,$mine_m)*120)/(pow(1.23,$centre_info)+0.0025*$ingenieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i])));
// Batiment n°2 : Purificateur de cristal/Générateur de Cristal/Usine de cristal ; planete.mine_m
$i = 1;
$nom_bdd = 'mine_c';
if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = '';
$n=(${$nom_bdd}-1); $a=ceil(exp(0.43*$mine_c)*205); $b=ceil(exp(0.43*$mine_c)*110);
if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; }
elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente';
elseif ($case <= 0) $action = 'Planète pleine';
else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c);
if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); }
if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(1.72,$mine_c)*160)/(pow(1.23,$centre_info)+0.0025*$ingenieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i])));
// Batiment n°3 : Ionisateur/Générateur d'Hydrogène/Synchronisateur d'hydrogène ; planete.mine_h
$i = 2;
$nom_bdd = 'mine_h';
if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = '';
$n=(${$nom_bdd}-1); $a=ceil(exp(0.445*$mine_h)*235); $b=ceil(exp(0.445*$mine_h)*150);
if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; }
elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente';
elseif ($case <= 0) $action = 'Planète pleine';
else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c);
if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); }
if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(1.75,$mine_h)*180)/(pow(1.23,$centre_info)+0.0025*$ingenieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i])));
// Batiment n°4 : Centrale solaire/Générateur d'Energie/Centrale solaire ; planete.centrale_s
$i = 3;
$nom_bdd = 'centrale_s';
if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = '';
$n=(${$nom_bdd}-1); $a=ceil(exp(0.442*$centrale_s)*165); $b=ceil(exp(0.442*$centrale_s)*99);
if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; }
elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente';
elseif ($case <= 0) $action = 'Planète pleine';
else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c);
if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); }
if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(1.68,$centrale_s)*190)/(pow(1.23,$centre_info)+0.0025*$ingenieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i])));
// Batiment n°5 : Centrale de fusion/0/Centrale énergétique ; planete.centrale_f
if ($centrale_s >= 12 && $energie_t >= 5) {
$i = 4;
$nom_bdd = 'centrale_f';
if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = '';
$n=(${$nom_bdd}-1); $a=ceil(pow(1.8,$centrale_f)*300); $b=ceil(pow(1.82,$centrale_f)*230);
if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; }
elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente';
elseif ($case <= 0) $action = 'Planète pleine';
else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c);
if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); }
if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(1.8,$centrale_f)*300)/(pow(1.23,$centre_info)+0.0025*$ingenieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i])));
}
// Batiment n°6 : Oeil des prophètes/0/Base radar ; planete.centrale_f
if ($detection >= 1) {
$i = 5;
$nom_bdd = 'radar';
if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = '';
$n=(${$nom_bdd}-1); $a=ceil(pow(2,$radar)*750); $b=ceil(pow(2,$radar)*500); $c = 0;
if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; }
elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente';
elseif ($case <= 0) $action = 'Planète pleine';
else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c);
if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); }
if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(2,$radar)*720)/(pow(1.23,$centre_info)+0.0025*$ingenieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i])));
}
// Batiment n°7 : Centre de recherches/Centre de recherches/Centre de recherches ; planete.labo
$i = 6;
$nom_bdd = 'labo';
if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = '';
$n=(${$nom_bdd}-1); $a=ceil(pow(2,$labo)*200); $b=ceil(pow(2,$labo)*150); $c = 0;
if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; }
elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente';
elseif ($case <= 0) $action = 'Planète pleine';
else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c);
if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); }
if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(2,$labo)*720)/(pow(1.23,$centre_info)+0.0025*$ingenieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i])));
// Batiment n°8 : Chantier terrestre/Chantier terrestre/Chantier terrestre ; planete.chantier_terrestre
$i = 7;
$nom_bdd = 'chantier_terrestre';
if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = '';
$n=(${$nom_bdd}-1); $a=ceil(pow(2,$chantier_terrestre)*520); $b=ceil(pow(2,$chantier_terrestre)*380); $c = 0;
if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; }
elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente';
elseif ($case <= 0) $action = 'Planète pleine';
else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c);
if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); }
if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(2,$chantier_terrestre)*420)/(pow(1.23,$centre_info)+0.0025*$ingenieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i])));
// Batiment n°9 : Chantier spatial/Chantier spatial/Chantier spatial ; planete.chantier_spatial
if ($chantier_terrestre >= 2) {
$i = 8;
$nom_bdd = 'chantier_spatial';
if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = '';
$n=(${$nom_bdd}-1); $a=ceil(pow(2,$chantier_spatial)*600); $b=ceil(pow(2,$chantier_spatial)*450); $c = 0;
if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; }
elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente';
elseif ($case <= 0) $action = 'Planète pleine';
else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c);
if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); }
if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(2,$chantier_spatial)*600)/(pow(1.23,$centre_info)+0.0025*$ingenieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i])));
}
// Batiment n°10 : Caserne/0/Ecole militaire ; planete.caserne
$i = 9;
$nom_bdd = 'caserne';
if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = '';
$n=(${$nom_bdd}-1); $a=ceil(pow(2,$caserne)*200); $b=ceil(pow(2,$caserne)*100); $c = 0;
if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; }
elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente';
elseif ($case <= 0) $action = 'Planète pleine';
else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c);
if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); }
if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(2,$caserne)*300)/(pow(1.23,$centre_info)+0.0025*$ingenieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i])));
// Batiment n°11 : Entrepôt/Entrepôt/Silo de stockage ; planete.silo
$i = 10;
$nom_bdd = 'silo';
if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = '';
$n=(${$nom_bdd}-1); $a=ceil(pow(2,$silo)*400); $b=ceil(pow(2,$silo)*260); $c = 0;
if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; }
elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente';
elseif ($case <= 0) $action = 'Planète pleine';
else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c);
if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); }
if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(2,$silo)*1200)/(pow(1.23,$centre_info)+0.0025*$ingenieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i])));
// Batiment n°12 : Centrale informatique/0/Centrale informatique ; planete.centre_info
if ($informatique >= 2) {
$i = 11;
$nom_bdd = 'centre_info';
if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = '';
$n=(${$nom_bdd}-1); $a=ceil(pow(1.7,$centre_info)*600); $b=ceil(pow(1.7,$centre_info)*420); $c=ceil(pow(1.7,$centre_info)*100);
if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; }
elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente';
elseif ($case <= 0) $action = 'Planète pleine';
else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c);
if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); }
if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(1.9,$centre_info)*800)/((0.0025*$ingenieur)+1))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i])));
}
$CHAINE = '';
if (!empty($fileBat[0])) {
for ($i=0 ; $iassign_block_vars('file',array('NOM' => $batiment[$fileBat[$i]-1], 'NUM' => $fileBat[$i]));
elseif ($fileBat[$i] != 'e') $template->assign_block_vars('file',array('NOM' => $batiment[$fileBat[$i]-1], 'NUM' => $fileBat[$i], 'RESTANT' => ' - '));
else $CHAINE = '
Arrêter de produire à la chaîne';
}
$FILETXT = '';
if ($i == 1 && $bat_boucle == false) $CHAINE = '
Produire à la chaîne';
}
else $FILETXT = 'Aucun batiment en attente';
$template->assign_vars(array('RACE' => $race, 'FILETXT' => $FILETXT, 'CHAINE' => $CHAINE));
require('../connectBDD.php');
$result = mysql_query("SELECT * FROM version ORDER BY temps DESC");
$data = mysql_fetch_array($result);
$version = $data['version'];
mysql_close();
$template->set_filenames(array('base' => 'base.tpl'));
$template->assign_vars(array('PUB' => $PUB, 'VERSION' => $version, 'RES_IMAGE' => $RES_IMAGE, 'NOM_METAL' => strtolower($NOM_METAL), 'NOM_CRISTAL' => strtolower($NOM_CRISTAL), 'NOM_HYDROGENE' => strtolower($NOM_HYDROGENE), 'NOM_ENERGIE' => strtolower($NOM_ENERGIE), 'RES_METAL' => $RES_METAL, 'RES_CRISTAL' => $RES_CRISTAL, 'RES_HYDROGENE' => $RES_HYDROGENE, 'RES_ENERGIE' => $RES_ENERGIE));
for ($i=0 ; $iassign_block_vars('planetes',array('RES_VALUE' => $Aplan_value[$i], 'RES_MORE' => $Aplan_more[$i], 'RES_IMG' => $Aplan_img[$i], 'RES_NOM' => $Aplan_nom[$i], 'RES_REF' => $Aplan_ref[$i]));
}
$template->assign_var_from_handle('CONTENU', 'batiments');
$template->pparse('base');
?>