HB/pages/ressources.php

137 lines
3.4 KiB
PHP

<?php
session_start();
define('DESIGN', 'descriptions/diz/base.css');
require('../header.php');
$id=$_SESSION['id'];
$galaxy=$_SESSION['galaxy'];
$ss=$_SESSION['ss'];
$pos=$_SESSION['pos'];
require_once('bdd.php');
require_once('ressource.php');
require_once('noms.php');
$cap = (pow(2,$silo)*100000);
$prod_metal = (ceil((($mine_m*40+(exp($mine_m*0.33)*10))*$coeff)))*3;
$prod_cristal = (ceil((($mine_c*20+(exp($mine_c*0.325)*10))*$coeff)))*3;
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))*3; 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);
echo"<style TYPE=text/css>
TH {
background-color: #00024A;
border: 1px solid #02058A;
}
</style>
</head>
<body>";
echo "<center>
<table>
<tbody><tr>
<td>
Facteur de production : "; if ($coeff < 1) echo "<font color=red>".$coeff."</font>"; else echo $coeff;
echo"<form action=resource2.php method=post>
<table width=550>
<tbody><tr>
<td colspan=6 align=left>
Production sur ".$nom_planete."
</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 colspan=2>".$batiment[0]." (".$mine_m.")</th>";
echo "<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 colspan=2>".$batiment[1]." (".$mine_c.")</th>";
echo "<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 colspan=2>".$batiment[2]." (".$mine_h.")</th>";
echo "<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 colspan=2>".$batiment[3]." (".$centrale_s.")</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th><font color=lime>".$energie_s."</font></th></tr>
</tr>"; }
if ($centrale_f > 0) {
echo "<tr>
<th colspan=2>".$batiment[4]." (".$centrale_f.")</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>