HB/pages/batiment.php

353 lines
11 KiB
PHP
Raw Normal View History

2007-03-31 10:00:00 +00:00
<? session_start(); ?>
<html>
<head>
<title></title>
<link rel="stylesheet" media="screen" name="design" href="design/design.css">
<?
$id=$_SESSION['id'];
$galaxy=$_SESSION['galaxy'];
$ss=$_SESSION['ss'];
$pos=$_SESSION['pos'];
include 'ressource.php';
include 'bdd.php';
include 'ajout_niveau.php';
$case = $cases - ($mine_m +$mine_c +$mine_h +$centrale_s +$centrale_f +$radar+$labo+$chantier_terrestre +$chantier_spatial+$caserne +$silo );
function verification_des_ress($numbat,
$metal, $cristal, $hydrogene,
$ress_ness_metal, $ress_ness_cristal, $ress_ness_hydrogene)
{
if ($metal >= $ress_ness_metal && $cristal >= $ress_ness_cristal && $hydrogene >= $ress_ness_hydrogene)
{
echo "<font color=teal><a href=\"constructiion.php?bat=".$numbat."\">Construire</a></font>";
}
else
{
echo "<font color=red>Construire</font>";
}
}
function ressources($metal, $cristal, $hydrogene,
$ress_ness_metal, $ress_ness_cristal, $ress_ness_hydrogene)
{
if ($metal <= $ress_ness_metal)
{
$z=floor($metal)-$ress_ness_metal;
echo "<font color=red >M<>tal : <ACRONYM title=".$z.">".$ress_ness_metal."</ACRONYM></font>";
}
else {echo "<font color=teal >M<>tal : ".$ress_ness_metal." </font>";}
if ($cristal <= $ress_ness_cristal)
{
$z=floor($cristal)-$ress_ness_cristal;
echo "<font color=red >cristal : <ACRONYM title=".$z.">".$ress_ness_cristal."</ACRONYM></font>";
}
else {echo "<font color=teal >cristal : ".$ress_ness_cristal." </font>";}
if ($hydrogene <= $ress_ness_hydrogene)
{
$z=floor($hydrogene)-$ress_ness_hydrogene;
echo "<font color=red >hydrogene : <ACRONYM title=".$z.">".$ress_ness_hydrogene."</ACRONYM></font>";
}
else {echo "<font color=teal >hydrogene : ".$ress_ness_hydrogene." </font>";}
}
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;
}
?>
<script language="javascript" src="time.js"></script>
</head>
<body>
<table>
<tr>
<?
echo "<tr><td><img src=images/mine_m.png height=120 width=120></td>
<td width=600><a href=mine_m.php>Purificateur de m<EFBFBD>tal</a> niveau ".$mine_m."<br>
<br>
Co<EFBFBD>t: ";
$a=ceil(exp(($mine_m*0.400))*200);
$b=ceil(exp(($mine_m*0.400))*100);
ressources($metal, $cristal, $hydrogene, $a, $b, 0);
echo"<br>
Temps : ";
sec((ceil(pow(1.7,$mine_m)*120) - (0.005*$ingenieur*ceil(pow(1.7,($mine_m-1))*120))));
echo"<td width=200>";
if ($temps > 0) {
if ($bat==1) {
$tr=$temps-time();
echo '<div id="axion"></div>';
echo '<script language="JavaScript">reste('.$tr.');</script>';
echo "<a href=\"anul_bat.php?bat=1\">Annuler</a>";
}
else {}
}
else { if ($case <= 0) { echo "Plan<EFBFBD>te pleine"; } else { verification_des_ress(1, $metal, $cristal, $hydrogene, $a, $b, 0); } }
echo"</td></tr>";
echo "<tr><td><img src=images/mine_c.png height=120 width=120></td>
<td width=600><a href=mine_c.php>Purificateur de cristal</a> niveau ".$mine_c."<br>
<br>
Co<EFBFBD>t: ";
$a=ceil(exp(($mine_c*0.430))*210);
$b=ceil(exp(($mine_c*0.430))*120);
ressources($metal, $cristal, $hydrogene, $a, $b, 0);
echo"<br>
Temps : ";
sec((ceil(pow(1.72,$mine_c)*160)) - (0.005*$ingenieur*ceil(pow(1.72,($mine_c-1))*160)));
echo"<td width=200>";
if ($temps > 0) {
if ($bat==2) {
$tr=$temps-time();
echo '<div id="axion"></div>';
echo '<script language="JavaScript">reste('.$tr.');</script>';
echo "<a href=\"anul_bat.php?bat=2\">Annuler</a>";
}
else {}
}
else { if ($case <= 0) { echo "Plan<EFBFBD>te pleine"; } else {verification_des_ress(2, $metal, $cristal, $hydrogene, $a, $b, 0); } }
echo"</td></tr>";
echo "<tr><td><img src=images/mine_h.png height=120 width=120></td>
<td width=600><a href=mine_h.php>Ionisateur</a> niveau ".$mine_h."<br>
<br>
Co<EFBFBD>t: ";
$a=ceil(exp(($mine_h*0.445))*250);
$b=ceil(exp(($mine_h*0.445))*170);
ressources($metal, $cristal, $hydrogene, $a, $b, 0);
echo"<br>
Temps : ";
sec((ceil(pow(1.75,$mine_h)*180)) - (0.005*$ingenieur*ceil(pow(1.75,($mine_h-1))*180)));
echo"<td width=200>";
if ($temps > 0) {
if ($bat==3) {
$tr=$temps-time();
echo '<div id="axion"></div>';
echo '<script language="JavaScript">reste('.$tr.');</script>';
echo "<a href=\"anul_bat.php?bat=3\">Annuler</a>";
}
else {}
}
else { if ($case <= 0) { echo "Plan<EFBFBD>te pleine"; } else {verification_des_ress(3, $metal, $cristal, $hydrogene, $a, $b, 0); } }
echo"</td></tr>";
echo "<tr><td><img src=images/centrale.JPG height=120 width=120></td>
<td width=600><a href=central_s.php>Centrale solaire</a> niveau ".$centrale_s."<br>
<br>
Co<EFBFBD>t: "; $n=($centrale_s-1);
$a=ceil(pow(2,$n)*300);
$b=ceil(pow(2,$n)*230);
ressources($metal, $cristal, $hydrogene, $a, $b, 0);
echo"<br>
Temps : ";
sec((ceil(pow(1.68,$centrale_s)*190)) - (0.005*$ingenieur*ceil(pow(1.68,($centrale_s-1))*190)));
echo"<td width=200>";
if ($temps > 0) {
if ($bat==4) {
$tr=$temps-time();
echo '<div id="axion"></div>';
echo '<script language="JavaScript">reste('.$tr.');</script>';
echo "<a href=\"anul_bat.php?bat=4\">Annuler</a>";
}
else {}
}
else { if ($case <= 0) { echo "Plan<EFBFBD>te pleine"; } else {verification_des_ress(4, $metal, $cristal, $hydrogene, $a, $b, 0); } }
echo"</td></tr>";
if ($centrale_s >= 12 && $energie_t >=5) {
echo "<tr><td><img src=images/centrale_f.png height=120 width=120></td>
<td width=600><a href=central_f.php>Centrale de fusion</a> niveau ".$centrale_f."<br>
<br>
Co<EFBFBD>t: ";
$n=($centrale_f-1);
$a=ceil(pow(2,$n)*165);
$b=ceil(pow(2,$n)*99);
ressources($metal, $cristal, $hydrogene, $a, $b, 0);
echo"<br>
Temps : ";
sec((ceil(pow(1.8,$centrale_f)*300)) - (0.005*$ingenieur*ceil(pow(1.8,($centrale_f-1))*300)));
echo"<td width=200>";
if ($temps > 0) {
if ($bat==5) {
$tr=$temps-time();
echo '<div id="axion"></div>';
echo '<script language="JavaScript">reste('.$tr.');</script>';
echo "<a href=\"anul_bat.php?bat=5\">Annuler</a>";
}
else {}
}
else { if ($case <= 0) { echo "Plan<EFBFBD>te pleine"; } else {verification_des_ress(5, $metal, $cristal, $hydrogene, $a, $b, 0); } }
echo"</td></tr>"; } else {}
if ($detection >= 1) {
echo "<tr><td><img src=images/radar.png height=120 width=120></td>
<td width=600>Oeil des proph<EFBFBD>tes niveau ".$radar."<br>
<br>
Co<EFBFBD>t: ";
$n=($radar-1);
$a=ceil(pow(2,$n)*750);
$b=ceil(pow(2,$n)*500);
$c=ceil(pow(2,$n)*50);
ressources($metal, $cristal, $hydrogene, $a, $b, $c);
echo"<br>
Temps : ";
sec((ceil(pow(2,$radar)*720) - (0.005*$ingenieur*ceil(pow(2,($radar-1))*720))));
echo"<td width=200>";
if ($temps > 0) {
if ($bat==6) {
$tr=$temps-time();
echo '<div id="axion"></div>';
echo '<script language="JavaScript">reste('.$tr.');</script>';
echo "<a href=\"anul_bat.php?bat=6\">Annuler</a>";
}
else {}
}
else { if ($case <= 0) { echo "Plan<EFBFBD>te pleine"; } else {verification_des_ress(6, $metal, $cristal, $hydrogene, $a, $b, $c); } }
echo"</td></tr>"; } else {}
echo "<tr><td><img src=images/labo.jpg height=120 width=120></td>
<td width=600>Centre de recherches niveau ".$labo."<br>
<br>
Co<EFBFBD>t: ";
$n=($labo-1);
$a=ceil(pow(2,$n)*200);
$b=ceil(pow(2,$n)*150);
ressources($metal, $cristal, $hydrogene, $a, $b, 0);
echo"<br>
Temps : ";
sec((ceil(pow(2,$labo)*720)) - (0.005*$ingenieur*ceil(pow(2,($labo-1))*720)));
echo"<td width=200>";
if ($temps > 0) {
if ($bat==7) {
$tr=$temps-time();
echo '<div id="axion"></div>';
echo '<script language="JavaScript">reste('.$tr.');</script>';
echo "<a href=\"anul_bat.php?bat=7\">Annuler</a>";
}
else {}
}
else { if ($case <= 0) { echo "Plan<EFBFBD>te pleine"; } else {if($tec > 0) {echo "<font color=red>Recherche en cours dans le </font><a href=labo.php>laboratoire</a>"; } else {verification_des_ress(7, $metal, $cristal, $hydrogene, $a, $b, 0);} } }
echo"</td></tr>";
echo "<tr><td><img src=images/chantier_terrestre.png height=120 width=120></td>
<td width=600>Chantier terrestre niveau ".$chantier_terrestre."<br>
<br>
Co<EFBFBD>t: ";
$n=($chantier_terrestre-1);
$a=ceil(pow(2,$n)*520);
$b=ceil(pow(2,$n)*380);
ressources($metal, $cristal, $hydrogene, $a, $b, 0);
echo"<br>
Temps : ";
sec((ceil(pow(2,$chantier_terrestre)*420)) - (0.005*$ingenieur*ceil(pow(2,($chantier_terrestre-1))*420)));
echo"<td width=200>";
if ($temps > 0) {
if ($bat==8) {
$tr=$temps-time();
echo '<div id="axion"></div>';
echo '<script language="JavaScript">reste('.$tr.');</script>';
echo "<a href=\"anul_bat.php?bat=8\">Annuler</a>";
}
else {}
}
else { if ($case <= 0) { echo "Plan<EFBFBD>te pleine"; } else {if($unit_t > 0) {echo "<font color=red>Construction en cours dans le </font>"; if ($unit_t<9 && $unit_s >0) {echo "<a href=chantier_terrestre.php>chantier terrestre</a>";} else if ( $unit_t>=9) {echo "<a href=defense.php>centre de d<>fenses</a>";} }
else {verification_des_ress(8, $metal, $cristal, $hydrogene, $a, $b, 0); } } }
echo"</td></tr>";
if ($chantier_terrestre >= 2) {
echo "<tr><td><img src= height=120 width=120></td>
<td width=600>Chantier spatial niveau ".$chantier_spatial."<br>
<br>
Co<EFBFBD>t: ";
$n=($chantier_spatial-1);
$a=ceil(pow(2,$n)*600);
$b=ceil(pow(2,$n)*450);
ressources($metal, $cristal, $hydrogene, $a, $b, 0);
echo"<br>
Temps : ";
sec((ceil(pow(2,$chantier_spatial)*600)) - (0.005*$ingenieur*ceil(pow(2,($chantier_spatial-1))*600)));
echo"<td width=200>";
if ($temps > 0) {
if ($bat==9) {
$tr=$temps-time();
echo '<div id="axion"></div>';
echo '<script language="JavaScript">reste('.$tr.');</script>';
echo "<a href=\"anul_bat.php?bat=9\">Annuler</a>";
}
else {}
}
else { if ($case <= 0) { echo "Plan<EFBFBD>te pleine"; } else {if($unit_s > 0) {echo "<font color=red>Construction en cours dans le </font><a href=chantier_spatial.php>chantier spatial</a>"; } else {verification_des_ress(9, $metal, $cristal, $hydrogene, $a, $b, 0); } } }
echo"</td></tr>"; } else {}
echo "<tr><td><img src=images/caserne.jpg height=120 width=120></td>
<td width=600>Caserne niveau ".$caserne."<br>
<br>
Co<EFBFBD>t: ";
$n=($caserne-1);
$a=ceil(pow(2,$n)*200);
$b=ceil(pow(2,$n)*100);
ressources($metal, $cristal, $hydrogene, $a, $b, 0);
echo"<br>
Temps : ";
sec((ceil(pow(2,$caserne)*300)) - (0.005*$ingenieur*ceil(pow(2,($caserne-1))*300)));
echo"<td width=200>";
if ($temps > 0) {
if ($bat==10) {
$tr=$temps-time();
echo '<div id="axion"></div>';
echo '<script language="JavaScript">reste('.$tr.');</script>';
echo "<a href=\"anul_bat.php?bat=10\">Annuler</a>";
}
else {}
}
else { if ($case <= 0) { echo "Plan<EFBFBD>te pleine"; } else {if($unit > 0) {echo "<font color=red>Entrainement en cours dans la </font><a href=troupes.php>caserne</a>"; } else {verification_des_ress(10, $metal, $cristal, $hydrogene, $a, $b, 0); }} }
echo"</td></tr>";
echo "<tr><td><img src=images/silo.jpg height=120 width=120></td>
<td width=600>Entrep<EFBFBD>t niveau ".$silo."<br>
<br>
Co<EFBFBD>t: ";
$n=($silo-1);
$a=ceil(pow(2,$n)*400);
$b=ceil(pow(2,$n)*260);
ressources($metal, $cristal, $hydrogene, $a, $b, 0);
echo"<br>
Temps : ";
sec((ceil(pow(2,$silo)*1200)) - (0.005*$ingenieur*ceil(pow(2,($silo-1))*1200)));
echo"<td width=200>";
if ($temps > 0) {
if ($bat==11) {
$tr=$temps-time();
echo '<div id="axion"></div>';
echo '<script language="JavaScript">reste('.$tr.');</script>';
echo "<a href=\"anul_bat.php?bat=11\">Annuler</a>";
}
else {}
}
else { if ($case <= 0) { echo "Plan<EFBFBD>te pleine"; } else {verification_des_ress(11, $metal, $cristal, $hydrogene, $a, $b, 0); } }
echo"</td></tr>";
?>
</body>
</html>