HB/pages/batiment.php

260 lines
20 KiB
PHP

<?php
session_start();
$id=$_SESSION['id'];
$galaxy=$_SESSION['galaxy'];
$ss=$_SESSION['ss'];
$pos=$_SESSION['pos'];
$_SESSION['dernPage'] = 'batiment.php';
require_once 'bdd.php';
require_once('../securite.php');
require_once 'ressourcetem.php';
require_once 'batiment_ajout.php';
require_once 'noms.php';
require('../template.php');
$template = new Template('../templates/'.$templates);
function verification_des_ress($num, $fer, $cristal, $ro, $need_fer, $need_cristal, $need_ro) {
if ($fer >= $need_fer && $cristal >= $need_cristal && $ro >= $need_ro) return '<font color="#0080C0"><a href="batiment_validation.php?bat='.$num.'">Construire</a></font>';
else return '<font color="red">Construire</font>';
}
function ressources($fer, $cristal, $ro, $need_fer, $need_cristal, $need_ro) {
require 'noms.php';
$return = '';
if ($need_fer > 0) {
if ($fer <= $need_fer) {
$z=floor($fer)-$need_fer;
$return .= '<font color="red">'.$ressourc[0].' : <acronym title="Manque : '.abs($z).' unités de '.$ressourc[0].'">'.$need_fer.'</acronym></font> ';
}
else $return .= $ressourc[0].' : <span class="rc">'.$need_fer.' </span>';
}
if ($need_cristal > 0) {
if ($cristal <= $need_cristal) {
$z=floor($cristal)-$need_cristal;
$return .= '<font color="red">'.$ressourc[1].' : <acronym title="Manque : '.abs($z).' unités de '.$ressourc[0].'">'.$need_cristal.'</acronym></font> ';
}
else $return .= $ressourc[1].' : <span class="rc">'.$need_cristal.' </span>';
}
if ($need_ro > 0) {
if ($ro <= $need_ro) {
$z=floor($ro)-$need_ro;
$return .= '<font color="red">'.$ressourc[2].' : <acronym title="Manque : '.abs($z).' unités de '.$ressourc[0].'">'.$need_ro.'</acronym></font>';
}
else $return .= $ressourc[2].' : <span class="rc">'.$need_ro.'</span>';
}
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);
}
$case = $cases - ($mine_m + $mine_c + $mine_h + $centrale_s + $centrale_f + $radar + $labo + $chantier_terrestre + $chantier_spatial + $caserne + $silo);
if (!isset($_GET['err'])) $_GET['err'] = '';
$ERREUR = '';
if ($_GET['err'] == 1) $ERREUR = '<div class="centre"><table style="margin-left: auto; margin-right: auto;"><tr><td><font color="#FF0000"><b>Cette technologie est déjà en cours de recherche, vous ne pouvez pas la rajouter dans la file d\'attente</b></font></td></tr></table></div><br />';
elseif ($_GET['err'] == 2) $ERREUR = '<div class="centre"><table style="margin-left: auto; margin-right: auto;"><tr><td><font color="#FFCC00"><b>La production à la chaîne a été arrêtée</b></font></td></tr></table></div><br />';
$template->set_filenames(array('ressourcestpl' => 'ressources.tpl'));
$template->assign_vars( array('RES_IMAGE' => $RES_IMAGE, 'NOM_METAL' => $NOM_METAL, 'NOM_CRISTAL' => $NOM_CRISTAL, 'NOM_HYDROGENE' => $NOM_HYDROGENE, 'NOM_ENERGIE' => $NOM_ENERGIE, 'RES_METAL' => $RES_METAL, 'RES_CRISTAL' => $RES_CRISTAL, 'RES_HYDROGENE' => $RES_HYDROGENE, 'RES_ENERGIE' => $RES_ENERGIE, 'ERREUR' => $ERREUR, 'HEADER' => $HEADER, 'PUB' => $PUB));
for ($i=0 ; $i<count($Aplan_value) ; $i++) {
$template->assign_block_vars('planetes',array('RES_VALUE' => $Aplan_value[$i], 'RES_MORE' => $Aplan_more[$i], 'RES_REF' => $Aplan_ref[$i]));
}
$template->set_filenames(array('bati' => 'batiments.tpl'));
$template->assign_var_from_handle('RESSOURCES', 'ressourcestpl');
$CHAINE = '';
if (!empty($fileBat[0])) {
for ($i=0 ; $i<count($fileBat) ; $i++) {
if ($fileBat[$i] != 'e') $template->assign_block_vars('file',array('NOM' => $batiment[$fileBat[$i]-1], 'NUM' => $fileBat[$i]));
else $CHAINE = ' <br /> <a href="annul_bat.php?bat=e"><i>Arrêter de produire à la chaîne</i></a>';
}
$FILETXT = '';
if ($i == 1 && $bat_boucle == false) $CHAINE = ' <br /> <a href="batiment_validation.php?bat=e"><i>Produire à la chaîne</i></a>';
}
else $FILETXT = 'Aucun batiment en attente';
$template->assign_vars(array('RACE' => $race, 'FILETXT' => $FILETXT, 'CHAINE' => $CHAINE));
$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); $b=ceil(pow(2,$n)*500); $c=ceil(pow(2,$n)*150);
if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant : <span id="axion"></span><br><script type="text/javascript">reste('.$tr.');</script>'; }
elseif (is_array($fileBat) && ereg(($i+1).',',implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente';
elseif ($case <= 0) $action = '<font color="red">Planète pleine</font>';
else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, 0, $b, $c);
if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $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*$ingeneieur))), 'ACTION' => $action));
// 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 : <span id="axion"></span><br><script type="text/javascript">reste('.$tr.');</script>'; }
elseif (is_array($fileBat) && ereg(($i+1).',',implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente';
elseif ($case <= 0) $action = '<font color="red">Planète pleine</font>';
else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, 0, $b, $c);
if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $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*$ingeneieur))), 'ACTION' => $action));
// 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 : <span id="axion"></span><br><script type="text/javascript">reste('.$tr.');</script>'; }
elseif (is_array($fileBat) && ereg(($i+1).',',implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente';
elseif ($case <= 0) $action = '<font color="red">Planète pleine</font>';
else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, 0, $b, $c);
if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $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*$ingeneieur))), 'ACTION' => $action));
// 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 : <span id="axion"></span><br><script type="text/javascript">reste('.$tr.');</script>'; }
elseif (is_array($fileBat) && ereg(($i+1).',',implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente';
elseif ($case <= 0) $action = '<font color="red">Planète pleine</font>';
else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, 0, $b, $c);
if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $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*$ingeneieur))), 'ACTION' => $action));
// 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 : <span id="axion"></span><br><script type="text/javascript">reste('.$tr.');</script>'; }
elseif (is_array($fileBat) && ereg(($i+1).',',implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente';
elseif ($case <= 0) $action = '<font color="red">Planète pleine</font>';
else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, 0, $b, $c);
if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $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*$ingeneieur))), 'ACTION' => $action));
}
// 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=ceil(pow(2,$radar)*50);
if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant : <span id="axion"></span><br><script type="text/javascript">reste('.$tr.');</script>'; }
elseif (is_array($fileBat) && ereg(($i+1).',',implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente';
elseif ($case <= 0) $action = '<font color="red">Planète pleine</font>';
else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, 0, $b, $c);
if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $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*$ingeneieur))), 'ACTION' => $action));
}
// 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);
if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant : <span id="axion"></span><br><script type="text/javascript">reste('.$tr.');</script>'; }
elseif (is_array($fileBat) && ereg(($i+1).',',implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente';
elseif ($case <= 0) $action = '<font color="red">Planète pleine</font>';
else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, 0, $b, $c);
if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $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*$ingeneieur))), 'ACTION' => $action));
// 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);
if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant : <span id="axion"></span><br><script type="text/javascript">reste('.$tr.');</script>'; }
elseif (is_array($fileBat) && ereg(($i+1).',',implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente';
elseif ($case <= 0) $action = '<font color="red">Planète pleine</font>';
else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, 0, $b, $c);
if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $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*$ingeneieur))), 'ACTION' => $action));
// 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);
if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant : <span id="axion"></span><br><script type="text/javascript">reste('.$tr.');</script>'; }
elseif (is_array($fileBat) && ereg(($i+1).',',implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente';
elseif ($case <= 0) $action = '<font color="red">Planète pleine</font>';
else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, 0, $b, $c);
if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $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*$ingeneieur))), 'ACTION' => $action));
}
// 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);
if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant : <span id="axion"></span><br><script type="text/javascript">reste('.$tr.');</script>'; }
elseif (is_array($fileBat) && ereg(($i+1).',',implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente';
elseif ($case <= 0) $action = '<font color="red">Planète pleine</font>';
else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, 0, $b, $c);
if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $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*$ingeneieur))), 'ACTION' => $action));
// 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);
if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant : <span id="axion"></span><br><script type="text/javascript">reste('.$tr.');</script>'; }
elseif (is_array($fileBat) && ereg(($i+1).',',implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente';
elseif ($case <= 0) $action = '<font color="red">Planète pleine</font>';
else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, 0, $b, $c);
if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $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*$ingeneieur))), 'ACTION' => $action));
// 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 : <span id="axion"></span><br><script type="text/javascript">reste('.$tr.');</script>'; }
elseif (is_array($fileBat) && ereg(($i+1).',',implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente';
elseif ($case <= 0) $action = '<font color="red">Planète pleine</font>';
else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, 0, $b, $c);
if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $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*$ingeneieur)+1))), 'ACTION' => $action));
}
$template->pparse('bati');
?>