HB/pages/labo.php

364 lines
11 KiB
PHP

<? 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ène : <ACRONYM title=".$z.">".$ress_ness_nourriture."</ACRONYM></font>";
}
else {echo "<font color=teal >Hydrogè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/informatique.jpg height=120 width=120></td>
<td width=600>Informatique niveau ".$informatique."<br>
<br>
Coû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'é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= height=120 width=120></td>
<td width=600>Détection niveau ".$detection."<br>
<br>
Coû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'évolution"; } else {verification_des_ress(2, $metal, $cristal, $hydrogene, $a, $b, $c); } }
echo"</td></tr>"; } else {}
if ($labo >= 5) {
echo "<tr><td><img src= height=120 width=120></td>
<td width=600>Armement niveau ".$armement."<br>
<br>
Coû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'é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/bouclier.jpg height=120 width=120></td>
<td width=600>Bouclier niveau ".$blindage."<br>
<br>
Coû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'évolution"; } else {verification_des_ress(12, $metal, $cristal, $hydrogene, $a, $b,0); } }
echo"</td></tr>"; } else {}
if ($labo >= 2) {
echo "<tr><td><img src= height=120 width=120></td>
<td width=600>Maitrise de l'énergie niveau ".$energie_t."<br>
<br>
Coû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'é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éacteur a antigravité niveau ".$reacteur."<br>
<br>
Coû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'é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= height=120 width=120></td>
<td width=600>Réacteur a fusion niveau ".$reacteur_f."<br>
<br>
Coû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'é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éacteur a fusion Forruneur niveau ".$reacteur_ff."<br>
<br>
Coû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'é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édecine niveau ".$medecine."<br>
<br>
Coû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'é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>Commandemant militaire niveau ".$tactique."<br>
<br>
Coû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'é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= height=120 width=120></td>
<td width=600>Développement niveau ".$developpement."<br>
<br>
Coû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'évolution"; } else {verification_des_ress(11, $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ès"; }
?>
</body>
</html>