HB/pages/batiment.php

412 lines
14 KiB
PHP
Raw Normal View History

2007-10-27 10:00:00 +00:00
<?php
2007-11-03 11:00:00 +00:00
session_start();
2007-03-31 10:00:00 +00:00
$id=$_SESSION['id'];
$galaxy=$_SESSION['galaxy'];
$ss=$_SESSION['ss'];
$pos=$_SESSION['pos'];
2007-11-03 11:00:00 +00:00
echo"<html>
<head>
2007-10-27 10:00:00 +00:00
<title>Halo battle</title>
2007-03-31 10:00:00 +00:00
2007-11-03 11:00:00 +00:00
<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 >
2007-10-27 10:00:00 +00:00
<link rel=shortcut icon type=image/x-icon href=favicon.ico >
2007-03-31 10:00:00 +00:00
2007-10-27 10:00:00 +00:00
<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';
2007-03-31 10:00:00 +00:00
2007-10-27 10:00:00 +00:00
function sec($time) {
2007-03-31 10:00:00 +00:00
$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;
}
2007-11-03 11:00:00 +00:00
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) {
2007-10-27 10:00:00 +00:00
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> ';
2007-11-03 11:00:00 +00:00
}
2007-10-27 10:00:00 +00:00
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> ';
2007-11-03 11:00:00 +00:00
}
2007-10-27 10:00:00 +00:00
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>';
2007-11-03 11:00:00 +00:00
}
2007-10-27 10:00:00 +00:00
else echo "Hydrog<EFBFBD>ne : <span class=rc>".$need_ro."</span>";
}
2007-11-03 11:00:00 +00:00
}
2007-10-27 10:00:00 +00:00
$case = $cases - ($mine_m + $mine_c + $mine_h + $centrale_s + $centrale_f + $radar + $labo + $chantier_terrestre + $chantier_spatial + $caserne + $silo);
2007-11-03 11:00:00 +00:00
2007-10-27 10:00:00 +00:00
echo '<script language="javascript" src="time.js"></script>
2007-03-31 10:00:00 +00:00
</head>
<body>
2007-10-27 10:00:00 +00:00
<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="" />
2007-11-03 11:00:00 +00:00
</div>
2007-10-27 10:00:00 +00:00
<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<EFBFBD>s <EFBFBD>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">';
2007-11-03 11:00:00 +00:00
if ($temps_b > 0) {
2007-03-31 10:00:00 +00:00
if ($bat==1) {
2007-10-27 10:00:00 +00:00
$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>";
2007-03-31 10:00:00 +00:00
}
}
2007-10-27 10:00:00 +00:00
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="">
2007-11-03 11:00:00 +00:00
</div>
2007-10-27 10:00:00 +00:00
<div class="b">
<a href="descriptions.php?bat='.$batimend[1].'">'.$batiment[1].'</a> '; if ($mine_c > 0) echo '(Niveau '.$mine_c.')'; echo '<br>
2007-11-03 11:00:00 +00:00
Description.<br>
2007-10-27 10:00:00 +00:00
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">';
2007-11-03 11:00:00 +00:00
if ($temps_b > 0) {
2007-03-31 10:00:00 +00:00
if ($bat==2) {
2007-10-27 10:00:00 +00:00
$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>";
2007-03-31 10:00:00 +00:00
}
}
2007-10-27 10:00:00 +00:00
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="">
2007-11-03 11:00:00 +00:00
</div>
2007-10-27 10:00:00 +00:00
<div class="b">
<a href="descriptions.php?bat='.$batimend[2].'">'.$batiment[2].'</a> '; if ($mine_h > 0) echo '(Niveau '.$mine_h.')'; echo '<br>
2007-11-03 11:00:00 +00:00
Description.<br>
2007-10-27 10:00:00 +00:00
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">';
2007-11-03 11:00:00 +00:00
if ($temps_b > 0) {
2007-03-31 10:00:00 +00:00
if ($bat==3) {
2007-10-27 10:00:00 +00:00
$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>";
2007-03-31 10:00:00 +00:00
}
}
2007-10-27 10:00:00 +00:00
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="">
2007-11-03 11:00:00 +00:00
</div>
2007-10-27 10:00:00 +00:00
<div class="b">
<a href="descriptions.php?bat='.$batimend[3].'">'.$batiment[3].'</a> '; if ($centrale_s > 0) echo '(Niveau '.$centrale_s.')'; echo '<br>
2007-11-03 11:00:00 +00:00
Description.<br>
2007-10-27 10:00:00 +00:00
Besoin de : ';
$a=ceil(pow(2,$centrale_s)*300);
2007-11-03 11:00:00 +00:00
$b=ceil(pow(2,$centrale_s)*230);
2007-10-27 10:00:00 +00:00
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">';
2007-11-03 11:00:00 +00:00
if ($temps_b > 0) {
2007-03-31 10:00:00 +00:00
if ($bat==4) {
2007-10-27 10:00:00 +00:00
$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>";
2007-03-31 10:00:00 +00:00
}
}
2007-10-27 10:00:00 +00:00
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>";
}
2007-03-31 10:00:00 +00:00
}
2007-10-27 10:00:00 +00:00
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">';
2007-03-31 10:00:00 +00:00
}
if ($detection >= 1) {
2007-10-27 10:00:00 +00:00
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);
2007-03-31 10:00:00 +00:00
}
2007-10-27 10:00:00 +00:00
echo '</div><br class="a">';
2007-03-31 10:00:00 +00:00
}
2007-11-03 11:00:00 +00:00
2007-10-27 10:00:00 +00:00
echo '<div class="a">
<img src="images/batiments/'.$batimeni[6].'" alt="">
2007-11-03 11:00:00 +00:00
</div>
2007-10-27 10:00:00 +00:00
<div class="b">
<a href="descriptions.php?bat='.$batimend[6].'">'.$batiment[6].'</a> '; if ($labo > 0) echo '(Niveau '.$labo.')'; echo '<br>
2007-11-03 11:00:00 +00:00
Description.<br>
2007-10-27 10:00:00 +00:00
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">';
2007-11-03 11:00:00 +00:00
if ($temps_b > 0) {
2007-03-31 10:00:00 +00:00
if ($bat==7) {
2007-10-27 10:00:00 +00:00
$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>";
2007-03-31 10:00:00 +00:00
}
}
2007-10-27 10:00:00 +00:00
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="">
2007-11-03 11:00:00 +00:00
</div>
2007-10-27 10:00:00 +00:00
<div class="b">
<a href="descriptions.php?bat='.$batimend[7].'">'.$batiment[7].'</a> '; if ($chantier_terrestre > 0) echo '(Niveau '.$chantier_terrestre.')'; echo '<br>
2007-11-03 11:00:00 +00:00
Description.<br>
2007-10-27 10:00:00 +00:00
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">';
2007-11-03 11:00:00 +00:00
if ($temps_b > 0) {
2007-03-31 10:00:00 +00:00
if ($bat==8) {
2007-10-27 10:00:00 +00:00
$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>";
2007-03-31 10:00:00 +00:00
}
}
2007-11-03 11:00:00 +00:00
else {
2007-10-27 10:00:00 +00:00
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">';
2007-03-31 10:00:00 +00:00
if ($chantier_terrestre >= 2) {
2007-10-27 10:00:00 +00:00
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);
}
2007-03-31 10:00:00 +00:00
}
2007-10-27 10:00:00 +00:00
echo '</div><br class="a">';
2007-03-31 10:00:00 +00:00
}
2007-11-03 11:00:00 +00:00
2007-10-27 10:00:00 +00:00
echo '<div class="a">
<img src="images/batiments/'.$batimeni[9].'" alt="">
2007-11-03 11:00:00 +00:00
</div>
2007-10-27 10:00:00 +00:00
<div class="b">
<a href="descriptions.php?bat='.$batimend[9].'">'.$batiment[9].'</a> '; if ($caserne > 0) echo '(Niveau '.$caserne.')'; echo '<br>
2007-11-03 11:00:00 +00:00
Description.<br>
2007-10-27 10:00:00 +00:00
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">';
2007-11-03 11:00:00 +00:00
if ($temps_b > 0) {
2007-03-31 10:00:00 +00:00
if ($bat==10) {
2007-10-27 10:00:00 +00:00
$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>";
2007-03-31 10:00:00 +00:00
}
}
2007-11-03 11:00:00 +00:00
else {
2007-10-27 10:00:00 +00:00
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);
}
}
2007-11-03 11:00:00 +00:00
2007-10-27 10:00:00 +00:00
echo '</div>
<br class="a">
<div class="a">
<img src="images/batiments/'.$batimeni[10].'" alt="">
2007-11-03 11:00:00 +00:00
</div>
2007-10-27 10:00:00 +00:00
<div class="b">
<a href="descriptions.php?bat='.$batimend[10].'">'.$batiment[10].'</a> '; if ($silo > 0) echo '(Niveau '.$silo.')'; echo '<br>
2007-11-03 11:00:00 +00:00
Description.<br>
2007-10-27 10:00:00 +00:00
Besoin de : ';
$a=ceil(pow(2,$silo)*400);
2007-11-03 11:00:00 +00:00
$b=ceil(pow(2,$silo)*260);
2007-10-27 10:00:00 +00:00
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">';
2007-11-03 11:00:00 +00:00
if ($temps_b > 0) {
2007-03-31 10:00:00 +00:00
if ($bat==11) {
2007-10-27 10:00:00 +00:00
$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>";
2007-03-31 10:00:00 +00:00
}
}
2007-11-03 11:00:00 +00:00
else {
2007-10-27 10:00:00 +00:00
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>
2007-03-31 10:00:00 +00:00
</body>
2007-10-27 10:00:00 +00:00
</html>';
?>