412 lines
14 KiB
PHP
412 lines
14 KiB
PHP
<?php
|
||
session_start();
|
||
|
||
$id=$_SESSION['id'];
|
||
$galaxy=$_SESSION['galaxy'];
|
||
$ss=$_SESSION['ss'];
|
||
$pos=$_SESSION['pos'];
|
||
|
||
echo"<html>
|
||
<head>
|
||
<title>Halo battle</title>
|
||
|
||
<link rel=stylesheet media=screen type=text/css title=design href=descriptions/diz/base.css >
|
||
<meta http-equiv=pragma content=no-cache >
|
||
<meta http-equiv=content-type content=text/html;charset=iso-8869-1 >
|
||
<link rel=shortcut icon type=image/x-icon href=favicon.ico >
|
||
|
||
<style TYPE=text/css>
|
||
TD {
|
||
border: 0px;
|
||
background-color: transparent;
|
||
}
|
||
</style>";
|
||
|
||
require_once 'bdd.php';
|
||
require_once 'ressource.php';
|
||
require_once 'batiment_ajout.php';
|
||
require_once 'noms.php';
|
||
|
||
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 .= ' ';
|
||
}
|
||
}
|
||
echo $output;
|
||
}
|
||
|
||
function verification_des_ress($num, $fer, $cristal, $ro, $need_fer, $need_cristal, $need_ro)
|
||
{
|
||
if ($fer >= $need_fer && $cristal >= $need_cristal && $ro >= $need_ro)
|
||
{
|
||
echo "<br><br><br><font color=#0080c0><a href=\"batiment_validation.php?bat=".$num."\">Construire</a></font>";
|
||
}
|
||
else
|
||
{
|
||
echo "<br><br><br><font color=red>Construire</font>";
|
||
}
|
||
}
|
||
|
||
function ressources($fer, $cristal, $ro, $need_fer, $need_cristal, $need_ro, $mine_m, $mine_c, $mine_h) {
|
||
if ($need_fer > 0) {
|
||
if ($fer <= $need_fer) {
|
||
$z=floor($fer)-$need_fer;
|
||
echo '<font color=red >Fer : <ACRONYM title="'.$z.'">'.$need_fer.'</ACRONYM></font> ';
|
||
}
|
||
else echo "Fer : <span class=rc>".$need_fer." </span>";
|
||
}
|
||
if ($need_cristal > 0) {
|
||
if ($cristal <= $need_cristal) {
|
||
$z=floor($cristal)-$need_cristal;
|
||
echo '<font color=red >Cristal : <ACRONYM title="'.$z.'">'.$need_cristal.'</ACRONYM></font> ';
|
||
}
|
||
else echo "Cristal : <span class=rc>".$need_cristal." </span>";
|
||
}
|
||
if ($need_ro > 0) {
|
||
if ($ro <= $need_ro) {
|
||
$z=floor($ro)-$need_ro;
|
||
echo '<font color=red >Hydrog<6F>ne : <ACRONYM title="'.$z.'">'.$need_ro.'</ACRONYM></font>';
|
||
}
|
||
else echo "Hydrog<EFBFBD>ne : <span class=rc>".$need_ro."</span>";
|
||
}
|
||
}
|
||
|
||
$case = $cases - ($mine_m + $mine_c + $mine_h + $centrale_s + $centrale_f + $radar + $labo + $chantier_terrestre + $chantier_spatial + $caserne + $silo);
|
||
|
||
echo '<script language="javascript" src="time.js"></script>
|
||
</head>
|
||
<body>
|
||
<div class=d><a href="arbre_bat_'.$race.'.php">Arbre des technologies</a></div>
|
||
<br class="a">
|
||
<div class="a">
|
||
<img src="images/batiments/'.$batimeni[0].'" alt="" />
|
||
</div>
|
||
<div class="b">
|
||
<a href="descriptions.php?bat='.$batimend[0].'">'.$batiment[0].'</a> '; if ($mine_m > 0) echo '(Niveau '.$mine_m.')'; echo '<br>
|
||
Toute construction demande des quantit<69>s <20>normes de fer, pour cela des centaines de milliers d\'ouvriers
|
||
travaillent dans ces mines afin d\'assurer le bon fonctionnement de votre empire.<br>
|
||
Besoin de : ';
|
||
$a=ceil(pow(1.5,$mine_m)*70);
|
||
$b=ceil(pow(1.55,$mine_m)*35);
|
||
ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h); echo '<br>
|
||
Temps de construction : '; sec(ceil(pow(1.7,$mine_m)*120));
|
||
echo '</div>
|
||
<div class="c">';
|
||
if ($temps_b > 0) {
|
||
if ($bat==1) {
|
||
$tr=$temps_b-time();
|
||
echo '<table align="center"><tr><td><div id="axion"></div></td></tr>';
|
||
echo '<script language="JavaScript">reste('.$tr.');</script>';
|
||
echo "<tr><td><a href=\"batiment_anul.php?bat=1\">Annuler</a></td></tr></table>";
|
||
}
|
||
}
|
||
else {
|
||
if ($case <= 0) echo '<font color="red">Plan<61>te pleine</font>';
|
||
else verification_des_ress(1, $metal, $cristal, $hydrogene, $a, $b, 0);
|
||
}
|
||
echo '</div>
|
||
<br class="a">
|
||
<div class="a">
|
||
<img src="images/batiments/'.$batimeni[1].'" alt="">
|
||
</div>
|
||
<div class="b">
|
||
<a href="descriptions.php?bat='.$batimend[1].'">'.$batiment[1].'</a> '; if ($mine_c > 0) echo '(Niveau '.$mine_c.')'; echo '<br>
|
||
Description.<br>
|
||
Besoin de : ';
|
||
$a=ceil(pow(1.55,$mine_c)*105);
|
||
$b=ceil(pow(1.55,$mine_c)*60);
|
||
ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h); echo'<br>
|
||
Temps de construction : '; sec(ceil(pow(1.72,$mine_c)*160));
|
||
echo '</div>
|
||
<div class="c">';
|
||
if ($temps_b > 0) {
|
||
if ($bat==2) {
|
||
$tr=$temps_b-time();
|
||
echo '<table align=center><tr><td><div id="axion"></div></td></tr>';
|
||
echo '<script language="JavaScript">reste('.$tr.');</script>';
|
||
echo "<tr><td><a href=\"batiment_anul.php?bat=2\">Annuler</a></td></tr></table>";
|
||
}
|
||
}
|
||
else {
|
||
if ($case <= 0) echo '<font color=red>Plan<61>te pleine</font>';
|
||
else verification_des_ress(2, $metal, $cristal, $hydrogene, $a, $b, 0);
|
||
}
|
||
echo '</div>
|
||
<br class="a">
|
||
<div class="a">
|
||
<img src="images/batiments/'.$batimeni[2].'" alt="">
|
||
</div>
|
||
<div class="b">
|
||
<a href="descriptions.php?bat='.$batimend[2].'">'.$batiment[2].'</a> '; if ($mine_h > 0) echo '(Niveau '.$mine_h.')'; echo '<br>
|
||
Description.<br>
|
||
Besoin de : ';
|
||
$a=floor(pow(1.53,$mine_h)*82);
|
||
$b=floor(pow(1.5,$mine_h)*80);
|
||
ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h); echo '<br>
|
||
Temps de construction : '; sec(ceil(pow(1.75,$mine_h)*180));
|
||
echo '</div>
|
||
<div class="c">';
|
||
if ($temps_b > 0) {
|
||
if ($bat==3) {
|
||
$tr=$temps_b-time();
|
||
echo '<table align=center><tr><td><div id="axion"></div></td></tr>';
|
||
echo '<script language="JavaScript">reste('.$tr.');</script>';
|
||
echo "<tr><td><a href=\"batiment_anul.php?bat=3\">Annuler</a></td></tr></table>";
|
||
}
|
||
}
|
||
else {
|
||
if ($case <= 0) echo '<font color=red>Plan<61>te pleine</font>';
|
||
else verification_des_ress(3, $metal, $cristal, $hydrogene, $a, $b, 0);
|
||
}
|
||
echo '</div>
|
||
<br class="a">
|
||
<div class="a">
|
||
<img src="images/batiments/'.$batimeni[3].'" alt="">
|
||
</div>
|
||
<div class="b">
|
||
<a href="descriptions.php?bat='.$batimend[3].'">'.$batiment[3].'</a> '; if ($centrale_s > 0) echo '(Niveau '.$centrale_s.')'; echo '<br>
|
||
Description.<br>
|
||
Besoin de : ';
|
||
$a=ceil(pow(2,$centrale_s)*300);
|
||
$b=ceil(pow(2,$centrale_s)*230);
|
||
ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h); echo '<br>
|
||
Temps de construction : '; sec(pow(1.68,$centrale_s)*190);
|
||
echo '</div>
|
||
<div class="c">';
|
||
if ($temps_b > 0) {
|
||
if ($bat==4) {
|
||
$tr=$temps_b-time();
|
||
echo '<table align=center><tr><td><div id="axion"></div></td></tr>';
|
||
echo '<script language="JavaScript">reste('.$tr.');</script>';
|
||
echo "<tr><td><a href=\"batiment_anul.php?bat=4\">Annuler</a></td></tr></table>";
|
||
}
|
||
}
|
||
else {
|
||
if ($case <= 0) echo '<font color=red>Plan<61>te pleine</font>';
|
||
else verification_des_ress(4, $metal, $cristal, $hydrogene, $a, $b, 0);
|
||
}
|
||
echo '</div><br class="a">';
|
||
|
||
if ($centrale_s >= 12 && $energie_t >= 5) {
|
||
echo '<div class="a">
|
||
<img src="images/batiments/'.$batimeni[4].'" alt="">
|
||
</div>
|
||
<div class="b">
|
||
<a href="descriptions.php?bat='.$batimend[4].'">'.$batiment[4].'</a> '; if ($centrale_f > 0) echo '(Niveau '.$centrale_f.')'; echo '<br>
|
||
Description.<br>
|
||
Besoin de : ';
|
||
$a=ceil(pow(2,$centrale_f)*165);
|
||
$b=ceil(pow(2,$centrale_f)*99);
|
||
ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h); echo '<br>
|
||
Temps de construction : '; sec(pow(1.8,$centrale_f)*300);
|
||
echo '</div>
|
||
<div class="c">';
|
||
if ($temps_b > 0) {
|
||
if ($bat==5) {
|
||
$tr=$temps_b-time();
|
||
echo '<table align=center><tr><td><div id="axion"></div></td></tr>';
|
||
echo '<script language="JavaScript">reste('.$tr.');</script>';
|
||
echo "<tr><td><a href=\"batiment_anul.php?bat=5\">Annuler</a></td></tr></table>";
|
||
}
|
||
}
|
||
else {
|
||
if ($case <= 0) echo '<font color=red>Plan<61>te pleine</font>';
|
||
else verification_des_ress(5, $metal, $cristal, $hydrogene, $a, $b, 0);
|
||
}
|
||
echo '</div><br class="a">';
|
||
}
|
||
|
||
if ($detection >= 1) {
|
||
echo '<div class=a>
|
||
<img src="images/batiments/'.$batimeni[5].'" alt="">
|
||
</div>
|
||
<div class="b">
|
||
<a href="descriptions.php?bat='.$batimend[5].'">'.$batiment[5].'</a> '; if ($radar > 0) echo '(Niveau '.$radar.')'; echo '<br>
|
||
Description.<br>
|
||
Besoin de : ';
|
||
$a=ceil(pow(2,$radar)*750);
|
||
$b=ceil(pow(2,$radar)*500);
|
||
$c=ceil(pow(2,$radar)*50);
|
||
ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h); echo '<br>
|
||
Temps de construction : '; sec(ceil(pow(2,$radar)*720));
|
||
echo '</div>
|
||
<div class="c">';
|
||
if ($temps_b > 0) {
|
||
if ($bat==6) {
|
||
$tr=$temps_b-time();
|
||
echo '<table align="center"><tr><td><div id="axion"></div></td></tr>';
|
||
echo '<script language="JavaScript">reste('.$tr.');</script>';
|
||
echo "<tr><td><a href=\"batiment_anul.php?bat=6\">Annuler</a></td></tr></table>";
|
||
}
|
||
}
|
||
else {
|
||
if ($case <= 0) echo '<font color="red">Plan<61>te pleine</font>';
|
||
else verification_des_ress(6, $metal, $cristal, $hydrogene, $a, $b, $c);
|
||
}
|
||
echo '</div><br class="a">';
|
||
}
|
||
|
||
echo '<div class="a">
|
||
<img src="images/batiments/'.$batimeni[6].'" alt="">
|
||
</div>
|
||
<div class="b">
|
||
<a href="descriptions.php?bat='.$batimend[6].'">'.$batiment[6].'</a> '; if ($labo > 0) echo '(Niveau '.$labo.')'; echo '<br>
|
||
Description.<br>
|
||
Besoin de : ';
|
||
$a=ceil(pow(2,$labo)*200);
|
||
$b=ceil(pow(2,$labo)*150);
|
||
ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h); echo '<br>
|
||
Temps de construction : '; sec(ceil(pow(2,$labo)*720));
|
||
echo '</div>
|
||
<div class="c">';
|
||
if ($temps_b > 0) {
|
||
if ($bat==7) {
|
||
$tr=$temps_b-time();
|
||
echo '<table align="center"><tr><td><div id="axion"></div></td></tr>';
|
||
echo '<script language="JavaScript">reste('.$tr.');</script>';
|
||
echo "<tr><td><a href=\"batiment_anul.php?bat=7\">Annuler</a></td></tr></table>";
|
||
}
|
||
}
|
||
else {
|
||
if ($case <= 0) echo "<font color=red>Plan<61>te pleine</font>";
|
||
else {
|
||
if($temps_t > 0) echo '<font color="red"><br><br>Recherche en cours dans le </font><a href="laboratoire.php">laboratoire</a>';
|
||
else verification_des_ress(7, $metal, $cristal, $hydrogene, $a, $b, 0);
|
||
}
|
||
}
|
||
echo '</div>
|
||
<br class="a">
|
||
<div class="a">
|
||
<img src="images/batiments/'.$batimeni[7].'" alt="">
|
||
</div>
|
||
<div class="b">
|
||
<a href="descriptions.php?bat='.$batimend[7].'">'.$batiment[7].'</a> '; if ($chantier_terrestre > 0) echo '(Niveau '.$chantier_terrestre.')'; echo '<br>
|
||
Description.<br>
|
||
Besoin de : ';
|
||
$a=ceil(pow(2,$chantier_terrestre)*520);
|
||
$b=ceil(pow(2,$chantier_terrestre)*380);
|
||
ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h); echo '<br>
|
||
Temps de construction : '; sec(ceil(pow(2,$chantier_terrestre)*420));
|
||
echo '</div>
|
||
<div class="c">';
|
||
if ($temps_b > 0) {
|
||
if ($bat==8) {
|
||
$tr=$temps_b-time();
|
||
echo '<table align=center><tr><td><div id="axion"></div></td></tr>';
|
||
echo '<script language="JavaScript">reste('.$tr.');</script>';
|
||
echo "<tr><td><a href=\"batiment_anul.php?bat=8\">Annuler</a></td></tr></table>";
|
||
}
|
||
}
|
||
else {
|
||
if ($case <= 0) echo '<font color="red">Plan<61>te pleine</font>';
|
||
else {
|
||
if($unit_s > 0) echo '<font color="red"><br><br>Construction en cours dans le </font><a href="chantier_spatial.php">chantier spatial</a>';
|
||
else verification_des_ress(8, $metal, $cristal, $hydrogene, $a, $b, 0);
|
||
}
|
||
}
|
||
echo '</div>
|
||
<br class="a">';
|
||
|
||
if ($chantier_terrestre >= 2) {
|
||
echo '<div class="a">
|
||
<img src="images/batiments/'.$batimeni[8].'">
|
||
</div>
|
||
<div class="b">
|
||
<a href="descriptions.php?bat='.$batimend[8].'">'.$batiment[8].'</a> '; if ($chantier_spatial > 0) echo '(Niveau '.$chantier_spatial.')'; echo '<br>
|
||
Description.<br>
|
||
Besoin de : ';
|
||
$a=ceil(pow(2,$chantier_spatial)*600);
|
||
$b=ceil(pow(2,$chantier_spatial)*450);
|
||
ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h); echo '<br>
|
||
Temps de construction : '; sec(ceil(pow(2,$chantier_spatial)*600));
|
||
echo '</div>
|
||
<div class="c">';
|
||
if ($temps_b > 0) {
|
||
if ($bat==9) {
|
||
$tr=$temps_b-time();
|
||
echo '<table align=center><tr><td><div id="axion"></div></td></tr>';
|
||
echo '<script language="JavaScript">reste('.$tr.');</script>';
|
||
echo "<tr><td><a href=\"batiment_anul.php?bat=9\">Annuler</a></td></tr></table>";
|
||
}
|
||
}
|
||
else {
|
||
if ($case <= 0) echo "<font color=red>Plan<61>te pleine</font>";
|
||
else {
|
||
if($unit_t > 0) echo "<font color=red><br><br>Construction en cours dans le </font><a href=chantier_terrestre.php>chantier terrestre</a>";
|
||
else verification_des_ress(9, $metal, $cristal, $hydrogene, $a, $b, 0);
|
||
}
|
||
}
|
||
echo '</div><br class="a">';
|
||
}
|
||
|
||
|
||
echo '<div class="a">
|
||
<img src="images/batiments/'.$batimeni[9].'" alt="">
|
||
</div>
|
||
<div class="b">
|
||
<a href="descriptions.php?bat='.$batimend[9].'">'.$batiment[9].'</a> '; if ($caserne > 0) echo '(Niveau '.$caserne.')'; echo '<br>
|
||
Description.<br>
|
||
Besoin de : ';
|
||
$a=ceil(pow(2,$caserne)*200);
|
||
$b=ceil(pow(2,$caserne)*100);
|
||
ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h); echo '<br>
|
||
Temps de construction : '; sec(ceil(pow(2,$caserne)*300));
|
||
echo '</div>
|
||
<div class="c">';
|
||
if ($temps_b > 0) {
|
||
if ($bat==10) {
|
||
$tr=$temps_b-time();
|
||
echo '<table align=center><tr><td><div id="axion"></div></td></tr>';
|
||
echo '<script language="JavaScript">reste('.$tr.');</script>';
|
||
echo "<tr><td><a href=\"batiment_anul.php?bat=10\">Annuler</a></td></tr></table>";
|
||
}
|
||
}
|
||
else {
|
||
if ($case <= 0) echo '<font color="red">Plan<61>te pleine</font>';
|
||
else {
|
||
if($unit > 0) echo '<font color="red"><br><br>Entrainement en cours dans la </font><a href="caserne.php">caserne</a>';
|
||
else verification_des_ress(10, $metal, $cristal, $hydrogene, $a, $b, 0);
|
||
}
|
||
}
|
||
|
||
echo '</div>
|
||
<br class="a">
|
||
<div class="a">
|
||
<img src="images/batiments/'.$batimeni[10].'" alt="">
|
||
</div>
|
||
<div class="b">
|
||
<a href="descriptions.php?bat='.$batimend[10].'">'.$batiment[10].'</a> '; if ($silo > 0) echo '(Niveau '.$silo.')'; echo '<br>
|
||
Description.<br>
|
||
Besoin de : ';
|
||
$a=ceil(pow(2,$silo)*400);
|
||
$b=ceil(pow(2,$silo)*260);
|
||
ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h); echo '<br>
|
||
Temps de construction : '; sec(ceil(pow(2,$silo)*1200));
|
||
echo '</div>
|
||
<div class="c">';
|
||
if ($temps_b > 0) {
|
||
if ($bat==11) {
|
||
$tr=$temps_b-time();
|
||
echo '<table align=center><tr><td><div id="axion"></div></td></tr>';
|
||
echo '<script language="JavaScript">reste('.$tr.');</script>';
|
||
echo "<tr><td><a href=\"batiment_anul.php?bat=11\">Annuler</a></td></tr></table>";
|
||
}
|
||
}
|
||
else {
|
||
if ($case <= 0) echo '<font color="red">Plan<61>te pleine</font>';
|
||
else verification_des_ress(11, $metal, $cristal, $hydrogene, $a, $b, 0);
|
||
}
|
||
echo '</div>
|
||
</body>
|
||
</html>';
|
||
?>
|