<?	
include ('logue.php'); 
include ('entete2.php');
include ('ressource.php');
include ('entete.php');

$sql2 = "SELECT hangarfer_lvl,hangarfer_evolution,hangaror_lvl,hangaror_evolution,hangarada_lvl,hangarada_evolution,hangaror_lvl,hangarura_lvl,hangarura_evolution FROM matgraph_users WHERE id='$planete' ";
$res2 = db_mysql_Query($sql2)or die('erreur sql<br>'.$sql2.'<br>'.mysql_error());
$row2 = mysql_fetch_array($res2); 

$pts = floor(($row[pts] / 1000)) ;
$Total_energie_consom = $row2[fer_energie] + $row2[or_energie] + $row2[exfer_energie] + $row2[exor_energie] + $row2[ada_energie] + $row2[ura_energie] ;
$Total_energie_reste =  round(($New_central_energie + $New_fission_energie + $Total_energie_consom),0);
$Total_energie_prod = round(($New_central_energie + $New_fission_energie),0);

echo"<style>
input {
border:1px solid #7E7E7E;
background-color:#000000;
font-family:'trebuchet ms',sans-serif;
color:white;
}
textarea {
border:1px solid #7E7E7E;
background-color:#000000;
font-family:'trebuchet ms',sans-serif;
color:white;
}
select, option {
background-color:#000000;
color:white;
}
</style>
<STYLE TYPE=text/css>
.Style1 {color: #0000FF}
.Style2 {color: #FF0000}
</STYLE>";
echo"<div align=\"center\"><form name=\"colo\" method=\"post\" action=\"colonie.php\" target=\"_parent\">
<table align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
   <tr>
     <td width=\"100\" rowspan=\"2\" valign=\"middle\">
       <div align=\"center\">
         <input name=\"page\" value=\"" . $PHP_SELF . "\" type=\"hidden\" id=\"page\">
         <select name=\"idcolo\" onchange=submit()>";
include ('colo2.php'); 
$sql = "SELECT hangarura_lvl,robo_lvl FROM matgraph_users WHERE id='$planete'";
$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
$row = mysql_fetch_array($res); 
// hangaror
if ($row[hangarura_lvl] =="0") {
$hangarfer_lvl = "0";
}
else {
$hangarfer_lvl = $row[hangarura_lvl];
}
$hangarfer_lvl22 = $hangarfer_lvl +1 ;
$hangarfer_lvl23 = $hangarfer_lvl +2 ;
$hangarfer_lvl24 = $hangarfer_lvl +3 ;
$hangarfer_lvl25 = $hangarfer_lvl +4 ;
$hengar_ressource = round ((100000 *(bcpow(1.5, $row2[hangarura_lvl],6))),0);
$hengar_ressource22 = round ((100000 *(bcpow(1.5, ($row2[hangarura_lvl]+1),6))),0);
$hengar_ressource23 = round ((100000 *(bcpow(1.5, ($row2[hangarura_lvl]+2),6))),0);
$hengar_ressource24 = round ((100000 *(bcpow(1.5, ($row2[hangarura_lvl]+3),6))),0);
$hengar_ressource25 = round ((100000 *(bcpow(1.5, ($row2[hangarura_lvl]+4),6))),0);

echo"<table width=\"618\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
  <tr>
    <td colspan=\"4\" style =\"background-color:#222222;\"><div align=\"center\"><b>Cuve de Stockage du Naquadah </b>(Niveau $hangarfer_lvl)</div></td>
  </tr>
  <tr>
    <td width=\"72\" height=\"120\"><img src=\"imgs/hangaruragif.gif\" width=\"120\" height=\"120\"></td>
    <td width=\"1119\" colspan=\"2\">La cuve de stockage de l’uranium est un immense silo capable de conserver le Naquadah sans danger avant son utilisation. Le Naquadah étant trés dangereux, les cuves qui le contiennent sont trés résistantes pour éviter les désastres que causerait la destruction de ses cuves. Généralement, elles sont placées loin des installations importantes pour diminuer les risques. Chaque niveau augmente de 50% la capacité maximale de stockage sur la planète.
</td>
  </tr>
</table>
<br>
<table width=\"323\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
  <tr style =\"background-color:#222222;\">
    <td width=\"93\" height=\"21\" align=\"center\">Niveau : </td>
    <td>Capacit&eacute; de stockage  : </td>
  </tr>
  <tr style =\"background-color:#000000;\">
    <td width=\"93\" height=\"21\" align=\"center\">$hangarfer_lvl</td>
    <td width=\"210\">$hengar_ressource</td>
  </tr>
  <tr style =\"background-color:#111111;\">
    <td width=\"93\" height=\"21\" align=\"center\">$hangarfer_lvl22</td>
    <td width=\"210\">$hengar_ressource22</td>
  </tr>
  <tr style =\"background-color:#000000;\">
    <td width=\"93\" height=\"21\" align=\"center\">$hangarfer_lvl23</td>
    <td width=210>$hengar_ressource23</td>
  </tr>
  <tr style =\"background-color:#111111;\">
    <td width=\"93\" height=\"21\" align=\"center\">$hangarfer_lvl24</td>
    <td width=\"210\">$hengar_ressource24</td>
  </tr>
  <tr style =\"background-color:#000000;\">
    <td width=\"93\" height=\"21\" align=\"center\">$hangarfer_lvl25</td>
    <td width=\"210\">$hengar_ressource25</td>
  </tr>
</table>";
// robo
if ($row[robo_lvl] =="0") {
$robo_lvl = "0";
}
else {
$robo_lvl = $row[robo_lvl];
}
if ($row[hangarura_lvl] =="0") {
$besoin_hangarura_fer = number_format((2000/3), 0, ',', ' ');
$besoin_hangarura_or = number_format((2000/3), 0, ',', ' ');
$besoin_hangarura_ada = number_format((1000/3), 0, ',', ' ');
}
else {
$besoin_hangarura_fer = number_format(round(((2000/3) * ( bcpow( 2, $hangarura_lvl,3))),0), 0, ',', ' ');
$besoin_hangarura_or = number_format(round(((2000/3) * ( bcpow( 2, $hangarura_lvl))),0), 0, ',', ' ');
$besoin_hangarura_ada = number_format(round(((1000/3) * ( bcpow( 2, $hangarura_lvl))),0), 0, ',', ' ');
}
include ('siege.php');
//hangarura 
$temps1hangarura = (1440/3 * $siege_temps_evolution * (bcpow(1.35, $hangarura_lvl,3)));
if ($robo_lvl == "0") {
$stimehangarura = (round($temps1hangarura));
}
else {
$stimehangarura = (round($temps1hangarura*(bcpow(0.9, $robo_lvl,3))));
} 
$etimehangarura = $stimehangarura;
$eminhangarura = $etimehangarura / 60;

if ( floor($eminhangarura) != $eminhangarura )
  $esechangarura = floor( ($eminhangarura - floor( $eminhangarura )) * 60);

  if ( $eminhangarura > 60 ) {

    $ehourhangarura = floor( $eminhangarura / 60 );
    $eminhangarura = $eminhangarura - ( 60 * $ehourhangarura );

    if ( $ehourhangarura > 24 ) {
      $edayhangarura = floor( $ehourhangarura / 24);
      $ehourhangarura = $ehourhangarura - ( 24 * $edayhangarura );
    }

  }

$etimehangarura ="";

if (!empty($edayhangarura) )
  $etimehangarura.="$edayhangarura j ";

if (!empty($ehourhangarura) )
  $etimehangarura.="$ehourhangarura h ";

if ($eminhangarura != 0)
  $etimehangarura.= floor($eminhangarura)." min. ";

if (!empty($esechangarura) ) 
  $etimehangarura.="$esechangarura sec. ";
if($hangarura_lvl > 0) {
echo"<br><table width=\"618\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
  <tr>
    <td style =\"background-color:#222222;\"><div align=\"center\">Destruction de batiment : </div></td>
  </tr>
  <tr>
    <td><div align=\"center\">Gain : Fer : <b>$besoin_hangarura_fer</b> ; Or : <b>$besoin_hangarura_or</b> ; Cristal : <b>$besoin_hangarura_ada</b> ; Temps : <b>$etimehangarura</b> </div></td>
  </tr>
  <tr>
    <td style =\"background-color:#111111;\"><div align=\"center\"><a href=\"Destructionhangarura.php\" target=\"_parent\">Détruire le niveau $hangarura_lvl</a></div></td>
  </tr>
</table>";	}	
?>

