<?
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[exor_energie] + $row2[or_energie] + $row2[exexor_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 exor_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);
// exor
if ($row[exor_lvl] =="0") {
$exor_lvl = "0";
}
else {
$exor_lvl = $row[exor_lvl];
}
$exor_lvl22 = $exor_lvl+1;
$exor_lvl23 = $exor_lvl+2;
$exor_lvl24 = $exor_lvl+3;
$exor_lvl25 = $exor_lvl+4;
//conso
if ($row[exor_lvl] == "0") {
$besoin_exor_energie2 = "0" ; }
else {
$besoin_exor_energie2 = round((150 * (bcpow(1.16, $row[exor_lvl],3))),0);
}
$besoin_exor_energie = 1 * $besoin_exor_energie2 ;
$besoin_exor_energie22 = round((150 * (bcpow(1.16, ($row[exor_lvl] + 1),3))),0);
$besoin_exor_energie23 = round((150 * (bcpow(1.16, ($row[exor_lvl] + 2) ,3))),0);
$besoin_exor_energie24 = round((150 * (bcpow(1.16, ($row[exor_lvl] + 3),3))),0);
$besoin_exor_energie25 = round((150 * (bcpow(1.16, ($row[exor_lvl] + 4),3))),0);
//prod
	if ($row[exor_lvl] == "0") {
	$new9exor_ressource = 0;
	}
	else {
	$new9exor_ressource = floor((((500 * ( bcpow( 1.25, $row[exor_lvl],3))))));
	}
	$new9exor_ressource22 = floor((((500 * ( bcpow( 1.25, ($row[exor_lvl]+1),3))))));
	$new9exor_ressource23 = floor((((500 * ( bcpow( 1.25, ($row[exor_lvl]+2),3))))));
	$new9exor_ressource24 = floor((((500 * ( bcpow( 1.25, ($row[exor_lvl]+3),3))))));
	$new9exor_ressource25 = floor((((500 * ( bcpow( 1.25, ($row[exor_lvl]+4),3))))));
echo"<table width=\"618\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
  <tr>
    <td colspan=\"4\" style =\"background-color:#222222;\"><div align=\"center\"><b>Centre d'extraction d'or </b>(Niveau $exor_lvl)</div></td>
  </tr>
  <tr>
    <td width=\"72\" height=\"120\"><img src=\"imgs/exor.gif\" width=\"120\" height=\"120\"></td>
    <td width=\"1119\" colspan=\"2\">Grâce à la recherche, les chercheurs ont trouvé un moyen de récupérer l'or plus profond. Par le même procédé que les \"piles rechargeables\" on peut maintenant récupérer de l'or en fusion. Les chercheurs ont découvert que l'or proche du centre des planètes était sous forme liquide. A l'aide de cellules de convection et de tiges en cristal solide il est possible de rejoindre ces zones d'or en fusion et de le faire remonté à la surface sans craindre des catastrophes naturelles. Ce nouveau système permet d'extraire plus rapidement l'or, mais il demande un investissement lourd en cristal et en énergie.
</td>
  </tr>
</table>
<br>
<table width=\"618\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
  <tr style =\"background-color:#222222;\">
    <td width=\"93\" height=\"21\" align=\"center\">Niveau : </td>
    <td>Consommation d'energie par heure : </td>
    <td>Production par heure : </td>
  </tr>
  <tr style =\"background-color:#000000;\">
    <td width=\"93\" height=\"21\" align=\"center\">$exor_lvl</td>
    <td width=289>$besoin_exor_energie</td>
    <td width=\"210\">$new9exor_ressource</td>
  </tr>
  <tr style =\"background-color:#111111;\">
    <td width=\"93\" height=\"21\" align=\"center\">$exor_lvl22</td>
    <td>$besoin_exor_energie22</td>
    <td width=\"210\">$new9exor_ressource22</td>
  </tr>
  <tr style =\"background-color:#000000;\">
    <td width=\"93\" height=\"21\" align=\"center\">$exor_lvl23</td>
    <td>$besoin_exor_energie23</td>
    <td width=210>$new9exor_ressource23</td>
  </tr>
  <tr style =\"background-color:#111111;\">
    <td width=\"93\" height=\"21\" align=\"center\">$exor_lvl24</td>
    <td>$besoin_exor_energie24</td>
    <td width=\"210\">$new9exor_ressource24</td>
  </tr>
  <tr style =\"background-color:#000000;\">
    <td width=\"93\" height=\"21\" align=\"center\">$exor_lvl25</td>
    <td>$besoin_exor_energie25</td>
    <td width=\"210\">$new9exor_ressource25</td>
  </tr>
</table>";
// robo
if ($row[robo_lvl] =="0") {
$robo_lvl = "0";
}
else {
$robo_lvl = $row[robo_lvl];
}
if ($row[exor_lvl] =="0") {
$besoin_exor_fer = number_format((32000/3), 0, ',', ' ');
$besoin_exor_or = number_format((20000/3), 0, ',', ' ');
$besoin_exor_ada = number_format((1500/3), 0, ',', ' ');
}
else {
$besoin_exor_fer = number_format(round(((32000/3) * ( bcpow( 1.3, $exor_lvl,3))),0), 0, ',', ' ');
$besoin_exor_or = number_format(round(((20000/3) * ( bcpow( 1.3, $exor_lvl,3))),0), 0, ',', ' ');
$besoin_exor_ada = number_format(round(((1500/3) * ( bcpow( 1.3, $exor_lvl,3))),0), 0, ',', ' ');
}
include ('siege.php');
//exor
$temps1exor = (43200/3 * $siege_temps_evolution * (bcpow(1.35, $exor_lvl,3)));
if ($robo_lvl == "0") {
$stimeexor = (round($temps1exor));
}
else {
$stimeexor = (round($temps1exor*(bcpow(0.9, $robo_lvl,3))));
}
$etimeexor = $stimeexor;
$eminexor = $etimeexor / 60;

if ( floor($eminexor) != $eminexor )
  $esecexor = floor( ($eminexor - floor( $eminexor )) * 60);

  if ( $eminexor > 60 ) {

    $ehourexor = floor( $eminexor / 60 );
    $eminexor = $eminexor - ( 60 * $ehourexor );

    if ( $ehourexor > 24 ) {
      $edayexor = floor( $ehourexor / 24);
      $ehourexor = $ehourexor - ( 24 * $edayexor );
    }

  }

$etimeexor ="";

if (!empty($edayexor) )
  $etimeexor.="$edayexor j ";

if (!empty($ehourexor) )
  $etimeexor.="$ehourexor h ";

if ($eminexor != 0)
  $etimeexor.= floor($eminexor)." min. ";

if (!empty($esecexor) )
  $etimeexor.="$esecexor sec. ";
if($exor_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_exor_fer</b> ; Or : <b>$besoin_exor_or</b> ; Cristal : <b>$besoin_exor_ada</b> ; Temps : <b>$etimeexor</b> </div></td>
  </tr>
  <tr>
    <td style =\"background-color:#111111;\"><div align=\"center\"><a href=\"Destructionexor.php\" target=\"_parent\">Détruire le niveau $exor_lvl</a></div></td>
  </tr>
</table>";	}
?>

