<?php
include ('logue.php');
include ('entete2.php');
include ('evolutionbats.php');
include ('ressource.php');
include ('siege.php');
$sql = "SELECT pts,central_lvl,central_energie,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);
if ($row[central_lvl] =="0") {
$Depense_fer_ressource = "52";
$Depense_or_ressource = "30";
}
else {
$Depense_fer_ressource = round((52 * ( bcpow( 1.6, ($row[central_lvl] + 1),3))),0);
$Depense_or_ressource = round((30 * ( bcpow( 1.6, ($row[central_lvl] + 1),3))),0);
}
$New_fer_ressource = ($newwfer_ressource - $Depense_fer_ressource) ;
$New_or_ressource = ($newwor_ressource - $Depense_or_ressource) ;
$temps1central = (108 * (bcpow(1.35, ($row[central_lvl] + 1),3)));
if ($row[robo_lvl] == "0") {
$central_evolution = strftime("%Y-%m-%d %H:%M:%S", time()+ (round($temps1central)));
}
else {
$central_evolution = strftime("%Y-%m-%d %H:%M:%S", time()+ (round($temps1central* $siege_temps_evolution * (bcpow(0.9, $row[robo_lvl],3)))));
}
if ($newwfer_ressource >= $Depense_fer_ressource && $newwor_ressource >= $Depense_or_ressource && $evolution < 0) {
$sql = "UPDATE matgraph_users SET central_evolution='$central_evolution', fer_ressource=$New_fer_ressource, or_ressource=$New_or_ressource WHERE id='$planete'";
$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
//echo"Sql : $sql<br>";exit;
}
echo '<script language="javascript" type="text/javascript">
<!--
window.location.replace("batiments.php");
-->
</script>';
?>