HB/page/labo.php

391 lines
12 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_t.php';
function verification_des_ress($numtec,
$metal, $calcium, $nourriture,
$ress_ness_metal, $ress_ness_calcium, $ress_ness_nourriture)
{
if ($metal >= $ress_ness_metal && $calcium >= $ress_ness_calcium && $nourriture >= $ress_ness_nourriture)
{
echo "<font color=teal><a href=\"construction.php?tec=".$numtec."\">Construire</a></font>";
}
else
{
echo "<font color=red>Construire</font>";
}
}
function ressources($metal, $calcium, $nourriture,
$ress_ness_metal, $ress_ness_calcium, $ress_ness_nourriture)
{
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 ($calcium <= $ress_ness_calcium)
{
$z=floor($calcium)-$ress_ness_calcium;
echo "<font color=red >Cristal : <ACRONYM title=".$z.">".$ress_ness_calcium."</ACRONYM></font>";
}
else {echo "<font color=teal >Cristal : ".$ress_ness_calcium." </font>";}
if ($nourriture <= $ress_ness_nourriture)
{
$z=floor($nourriture)-$ress_ness_nourriture;
echo "<font color=red >Hydrog<6F>ne : <ACRONYM title=".$z.">".$ress_ness_nourriture."</ACRONYM></font>";
}
else {echo "<font color=teal >Hydrog<6F>ne : ".$ress_ness_nourriture." </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>
<?
if ($labo > 0) {
if ($labo >= 1) {
echo "<tr><td><img src=images/ordinateur.jpg height=120 width=120></td>
<td width=600>IA niveau ".$informatique."<br>
<br>
Co<EFBFBD>t: "; $n=($informatique-1);
$b=ceil(pow(2,$n)*500);
$c=ceil(pow(2,$n)*150);
ressources($metal, $cristal, $hydrogene, 0, $b, $c);
echo"<br>
Temps : ";
sec(ceil((pow(2,$labo)*840) - ((pow(2,$labo)*840)*0.07*$labo)));
echo"<td width=200>";
if ($temps_t > 0) {
if ($tec==1) {
$tr=$temps_t-time();
echo '<div id="axion"></div>';
echo '<script language="JavaScript">reste('.$tr.');</script>';
echo "<a href=\"anul_tec.php?tec=1\">Annuler</a>";
}
else {}
}
else { if($bat == 7) {echo "Le laboratoire est en cours d'<27>volution"; } else {verification_des_ress(1, $metal, $cristal, $hydrogene, 0, $b, $c); } }
echo"</td></tr>"; } else {}
if ($labo >= 2 && $informatique >=2) {
echo "<tr><td><img src=images/radar_techno.jpg height=120 width=120></td>
<td width=600>Radar niveau ".$detection."<br>
<br>
Co<EFBFBD>t: "; $n=($detection-1);
$a=ceil(pow(2,$n)*500);
$b=ceil(pow(2,$n)*750);
$c=ceil(pow(2,$n)*100);
ressources($metal, $cristal, $hydrogene, $a, $b, $c);
echo"<br>
Temps : ";
sec(ceil((pow(2,$labo)*1200) - ((pow(2,$labo)*1200)*0.07*$labo)));
echo"<td width=200>";
if ($temps_t > 0) {
if ($tec==2) {
$tr=$temps_t-time();
echo '<div id="axion"></div>';
echo '<script language="JavaScript">reste('.$tr.');</script>';
echo "<a href=\"anul_tec.php?tec=2\">Annuler</a>";
}
else {}
}
else { if($bat == 7) {echo "Le laboratoire est en cours d'<27>volution"; } else {verification_des_ress(2, $metal, $cristal, $hydrogene, $a, $b, $c); } }
echo"</td></tr>"; } else {}
if ($labo >= 5) {
echo "<tr><td><img src=images/armement.jpg height=120 width=120></td>
<td width=600>Armement niveau ".$armement."<br>
<br>
Co<EFBFBD>t: ";$n=($armement-1);
$a=ceil(pow(2,$n)*2500);
$b=ceil(pow(2,$n)*500);
ressources($metal, $cristal, $hydrogene, $a, $b, 0);
echo"<br>
Temps : ";
sec(ceil((pow(2,$labo)*3000) - ((pow(2,$labo)*3000)*0.07*$labo)));
echo"<td width=200>";
if ($temps_t > 0) {
if ($tec==3) {
$tr=$temps_t-time();
echo '<div id="axion"></div>';
echo '<script language="JavaScript">reste('.$tr.');</script>';
echo "<a href=\"anul_tec.php?tec=3\">Annuler</a>";
}
else {}
}
else { if($bat == 7) {echo "Le laboratoire est en cours d'<27>volution"; } else {verification_des_ress(3, $metal, $cristal, $hydrogene, $a, $b, 0); } }
echo"</td></tr>"; } else {}
if ($labo >= 4) {
echo "<tr><td><img src=images/blindage.jpg height=120 width=120></td>
<td width=600>Blindage niveau ".$blindage."<br>
<br>
Co<EFBFBD>t: ";$n=($blindage-1);
$a=ceil(pow(2,$n)*4000);
$b=ceil(pow(2,$n)*1500);
ressources($metal, $cristal, $hydrogene, $a, $b, 0);
echo"<br>
Temps : ";
sec(ceil((pow(2,$labo)*3420) - ((pow(2,$labo)*3420)*0.07*$labo)));
echo"<td width=200>";
if ($temps_t > 0) {
if ($tec==12) {
$tr=$temps_t-time();
echo '<div id="axion"></div>';
echo '<script language="JavaScript">reste('.$tr.');</script>';
echo "<a href=\"anul_tec.php?tec=12\">Annuler</a>";
}
else {}
}
else { if($bat == 7) {echo "Le laboratoire est en cours d'<27>volution"; } else {verification_des_ress(12, $metal, $cristal, $hydrogene, $a, $b,0); } }
echo"</td></tr>"; } else {}
if ($labo >= 2) {
echo "<tr><td><img src=images/energie_t.jpg height=120 width=120></td>
<td width=600>Maitrise de l'<EFBFBD>nergie niveau ".$energie_t."<br>
<br>
Co<EFBFBD>t: ";
$n=($energie_t-1);
$a=ceil(pow(2,$n)*2000);
$b=ceil(pow(2,$n)*1500);
$c=ceil(pow(2,$n)*300);
ressources($metal, $cristal, $hydrogene, $a, $b, $c);
echo"<br>
Temps : ";
sec(ceil((pow(2,$labo)*1800) - ((pow(2,$labo)*1800)*0.07*$labo)));
echo"<td width=200>";
if ($temps_t > 0) {
if ($tec==5) {
$tr=$temps_t-time();
echo '<div id="axion"></div>';
echo '<script language="JavaScript">reste('.$tr.');</script>';
echo "<a href=\"anul_tec.php?tec=5\">Annuler</a>";
}
else {}
}
else { if($bat == 7) {echo "Le laboratoire est en cours d'<27>volution"; } else {verification_des_ress(5, $metal, $cristal, $hydrogene, $a, $b, $c); } }
echo"</td></tr>"; } else {}
if ($labo >= 2) {
echo "<tr><td><img src=images/reacteur.jpg height=120 width=120></td>
<td width=600>R<EFBFBD>acteur <EFBFBD> combustion niveau ".$reacteur."<br>
<br>
Co<EFBFBD>t: ";$n=($reacteur-1);
$a=ceil(pow(2,$n)*1400);
$b=ceil(pow(2,$n)*400);
ressources($metal, $cristal, $hydrogene, $a, $b, 0);
echo"<br>
Temps : ";
sec(ceil((pow(2,$labo)*1020) - ((pow(2,$labo)*1020)*0.07*$labo)));
echo"<td width=200>";
if ($temps_t > 0) {
if ($tec==6) {
$tr=$temps_t-time();
echo '<div id="axion"></div>';
echo '<script language="JavaScript">reste('.$tr.');</script>';
echo "<a href=\"anul_tec.php?tec=6\">Annuler</a>";
}
else {}
}
else { if($bat == 7) {echo "Le laboratoire est en cours d'<27>volution"; } else {verification_des_ress(6, $metal, $cristal, $hydrogene, $a, $b, 0); } }
echo"</td></tr>"; } else {}
if ($labo >= 4 && $energie_t >=2 && $reacteur >= 4) {
echo "<tr><td><img src=images/reacteur_f.jpg height=120 width=120></td>
<td width=600>R<EFBFBD>acteur <EFBFBD> fusion niveau ".$reacteur_f."<br>
<br>
Co<EFBFBD>t: ";
$n=($reacteur_f-1);
$a=ceil(pow(2,$n)*3000);
$b=ceil(pow(2,$n)*2100);
$c=ceil(pow(2,$n)*750);
ressources($metal, $cristal, $hydrogene, $a, $b, $c);
echo"<br>
Temps : ";
sec(ceil((pow(2,$labo)*3300) - ((pow(2,$labo)*3300)*0.07*$labo)));
echo"<td width=200>";
if ($temps_t > 0) {
if ($tec==7) {
$tr=$temps_t-time();
echo '<div id="axion"></div>';
echo '<script language="JavaScript">reste('.$tr.');</script>';
echo "<a href=\"anul_tec.php?tec=7\">Annuler</a>";
}
else {}
}
else { if($bat == 7) {echo "Le laboratoire est en cours d'<27>volution"; } else {verification_des_ress(7, $metal, $cristal, $hydrogene, $a, $b, $c); } }
echo"</td></tr>"; } else {}
if ($labo >= 6 && $energie_t >=5 && $reacteur_f >= 4) {
echo "<tr><td><img src=images/reacteur_ff.jpg height=120 width=120></td>
<td width=600>R<EFBFBD>acteur a fusion de type II niveau ".$reacteur_ff."<br>
<br>
Co<EFBFBD>t: ";
$n=($reacteur_ff-1);
$a=ceil(pow(2,$n)*5000);
$b=ceil(pow(2,$n)*4000);
$c=ceil(pow(2,$n)*1500);
ressources($metal, $cristal, $hydrogene, $a, $b, $c);
echo"<br>
Temps : ";
sec(ceil((pow(2,$labo)*4800) - ((pow(2,$labo)*4800)*0.07*$labo)));
echo"<td width=200>";
if ($temps_t > 0) {
if ($tec==8) {
$tr=$temps_t-time();
echo '<div id="axion"></div>';
echo '<script language="JavaScript">reste('.$tr.');</script>';
echo "<a href=\"anul_tec.php?tec=8\">Annuler</a>";
}
else {}
}
else { if($bat == 7) {echo "Le laboratoire est en cours d'<27>volution"; } else {verification_des_ress(8, $metal, $cristal, $hydrogene, $a, $b, $c); } }
echo"</td></tr>"; } else {}
if ($labo >= 1) {
echo "<tr><td><img src=images/medecine.jpg height=120 width=120></td>
<td width=600>M<EFBFBD>decine niveau ".$medecine."<br>
<br>
Co<EFBFBD>t: ";
$n=($medecine-1);
$a=ceil(pow(2,$n)*800);
$b=ceil(pow(2,$n)*1000);
ressources($metal, $cristal, $hydrogene, $a, $b,0);
echo"<br>
Temps : ";
sec(ceil((pow(2,$labo)*720) - ((pow(2,$labo)*720)*0.07*$labo)));
echo"<td width=200>";
if ($temps_t > 0) {
if ($tec==9) {
$tr=$temps_t-time();
echo '<div id="axion"></div>';
echo '<script language="JavaScript">reste('.$tr.');</script>';
echo "<a href=\"anul_tec.php?tec=9\">Annuler</a>";
}
else {}
}
else { if($bat == 7) {echo "Le laboratoire est en cours d'<27>volution"; } else {verification_des_ress(9, $metal, $cristal, $hydrogene, $a, $b, 0); } }
echo"</td></tr>"; } else {}
if ($labo >= 3) {
echo "<tr><td><img src=images/tactique.jpg height=120 width=120></td>
<td width=600>Tactiques de combats niveau ".$tactique."<br>
<br>
Co<EFBFBD>t: ";
$n=($tactique-1);
$a=ceil(pow(2,$n)*2600);
$b=ceil(pow(2,$n)*2600);
ressources($metal, $cristal, $hydrogene, $a, $b, 0);
echo"<br>
Temps : ";
sec(ceil((pow(2,$labo)*22800) - ((pow(2,$labo)*2280)*0.07*$labo)));
echo"<td width=200>";
if ($temps_t > 0) {
if ($tec==10) {
$tr=$temps_t-time();
echo '<div id="axion"></div>';
echo '<script language="JavaScript">reste('.$tr.');</script>';
echo "<a href=\"anul_tec.php?tec=10\">Annuler</a>";
}
else {}
}
else { if($bat == 7) {echo "Le laboratoire est en cours d'<27>volution"; } else {verification_des_ress(10, $metal, $cristal, $hydrogene, $a, $b, 0); } }
echo"</td></tr>"; } else {}
if ($labo >= 8 && $mine_m >= 18 && $mine_c >= 15 && $informatique >= 8) {
echo "<tr><td><img src=images/citydevlopment.jpg height=120 width=120></td>
<td width=600>D<EFBFBD>veloppement niveau ".$developpement."<br>
<br>
Co<EFBFBD>t: ";
$n=($developpement-1);
$a=ceil(pow(2,$n)*10000);
$b=ceil(pow(2,$n)*10000);
$c=ceil(pow(2,$n)*5000);
ressources($metal, $cristal, $hydrogene, $a, $b, $c);
echo"<br>
Temps : ";
sec(ceil((pow(2,$labo)*8220) - ((pow(2,$labo)*8220)*0.07*$labo)));
echo"<td width=200>";
if ($temps_t > 0) {
if ($tec==11) {
$tr=$temps_t-time();
echo '<div id="axion"></div>';
echo '<script language="JavaScript">reste('.$tr.');</script>';
echo "<a href=\"anul_tec.php?tec=11\">Annuler</a>";
}
else {}
}
else { if($bat == 7) {echo "Le laboratoire est en cours d'<27>volution"; } else {verification_des_ress(11, $metal, $cristal, $hydrogene, $a, $b, $c); } }
echo"</td></tr>"; } else {}
if ($labo >= 8 && $medecine >= 5 && $informatique >= 8) {
echo "<tr><td><img src=images/spartan_techno.jpg height=120 width=120></td>
<td width=600>Spartan niveau ".$spartan."<br>
<br>
Co<EFBFBD>t: ";
$n=($spartan-1);
$a=ceil(pow(3,$n)*5200);
$b=ceil(pow(3,$n)*4250);
$c=ceil(pow(3,$n)*850);
ressources($metal, $cristal, $hydrogene, $a, $b, $c);
echo"<br>
Temps : ";
sec(ceil((pow(2,$labo)*10000) - ((pow(3,$labo)*10000)*0.07*$labo)));
echo"<td width=200>";
if ($temps_t > 0) {
if ($tec==13) {
$tr=$temps_t-time();
echo '<div id="axion"></div>';
echo '<script language="JavaScript">reste('.$tr.');</script>';
echo "<a href=\"anul_tec.php?tec=13\">Annuler</a>";
}
else {}
}
else { if($bat == 7) {echo "Le laboratoire est en cours d'<27>volution"; } else {verification_des_ress(13, $metal, $cristal, $hydrogene, $a, $b, $c); } }
echo"</td></tr>"; } else {}
}
else { ?><SCRIPT language="javascript">
parent.frames["changement"].window.location="sans_labo.php"
</SCRIPT> <?
echo "Vous devez construire un laboratoire pour y avoir acc<63>s"; }
?>
</body>
</html>