HB/page/ressource1.php

132 lines
3.3 KiB
PHP

<? session_start(); ?>
<html>
<head>
<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';
$cap = (pow(2,$silo)*100000);
$prod_metal = ceil((($mine_m*40+(exp($mine_m*0.33)*10))*$coeff));
$prod_cristal = ceil((($mine_c*20+(exp($mine_c*0.325)*10))*$coeff));
if ($centrale_f > 0) { $conso_hy = ceil(($centrale_f*5+(exp($mine_m*0.3)*10))*$coeff); } else { $conso_hy=0; }
if ($mine_h >0 ) { $prod_hydrogene = ceil(($mine_h*12+(exp($mine_h*0.32)*10))*$coeff); } else { $prod_hydrogene=0; }
if ($mine_h == 0) { $w=0;}
if (($prod_hydrogene-$conso_hy) < 0) { $w= 0; }
if ($mine_m > 0) { $energie_m = ceil((exp($mine_m*0.28)*10))*$coeff; } else { $energie_m=0;}
if ($mine_c > 0) { $energie_c = ceil((exp($mine_c*0.28)*10))*$coeff; } else { $energie_c=0;}
if ($mine_h > 0) { $energie_h = ceil((exp($mine_h*0.31)*10))*$coeff; } else { $energie_h=0;}
if ($centrale_s >0 ) {$energie_s = ceil((($centrale_s*20+(exp($centrale_s*0.3)*10))*$coeff)); } else { $energie_s =0;}
if ($centrale_f >0 ) {$energie_f = ceil((($centrale_f*80+(exp($centrale_f*0.38)*11))*$coeff)); } else { $energie_f =0;}
$w = $prod_hydrogene - $conso_hy;
$u= ($energie_s+$energie_f) - ($energie_m+$energie_c+$energie_h);
?>
</head>
<body>
<? echo "<center>
<table>
<tbody><tr>
<td>
Facteur de production : ".$coeff."
<form action=resource2.php method=post>
<table width=550>
<tbody><tr>
<td colspan=6 align=left>
Production sur ".$nomplanete."
</td>
</tr>
<tr>
<th colspan=2>
</th>
<th>
Métal
</th>
<th>
Cristal
</th>
<th>
Hydrogène
</th>
<th>
Energie
</th>
</tr>
<tr>";
echo "<tr><th>Purificateur de métal (".$mine_m.")</th><th>&nbsp;</th>
<th><font color=lime>".$prod_metal."</font></th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th><font color=red>".-$energie_m."</font></th></tr>";
echo " <tr>
<th>Purificateur de cristal (".$mine_c.")</th><th>&nbsp;</th>
<th>&nbsp;</th>
<th><font color=lime>".$prod_cristal."</font></th>
<th>&nbsp;</th>
<th><font color=red>".-$energie_c."</font></th></tr>
</tr>";
if ($mine_h > 0) {
echo " <tr>
<th>Ionisateur (".$mine_h.")</th><th>&nbsp;</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th><font color=lime>".$prod_hydrogene."</font></th>
<th><font color=red>".-$energie_h."</th></font></tr>
</tr>
</tr>"; }
if ($centrale_s > 0) {
echo " <tr>
<th>Centrale solaire (".$centrale_s.")</th><th>&nbsp;</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th></th>
<th><font color=lime>".$energie_s."</font></th></tr>
</tr>"; }
if ($centrale_f > 0) {
echo " <tr>
<th>Centrale de fusion (".$centrale_f.")</th><th>&nbsp;</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th><font color=red>".-$conso_hy."</font></th>
<th><font color=lime>".$energie_f."</font></th></tr>
</tr>"; }
echo "<tr>
</tr><tr>
<th colspan=2>Capacité des dépôts</th>
<td><font color=lime>".$cap."</font></td>
<td><font color=lime>".$cap."</font></td>
<td><font color=lime>".$cap."</font></td>
<td><font color=lime>-</font></td></tr>
<tr>
<th colspan=2>Total</th>
<td><font color=lime>".$prod_metal."</font></td>
<td><font color=lime>".$prod_cristal."</font></td>
<td><font color=lime>".$w."</font></td>
<td><font color=lime>".$u."</font></td></tr>
</tbody>
</table>
</form>
</center>"; ?>
</body>
</html>