game/onyx/hb_game/jeu/ressources.php

36 lines
2.4 KiB
PHP
Raw Normal View History

2008-11-17 11:00:00 +00:00
<?php
if(!defined('INDEX')) { header('Location: ../'); exit; }
$page = 'ressources';
$titre = 'Ressources';
2008-11-18 11:00:00 +00:00
if (isset($_POST['coeff_metal']) && isset($_POST['coeff_cs'])) {
if (!isset($_POST['coeff_cristal'])) $_POST['coeff_cristal'] = 0;
if (!isset($_POST['coeff_hydrogene'])) $_POST['coeff_hydrogene'] = 0;
if (!isset($_POST['coeff_ce'])) $_POST['coeff_ce'] = 0;
2008-11-22 11:00:00 +00:00
$coeff_metal = floor($_POST['coeff_metal']);
$coeff_cristal = floor($_POST['coeff_cristal']);
$coeff_hydrogene = floor($_POST['coeff_hydrogene']);
$coeff_cs = floor($_POST['coeff_cs']);
$coeff_ce = floor($_POST['coeff_ce']);
2008-11-04 11:00:00 +00:00
$bdd->connexion();
$bdd->escape($coeff_metal);
$bdd->escape($coeff_cristal);
$bdd->escape($coeff_hydrogene);
$bdd->escape($coeff_cs);
$bdd->escape($coeff_ce);
2008-11-16 11:00:00 +00:00
$bdd->query("UPDATE planete SET coeff_mine_m = '".($coeff_metal/100)."', coeff_mine_c = '".($coeff_cristal/100)."', coeff_mine_h = '".($coeff_hydrogene/100)."', coeff_centrale_s = '".($coeff_cs/100)."', coeff_centrale_f = '".($coeff_ce/100)."' WHERE id = '$idPlan'");
2008-11-04 11:00:00 +00:00
$bdd->deconnexion();
2008-11-18 11:00:00 +00:00
header('Location: ?p=ressources');
exit;
}
2008-11-17 11:00:00 +00:00
$template->assign('nombat', $batiment);
2008-11-30 11:00:00 +00:00
$template->assign('ressources_prod', array(separerNombres(ceil(pow(1.1,$mine_m)*35*$mine_m)*$coeff_mine_m*1.5), separerNombres(floor(ceil(pow(1.1,$mine_c)*23*$mine_c)*$coeff_mine_c)*1.5), separerNombres(floor((ceil(pow(1.1,$mine_h)*14*($mine_h+0.7))) * $coeff_mine_h)*1.5), separerNombres(floor(ceil(exp(0.28*$centrale_s)*22)*$coeff_centrale_s)), separerNombres(floor(ceil(exp(0.297*$centrale_f)*25)*$coeff_centrale_f))));
2008-11-17 11:00:00 +00:00
$template->assign('ressources_conso', array(separerNombres(ceil(exp(0.28*$mine_m)*10)*$coeff_mine_m), separerNombres(ceil(exp(0.28*$mine_c)*10)*$coeff_mine_c), separerNombres(ceil(exp(0.2849*$mine_h)*13)*$coeff_mine_h), floor(ceil(pow(1.34,($centrale_f-1))*9)*$coeff_centrale_f)));
2008-11-30 11:00:00 +00:00
$template->assign('ressources_toto', array(separerNombres(floor((ceil(pow(1.1,$mine_h)*14*($mine_h+0.7))) * $coeff_mine_h)*1.5 - floor(ceil(pow(1.34,($centrale_f-1))*9)*$coeff_centrale_f))), '('.$diffnrj.')');
2008-11-18 11:00:00 +00:00
$template->assign('ressources_coef', array(floor($coeff_mine_m*10)*10, floor($coeff_mine_c*10)*10, floor($coeff_mine_h*10)*10, floor($coeff_centrale_s*10)*10, floor($coeff_centrale_f*10)*10));
2008-11-22 11:00:00 +00:00
$template->assign('ressources_silo', array($queryPlanete['silo'], $cap));
2008-11-18 11:00:00 +00:00
$template->assign('ressources_tab', array(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100));
2008-11-17 11:00:00 +00:00
?>