<?	
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[exura_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 ura_lvl,robo_lvl,fission_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); 
// ura
if ($row[ura_lvl] =="0") {
$ura_lvl = "0";
}
else {
$ura_lvl = $row[ura_lvl];
}
$ura_lvl22 = $ura_lvl+1;
$ura_lvl23 = $ura_lvl+2;
$ura_lvl24 = $ura_lvl+3;
$ura_lvl25 = $ura_lvl+4;
//conso 
if ($row[ura_lvl] == "0") {
$besoin_ura_energie2 = "0" ; }
else {
$besoin_ura_energie2 = round((68 * (bcpow(1.1, $row[ura_lvl],3))),0);
}
$besoin_ura_energie = 1 * $besoin_ura_energie2 ;
$besoin_ura_energie22 = round((68 * (bcpow(1.1, ($row[ura_lvl] + 1),3))),0);
$besoin_ura_energie23 = round((68 * (bcpow(1.1, ($row[ura_lvl] + 2) ,3))),0);
$besoin_ura_energie24 = round((68 * (bcpow(1.1, ($row[ura_lvl] + 3),3))),0);
$besoin_ura_energie25 = round((68 * (bcpow(1.1, ($row[ura_lvl] + 4),3))),0);
//prod
	if ($row[ura_lvl] == "0") {
	$new9ura_ressource = 0;
	}
	else {
	$new9ura_ressource = floor((((100 * ( bcpow( 1.2, $row[ura_lvl],3))))));
	}
	$new9ura_ressource22 = floor((((100 * ( bcpow( 1.2, ($row[ura_lvl]+1),3))))));
	$new9ura_ressource23 = floor((((100 * ( bcpow( 1.2, ($row[ura_lvl]+2),3))))));
	$new9ura_ressource24 = floor((((100 * ( bcpow( 1.2, ($row[ura_lvl]+3),3))))));
	$new9ura_ressource25 = floor((((100 * ( bcpow( 1.2, ($row[ura_lvl]+4),3))))));
echo"<table width=\"618\"  border=\"1\" cellspacing=\"0\" cellpadding=\"0\">
  <tr>
    <td colspan=\"4\"><div align=\"center\"><b>Mine de Naquadah </b>(Niveau $ura_lvl)</div></td>
  </tr>
  <tr>
    <td width=\"72\" height=\"120\"><img src=\"imgs/naqua.gif\" width=\"120\" height=\"120\"></td>
    <td width=\"1119\" colspan=\"2\">Extrait du Naquadah des rares mines de la planète. Le Naquadah est une ressource très rare. Cette roche a la capacité de stocker de l'énergie et de la restituer rapidement. Ces capacités rares et très utiles en font un minerai très convoité. Le Naquadah peut être utilisé de plusieurs façons: il peut entrer dans la construction de bâtiments et de vaisseaux en les rendant plus resistants. Il peut être aussi utilisé pour produire de l'énergie ou, le plus souvent, comme arme. Le Naquadah est aussi l'élément de base de la porte des étoiles.</td>
  </tr>
</table>
<br>
<table width=\"618\"  border=\"2\" cellspacing=\"4\" cellpadding=\"0\">
  <tr>
    <td width=\"93\" height=\"21\" align=\"center\">Niveau : </td>
    <td>Consommation d'energie par heure : </td>
    <td>Production par heure : </td>
  </tr>
  <tr>
    <td width=\"93\" height=\"21\" align=\"center\">$ura_lvl</td>
    <td width=289>$besoin_ura_energie</td>
    <td width=\"210\">$new9ura_ressource</td>
  </tr>
  <tr>
    <td width=\"93\" height=\"21\" align=\"center\">$ura_lvl22</td>
    <td>$besoin_ura_energie22</td>
    <td width=\"210\">$new9ura_ressource22</td>
  </tr>
  <tr>
    <td width=\"93\" height=\"21\" align=\"center\">$ura_lvl23</td>
    <td>$besoin_ura_energie23</td>
    <td width=210>$new9ura_ressource23</td>
  </tr>
  <tr>
    <td width=\"93\" height=\"21\" align=\"center\">$ura_lvl24</td>
    <td>$besoin_ura_energie24</td>
    <td width=\"210\">$new9ura_ressource24</td>
  </tr>
  <tr>
    <td width=\"93\" height=\"21\" align=\"center\">$ura_lvl25</td>
    <td>$besoin_ura_energie25</td>
    <td width=\"210\">$new9ura_ressource25</td>
  </tr>
</table>";	
// robo
if ($row[robo_lvl] =="0") {
$robo_lvl = "0";
}
else {
$robo_lvl = $row[robo_lvl];
}
// fission
if ($row[fission_lvl] =="0") {
$fission_lvl = "0";
}
else {
$fission_lvl = $row[fission_lvl];
}
if ($row[ura_lvl] =="0") {
$besoin_ura_fer = number_format((500/3), 0, ',', ' ');
$besoin_ura_or = number_format((300/3), 0, ',', ' ');
$besoin_ura_ada = number_format((100/3), 0, ',', ' ');
}
else {
$besoin_ura_fer = number_format(round(((500/3) * ( bcpow( 1.4, $ura_lvl,3))),0), 0, ',', ' ');
$besoin_ura_or = number_format(round(((300/3) * ( bcpow( 1.4, $ura_lvl,3))),0), 0, ',', ' ');
$besoin_ura_ada = number_format(round(((100/3) * ( bcpow( 1.4, $ura_lvl,3))),0), 0, ',', ' ');
}
include ('siege.php');
//ura 
$temps1ura = (600/3 * $siege_temps_evolution * (bcpow(1.4, $ura_lvl,3)));
if ($robo_lvl == "0") {
$stimeura = (round($temps1ura));
}
else {
$stimeura = (round($temps1ura*(bcpow(0.9, $robo_lvl,3))));
} 
$etimeura = $stimeura;
$eminura = $etimeura / 60;

if ( floor($eminura) != $eminura )
  $esecura = floor( ($eminura - floor( $eminura )) * 60);

  if ( $eminura > 60 ) {

    $ehourura = floor( $eminura / 60 );
    $eminura = $eminura - ( 60 * $ehourura );

    if ( $ehourura > 24 ) {
      $edayura = floor( $ehourura / 24);
      $ehourura = $ehourura - ( 24 * $edayura );
    }

  }

$etimeura ="";

if (!empty($edayura) )
  $etimeura.="$edayura j ";

if (!empty($ehourura) )
  $etimeura.="$ehourura h ";

if ($eminura != 0)
  $etimeura.= floor($eminura)." min. ";

if (!empty($esecura) ) 
  $etimeura.="$esecura sec. ";
  
if($ura_lvl == 5) {
if($fission_lvl > 0) {
$valid = "no"; }
else {
$valid = "yes"; }}
else {
$valid = "yes"; }
if($ura_lvl > 0 AND $valid == "yes" ) {
echo"<br><table width=\"618\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">
  <tr>
    <td><div align=\"center\">Destruction de batiment : </div></td>
  </tr>
  <tr>
    <td><div align=\"center\">Gain : Fer : <b>$besoin_ura_fer</b> ; Or : <b>$besoin_ura_or</b> ; Cristal : <b>$besoin_ura_ada</b> ; Temps : <b>$etimeura</b> </div></td>
  </tr>
  <tr>
    <td><div align=\"center\"><a href=\"Destructionura.php\" target=\"_parent\">Détruire le niveau $ura_lvl</a></div></td>
  </tr>
</table>";	}	
?>

