diff --git a/Halo-Battle.PHPEditProject b/Halo-Battle.PHPEditProject new file mode 100644 index 0000000..3f0fa49 --- /dev/null +++ b/Halo-Battle.PHPEditProject @@ -0,0 +1,3 @@ + + + diff --git a/b_index.php b/b_index.php index acdff14..1243fea 100644 --- a/b_index.php +++ b/b_index.php @@ -12,13 +12,14 @@ elseif(!isset($_GET['v'])){ exit; } $_SESSION['cdsconnect'] = rand(1234567890,9876543210)*rand(1234567890,98765432100)/rand(123567890,9876543210); - $url=@eregi_replace($_SERVER['DOCUMENT_ROOT'],'http://'.$_SERVER['HTTP_HOST'],$_SERVER['SCRIPT_FILENAME']); - echo ''; + if ($_SESSION['race'] == 'humain' || $_SESSION['race'] == 'covenant') echo ''; + else echo ''; echo ''; } -if(($_GET['v'] == sha1(time() + $_SESSION['cdsconnect']) || $_GET['v'] == sha1(time() - 1 + $_SESSION['cdsconnect']) || $_GET['v'] == sha1(time() - 2 + $_SESSION['cdsconnect']) || $_GET['v'] == sha1(time() - 3 + $_SESSION['cdsconnect']) || $_GET['v'] == sha1(time() - 4 + $_SESSION['cdsconnect']) || $_GET['v'] == sha1(time() - 5 + $_SESSION['cdsconnect']) || $_GET['v'] == sha1(time() - 6 + $_SESSION['cdsconnect']) || $_GET['v'] == sha1(time() - 7 + $_SESSION['cdsconnect']) || $_GET['v'] == sha1(time() - 8 + $_SESSION['cdsconnect']) || $_GET['v'] == sha1(time() - 9 + $_SESSION['cdsconnect']) || $_GET['v'] == sha1(time() - 10 + $_SESSION['cdsconnect'])) && isset($_SESSION['charg']) && $_SESSION['charg'] == 1) { +if(($_SESSION['race'] == 'humain' || $_SESSION['race'] == 'covenant') && ($_GET['v'] == sha1(time() + $_SESSION['cdsconnect']) || $_GET['v'] == sha1(time() - 1 + $_SESSION['cdsconnect']) || $_GET['v'] == sha1(time() - 2 + $_SESSION['cdsconnect']) || $_GET['v'] == sha1(time() - 3 + $_SESSION['cdsconnect']) || $_GET['v'] == sha1(time() - 4 + $_SESSION['cdsconnect']) || $_GET['v'] == sha1(time() - 5 + $_SESSION['cdsconnect']) || $_GET['v'] == sha1(time() - 6 + $_SESSION['cdsconnect']) || $_GET['v'] == sha1(time() - 7 + $_SESSION['cdsconnect']) || $_GET['v'] == sha1(time() - 8 + $_SESSION['cdsconnect']) || $_GET['v'] == sha1(time() - 9 + $_SESSION['cdsconnect']) || $_GET['v'] == sha1(time() - 10 + $_SESSION['cdsconnect'])) && isset($_SESSION['charg']) && $_SESSION['charg'] == 1) { $_SESSION['cdsconnect'] = null; +$_SESSION['authConnexion'] = true; echo ' diff --git a/connectBDD.php b/connectBDD.php index 40f4984..bece8d0 100644 --- a/connectBDD.php +++ b/connectBDD.php @@ -4,8 +4,10 @@ $db = mysql_connect('localhost','hb','bddhb') or die ("erreur de connexion"); mysql_select_db('halo_battle',$db) or die ("erreur de connexion base"); //Serveur Halo.fr -//$db = mysql_connect(':/var/lib/mysql/mysql3.sock','halobattle','m8zFmdtm9PftrcHb') or die ("erreur de connexion"); -//mysql_select_db('halobattle',$db) or die ("erreur de connexion base"); +//@$db = mysql_connect(':/var/lib/mysql/mysql3.sock','halobattle','m8zFmdtm9PftrcHb') or require('indexB.php'); +//@mysql_select_db('halobattle',$db) or require('indexB.php'); +//@$db = mysql_connect('confrerienoire.no-ip.org','halobattleBG','959DJ4vJJFpQbumK') or require('indexB.php'); +//@mysql_select_db('halo_battle',$db) or require('indexB.php'); if (!isset($dejadefi)) { function realip() { diff --git a/fonctions.php b/fonctions.php index 079f50c..2c55f2c 100644 --- a/fonctions.php +++ b/fonctions.php @@ -45,6 +45,7 @@ function txtmission($mission){ elseif ($mission == 3) return 'Coloniser'; elseif ($mission == 4) return 'Recycler'; elseif ($mission == 5) return 'Espionner'; + elseif ($mission == 6) return 'Retour forcé'; else return 'Erreur'; } @@ -61,25 +62,7 @@ function trouvInfo($id_user, $info){ } function separerNombres($nombre) { - $j=0; - $lgr=strlen($nombre); - $chaine = ''; - for($i = $lgr-1; $i >= 0; $i--) { - $chaine .= substr($nombre,$i,1); - $j+=1; - if($j == 3 and $i >0) { - $chaine .= "."; - $j = 0; - } - } - $nombre=""; - $lgr=strlen($chaine); - $j=$lgr; - for($i = $lgr+1; $i > 0; $i--) { - $nombre .= substr($chaine,$j,1); - $j -=1; - } - return $nombre; + return number_format($nombre, 0, ',', ' '); } function bbcode($text) { @@ -198,3 +181,46 @@ $query = mysql_query("SELECT user.id ,pseudo, ceil( ( return $resultat['points_pts']; } +function pillage($metal, $cristal, $hydrogene, $vfm){ + $Qm = $metal / $vfm; + $Qc = $cristal / $vfm; + $Qh = $hydrogene / $vfm; + + $somme = $Qm + $Qc + $Qh; + + if ($somme < 2) { + $Fm = $metal / 2; + $Fc = $cristal / 2; + $Fh = $hydrogene / 2; + } + else { + $Fm = $Qm / $somme * $vfm; + $Fc = $Qc / $somme * $vfm; + $Fh = $Qh / $somme * $vfm; + } + + return array(floor($Fm), floor($Fc), floor($Fh)); +} + +function affTemp($secondes){ + $heures = intval($secondes/3600); + $minutes = intval($secondes/60-($heures*60)); + if ($minutes < 10) $minutes = '0'.$minutes; + $seconde = $secondes-($heures*3600)-($minutes*60); + if ($seconde < 10) $seconde = '0'.$seconde; + + return $heures.':'.$minutes.':'.$seconde; +} + +function dateFR($date){ + $date = str_replace('Sun','Dim',$date); + $date = str_replace('Mon','Lun',$date); + $date = str_replace('Tue','Mar',$date); + $date = str_replace('Wed','Mer',$date); + $date = str_replace('Thu','Jeu',$date); + $date = str_replace('Fri','Ven',$date); + $date = str_replace('Sat','Sam',$date); + + return $date; +} +?> \ No newline at end of file diff --git a/index.php b/index.php index 2ce0ea5..c518588 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,14 @@
// Affichage de l'enregistrement des paramètres d'identifications dans les cookies. Désactivé si l'on se trouve dans un réseau d'entreprise (realIP différente de l'IP if ($ip == realip()) { - if (!isset($_COOKIE['HB_log_mdp'])) $login .= ''; + if (!isset($_COOKIE['HB_log_mdp']) || empty($_COOKIE['HB_log_mdp'])) $login .= ''; else $login .= ''; } diff --git a/indexB.php b/indexB.php new file mode 100644 index 0000000..6742c1a --- /dev/null +++ b/indexB.php @@ -0,0 +1,21 @@ +set_filenames(array('index' => 'templates/index.tpl')); + +$texte = 'Serveur indisponible

Le serveur connait actuellement des problèmes avec la base de données. Nous faissons notre possible pour qu\'il soit accessible dans les plus brefs délais.

Pou plus d\'informations, lisez les annonces officielles sur le forum du jeu.

Merci de votre compréhension
'; + +$login = '

+ + + +'; + +$login .= '
:: Pseudo :: 
:: Mot de Passe :: 

+
+
'; + + $template->assign_vars(array('TITRE' => 'Login','TEXTE' => $texte,'LOGIN' => $login)); + $template->pparse('index'); +exit; +?> \ No newline at end of file diff --git a/pages/ajax_flotte.php b/pages/ajax_flotte.php new file mode 100644 index 0000000..75f4a11 --- /dev/null +++ b/pages/ajax_flotte.php @@ -0,0 +1,81 @@ + array( + 'temps' => '-', + 'deblok' => 'Complètez les champs ci-dessus', + 'conso' => '-' + ) + ); +} +elseif ($_POST['galaxie'] > 1 || $_POST['ss'] > 100 || $_POST['pos'] > 12 || $_POST['galaxie'] < 0 || $_POST['ss'] < 1 || $_POST['pos'] < 1 || ($_POST['galaxie'] < 1 && $auth_level < 6)) { + $datas = array( + 'root' => array( + 'temps' => 'Lieu inaccessible', + 'deblok' => 'Corrigez la destination !', + 'conso' => '-' + ) + ); +} +else { + $_POST['vitesse'] /= 100; + $temps = vais_tempsDeplacement($start_galaxie,$start_ss,$start_position,$_POST['galaxie'],$_POST['ss'],$_POST['pos'],$_SESSION['FL_vitesse'],$_POST['vitesse'],$_SESSION['FL_preparation'],$_SESSION['FL_chauffe']); + $conso = vais_conso($temps, $_SESSION['FL_nbvais'])*($_POST['vitesse']*10); + + //On recherche si la flotte va faire un aller-retour ou un aller simple + if (isset($_POST['mission']) && is_numeric($_POST['mission']) && ($_POST['mission'] == '3')) $nbtrajet = 1; + else $nbtrajet = 2; + + if ($temps == 0) + $datas = array( + 'root' => array( + 'temps' => 'Vous êtes sur cette planète', + 'deblok' => 'Corrigez la destination !', + 'conso' => '-' + ) + ); + elseif (preg_replace('@[^a-zA-Z0-9_]@i', '', $_POST['nom']) != $_POST['nom'] || empty($_POST['nom'])) + $datas = array( + 'root' => array( + 'temps' => affTemp(floor($temps)), + 'deblok' => 'Nom de la flotte incorrect !', + 'conso' => separerNombres(floor($conso*($_POST['vitesse']/100)*$nbtrajet)) + ) + ); + /*elseif (empty($_POST['hyd']) || $_POST['hyd'] < $conso * 2) + $datas = array( + 'root' => array( + 'temps' => affTemp(floor($temps)), + 'deblok' => 'Vous n\'avez pas embarqué assez d\'hydrogène pour faire l\'aller-retour !', + 'conso' => separerNombres(floor($conso*($_POST['vitesse']/100)*$nbtrajet)) + ) + );*/ + else { + $cds = sha1('flotte'.$conso.'ß10'.time().'|HB;'.rand(10,99).$temps); + $_SESSION['flotte_cdsL'] = $cds; + $datas = array( + 'root' => array( + 'temps' => affTemp(floor($temps)), + 'deblok' => '', + 'conso' => separerNombres(floor($conso*($_POST['vitesse']/100)*$nbtrajet)) + ) + ); + } +} + +header("X-JSON: ".$json->encode($datas)); +?> \ No newline at end of file diff --git a/pages/annul_bat.php b/pages/annul_bat.php index 3d00d78..885503d 100644 --- a/pages/annul_bat.php +++ b/pages/annul_bat.php @@ -7,7 +7,7 @@ $ss=$_SESSION['ss']; $pos=$_SESSION['pos']; $race=$_SESSION['race']; -require_once('bdd.php'); +include_once('common.php'); require('../connectBDD.php'); if (isset($_GET['bat']) && (intval($_GET['bat']) == $_GET['bat'] || $_GET['bat'] == 'e')) { diff --git a/pages/annul_def.php b/pages/annul_def.php index e67cb54..ccc3d73 100644 --- a/pages/annul_def.php +++ b/pages/annul_def.php @@ -7,7 +7,7 @@ $ss=$_SESSION['ss']; $pos=$_SESSION['pos']; $race=$_SESSION['race']; -require_once('bdd.php'); +include_once('common.php'); require('../connectBDD.php'); if (!isset($_GET['nb'])) $nb = 1; diff --git a/pages/annul_tec.php b/pages/annul_tec.php index 80afc2c..c921262 100644 --- a/pages/annul_tec.php +++ b/pages/annul_tec.php @@ -7,7 +7,7 @@ $ss=$_SESSION['ss']; $pos=$_SESSION['pos']; $race=$_SESSION['race']; -require_once('bdd.php'); +include_once('common.php'); require('../connectBDD.php'); if (isset($_GET['tec']) && intval($_GET['tec']) == $_GET['tec']) { diff --git a/pages/annul_vais.php b/pages/annul_vais.php index ece8dd5..c5f2bd0 100644 --- a/pages/annul_vais.php +++ b/pages/annul_vais.php @@ -7,7 +7,7 @@ $ss=$_SESSION['ss']; $pos=$_SESSION['pos']; $race=$_SESSION['race']; -require_once('bdd.php'); +include_once('common.php'); require('../connectBDD.php'); if (!isset($_GET['nb'])) $nb = 1; diff --git a/pages/anul_tec.php b/pages/anul_tec.php index b67904c..7068a24 100644 --- a/pages/anul_tec.php +++ b/pages/anul_tec.php @@ -7,7 +7,7 @@ $ss=$_SESSION['ss']; $pos=$_SESSION['pos']; $race=$_SESSION['race']; -require('bdd.php'); +include_once('common.php'); require('../connectBDD.php'); if ($_GET['tec'] == 1) { diff --git a/pages/base.php b/pages/base.php new file mode 100644 index 0000000..5f14f6c --- /dev/null +++ b/pages/base.php @@ -0,0 +1,1359 @@ +set_filenames(array('depart' => 'depart.tpl')); + +// Calcul le nombre de cases restante sur la planète +$diametre = $cases * 92; + +$nbra = mysql_query("SELECT COUNT(*) AS nbre FROM mail WHERE destinataire='$pseudo' AND vu='1'"); +$nbre_non = mysql_fetch_assoc($nbra); +$nbr = mysql_query("SELECT * FROM mail WHERE `destinataire` = '$pseudo' AND vu='1'"); + +$ee = mysql_query("SELECT pseudo, points, place_points FROM user WHERE id='$id'"); +$data = mysql_fetch_array($ee); + +$DATEHEURE = date('H:i:s d/m/Y',time()); + +if (mysql_num_rows($nbr) == 1) $MESSAGERIE = 'Vous avez 1 nouveau message'; +elseif (mysql_num_rows($nbr) > 1) $MESSAGERIE = 'Vous avez '.mysql_num_rows($nbr).' nouveaux messages'; +else $MESSAGERIE = 'Pas de nouveau message privé'; + +$template->assign_vars(array('DATEHEURE' => $DATEHEURE, 'MESSAGERIE' => $MESSAGERIE, 'NOM_PLANETE' => $nom_planete, 'PSEUDO_PLANETE' => trouvNom($id), 'PSEUDO' => $data['pseudo'], 'IMAGE' => $image, 'DESC_DIAMETRE' => $diametre, 'DESC_CASES' => $case, 'DESC_CASESMAX' => $cases, 'RACE' => $race, 'GALAXIE' => $galaxy, 'SYSTEME' => $ss, 'POSITION' => $pos, 'POINTS' => $data['points'], 'PLACE' => $data['place_points'])); +/* FIN Page départ + * + */ + +/* Page bâtiments + * + * +function verification_des_ress($num, $fer, $cristal, $ro, $need_fer, $need_cristal, $need_ro) { + if ($fer >= $need_fer && $cristal >= $need_cristal && $ro >= $need_ro) return 'Construire'; + else return 'Construire'; +} + +function ressources($fer, $cristal, $ro, $need_fer, $need_cristal, $need_ro) { + require 'noms.php'; + $return = ''; + if ($need_fer > 0) { + if ($fer <= $need_fer) { + $z=floor($fer)-$need_fer; + $return .= ''.$ressourc[0].' : '.$need_fer.' '; + } + else $return .= $ressourc[0].' : '.$need_fer.' '; + } + if ($need_cristal > 0) { + if ($cristal <= $need_cristal) { + $z=floor($cristal)-$need_cristal; + $return .= ''.$ressourc[1].' : '.$need_cristal.' '; + } + else $return .= $ressourc[1].' : '.$need_cristal.' '; + } + if ($need_ro > 0) { + if ($ro <= $need_ro) { + $z=floor($ro)-$need_ro; + $return .= ''.$ressourc[2].' : '.$need_ro.''; + } + else $return .= $ressourc[2].' : '.$need_ro.''; + } + return $return; +} +function sec($time) { + $output = ''; + $tab = array ('jour' => '86400', 'heure' => '3600', 'minute' => '60', 'seconde' => '1'); + foreach ($tab as $key => $value) { + $compteur = 0; + while ($time > ($value-1)) { + $time = $time - $value; + $compteur++; + } + if ($compteur != 0) { + $output .= $compteur.' '.$key; + if ($compteur > 1) $output .= 's'; + if ($value != 1) $output .= ' '; + } + } + return $output; +} + +function ress_tem($fer, $cristal, $ro, $need_fer, $need_cristal, $need_ro, $mine_m, $mine_c, $mine_h) { + if ($mine_m < 0) $prod_met = 40; + else $prod_metal = ceil((($mine_m*32)+(pow(1.41,$mine_m)*exp(0.066*$mine_m))*$coeff)*3.7) + 40; + if ($mine_c < 0) $prod_cri = 20; + else $prod_cristal = (floor(($mine_c*13)+(pow(1.36,$mine_c)*exp(0.0675*$mine_c))*$coeff)*7) + 20; + if ($centrale_f > 0) $conso_hy = ceil(($centrale_f*5+(exp($mine_m*0.3)*10))*$coeff); + else $conso_hy=0; + if ($mine_h < 0) $prod_hydrogene = 0.0000000001; + else $prod_hydrogene = (ceil((($mine_h*12)+(pow(1.394,$mine_h)*exp(0.072*$mine_h))*$coeff)*5)); + $w = $prod_hydrogene - $conso_hy; + if ($mine_h == 0) { $w=1; $ro=0; $need_ro=0; } + if (($prod_hydrogene-$conso_hy) < 0) { $w= 1; $ro=0; $need_ro=0; } + + $tem1 = abs(floor($fer)-$need_fer)/$prod_metal; + $tem2 = abs(floor($cristal)-$need_cristal)/$prod_cristal; + $tem3 = abs(floor($ro)-$need_ro)/$w; + + $tem = max($tem1,$tem2,$tem3); + + echo ceil($tem); +} + +$template->set_filenames(array('batiments' => 'batiments.tpl')); + + if (!isset($_GET['err'])) $_GET['err'] = ''; + $ERREUR = ''; + if ($_GET['err'] == 1) $ERREUR = '
Ce batiment est déjà en cours de laboratoire_validation, vous ne pouvez pas le rajouter dans la file d\'attente

'; + elseif ($_GET['err'] == 2) $ERREUR = '
La production à la chaîne a été arrêtée

'; + +$a=0; $b=0; $c=0; + + // Batiment n°1 : Purificateur de métal/Générateur de Métal/Usine de métallurgie ; planete.mine_m + $i = 0; + $nom_bdd = 'mine_m'; + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=ceil(exp(0.4*$mine_m)*190); $b=ceil(exp(0.4*$mine_m)*90); + if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } + elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; + elseif ($case <= 0) $action = 'Planète pleine'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); } + if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(1.7,$mine_m)*120)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i]))); + + // Batiment n°2 : Purificateur de cristal/Générateur de Cristal/Usine de cristal ; planete.mine_m + $i = 1; + $nom_bdd = 'mine_c'; + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=ceil(exp(0.43*$mine_c)*205); $b=ceil(exp(0.43*$mine_c)*110); + if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } + elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; + elseif ($case <= 0) $action = 'Planète pleine'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); } + if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(1.72,$mine_c)*160)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i]))); + + // Batiment n°3 : Ionisateur/Générateur d'Hydrogène/Synchronisateur d'hydrogène ; planete.mine_h + $i = 2; + $nom_bdd = 'mine_h'; + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=ceil(exp(0.445*$mine_h)*235); $b=ceil(exp(0.445*$mine_h)*150); + if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } + elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; + elseif ($case <= 0) $action = 'Planète pleine'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); } + if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(1.75,$mine_h)*180)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i]))); + + // Batiment n°4 : Centrale solaire/Générateur d'Energie/Centrale solaire ; planete.centrale_s + $i = 3; + $nom_bdd = 'centrale_s'; + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=ceil(exp(0.442*$centrale_s)*165); $b=ceil(exp(0.442*$centrale_s)*99); + if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } + elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; + elseif ($case <= 0) $action = 'Planète pleine'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); } + if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(1.68,$centrale_s)*190)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i]))); + + // Batiment n°5 : Centrale de fusion/0/Centrale énergétique ; planete.centrale_f + if ($centrale_s >= 12 && $energie_t >= 5) { + $i = 4; + $nom_bdd = 'centrale_f'; + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=ceil(pow(1.8,$centrale_f)*300); $b=ceil(pow(1.82,$centrale_f)*230); + if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } + elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; + elseif ($case <= 0) $action = 'Planète pleine'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); } + if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(1.8,$centrale_f)*300)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i]))); + } + + // Batiment n°6 : Oeil des prophètes/0/Base radar ; planete.centrale_f + if ($detection >= 1) { + $i = 5; + $nom_bdd = 'radar'; + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=ceil(pow(2,$radar)*750); $b=ceil(pow(2,$radar)*500); $c=ceil(pow(2,$radar)*50); + if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } + elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; + elseif ($case <= 0) $action = 'Planète pleine'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); } + if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(2,$radar)*720)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i]))); + } + + // Batiment n°7 : Centre de recherches/Centre de recherches/Centre de recherches ; planete.labo + $i = 6; + $nom_bdd = 'labo'; + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=ceil(pow(2,$labo)*200); $b=ceil(pow(2,$labo)*150); + if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } + elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; + elseif ($case <= 0) $action = 'Planète pleine'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); } + if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(2,$labo)*720)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i]))); + + // Batiment n°8 : Chantier terrestre/Chantier terrestre/Chantier terrestre ; planete.chantier_terrestre + $i = 7; + $nom_bdd = 'chantier_terrestre'; + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=ceil(pow(2,$chantier_terrestre)*520); $b=ceil(pow(2,$chantier_terrestre)*380); + if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } + elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; + elseif ($case <= 0) $action = 'Planète pleine'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); } + if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(2,$chantier_terrestre)*420)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i]))); + + // Batiment n°9 : Chantier spatial/Chantier spatial/Chantier spatial ; planete.chantier_spatial + if ($chantier_terrestre >= 2) { + $i = 8; + $nom_bdd = 'chantier_spatial'; + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=ceil(pow(2,$chantier_spatial)*600); $b=ceil(pow(2,$chantier_spatial)*450); + if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } + elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; + elseif ($case <= 0) $action = 'Planète pleine'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); } + if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(2,$chantier_spatial)*600)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i]))); + } + + // Batiment n°10 : Caserne/0/Ecole militaire ; planete.caserne + $i = 9; + $nom_bdd = 'caserne'; + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=ceil(pow(2,$caserne)*200); $b=ceil(pow(2,$caserne)*100); + if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } + elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; + elseif ($case <= 0) $action = 'Planète pleine'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); } + if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(2,$caserne)*300)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i]))); + + // Batiment n°11 : Entrepôt/Entrepôt/Silo de stockage ; planete.silo + $i = 10; + $nom_bdd = 'silo'; + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=ceil(pow(2,$silo)*400); $b=ceil(pow(2,$silo)*260); + if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } + elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; + elseif ($case <= 0) $action = 'Planète pleine'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); } + if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(2,$silo)*1200)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i]))); + + // Batiment n°12 : Centrale informatique/0/Centrale informatique ; planete.centre_info + if ($informatique >= 2) { + $i = 11; + $nom_bdd = 'centre_info'; + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=ceil(pow(1.7,$centre_info)*600); $b=ceil(pow(1.7,$centre_info)*420); $c=ceil(pow(1.7,$centre_info)*100); + if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } + elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; + elseif ($case <= 0) $action = 'Planète pleine'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); } + if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(1.9,$centre_info)*800)/((0.0025*$ingeneieur)+1))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i]))); + } + + $CHAINE = ''; + if (!empty($fileBat[0])) { + for ($i=0 ; $iassign_block_vars('file',array('NOM' => $batiment[$fileBat[$i]-1], 'NUM' => $fileBat[$i])); + elseif ($fileBat[$i] != 'e') $template->assign_block_vars('file',array('NOM' => $batiment[$fileBat[$i]-1], 'NUM' => $fileBat[$i], 'RESTANT' => ' - ')); + else $CHAINE = '
Arrêter de produire à la chaîne'; + } + $FILETXT = ''; + if ($i == 1 && $bat_boucle == false) $CHAINE = '
Produire à la chaîne'; + } + else $FILETXT = 'Aucun batiment en attente'; + $template->assign_vars(array('RACE' => $race, 'FILETXT' => $FILETXT, 'CHAINE' => $CHAINE)); +/* FIN Page bâtiments + * + */ + +/* Page versions + * + * +$template->set_filenames(array('version' => 'version.tpl')); + +$x = mysql_query("SELECT * FROM version"); +$data = mysql_fetch_array($x); + +$result = mysql_query("SELECT * FROM version ORDER BY temps DESC"); +while ($data = mysql_fetch_array($result)) { + $template->assign_block_vars('versions', array('NUMERO' => $data['version'],'DESCRIPTION' => $data['contenu'])); +} +/* FIN Page versions + * + */ + +/* Page prochainement + * + * +$template->set_filenames(array('prochainement' => 'manque.tpl')); +$template->assign_vars( array('TEXTE' => 'Prochaînement dans Halo-Battle')); +/* FIN Page prochainement + * + */ + +/* Page chantier spatial + * + * +function verification_des_ress($numtec, $metal, $calcium, $nourriture, $ress_ness_metal, $ress_ness_calcium, $ress_ness_nourriture) { + if ($metal >= $ress_ness_metal && $calcium >= $ress_ness_calcium && $nourriture >= $ress_ness_nourriture) return '


'; + else return 'Vous n\'avez pas suffisament de ressources'; +} + +function verification_des_ressvf($numtec, $metal, $calcium, $nourriture, $ress_ness_metal, $ress_ness_calcium, $ress_ness_nourriture) { + if ($metal >= $ress_ness_metal && $calcium >= $ress_ness_calcium && $nourriture >= $ress_ness_nourriture) return true; + else return false; +} + +function ressources($fer, $cristal, $ro, $need_fer, $need_cristal, $need_ro) { + require 'noms.php'; + $return = ''; + if ($need_fer > 0) { + if ($fer <= $need_fer) { + $z=floor($fer)-$need_fer; + $return .= ''.$ressourc[0].' : '.$need_fer.' '; + } + else $return .= $ressourc[0].' : '.$need_fer.' '; + } + if ($need_cristal > 0) { + if ($cristal <= $need_cristal) { + $z=floor($cristal)-$need_cristal; + $return .= ''.$ressourc[1].' : '.$need_cristal.' '; + } + else $return .= $ressourc[1].' : '.$need_cristal.' '; + } + if ($need_ro > 0) { + if ($ro <= $need_ro) { + $z=floor($ro)-$need_ro; + $return .= ''.$ressourc[2].' : '.$need_ro.''; + } + else $return .= $ressourc[2].' : '.$need_ro.''; + } + return $return; +} + +function sec($time) { + $output = ''; + $tab = array ('jour' => '86400', 'heure' => '3600', 'minute' => '60', 'seconde' => '1'); + foreach ($tab as $key => $value) { + $compteur = 0; + while ($time > ($value-1)) { + $time = $time - $value; + $compteur++; + } + if ($compteur != 0) { + $output .= $compteur.' '.$key; + if ($compteur > 1) $output .= 's'; + if ($value != 1) $output .= ' '; + } + } + return $output; +} + +$template->set_filenames(array('chantier_spatial' => 'chantier_spatial.tpl')); + +$f = ceil(1080/pow(1.25,($chantier_spatial-1))); +$g = ceil(6300/pow(1.25,($chantier_spatial-5))); +$h = ceil(8280/pow(1.25,($chantier_spatial-5))); +$iV = ceil(1440/pow(1.25,($chantier_spatial-3))); +$j = ceil(7380/pow(1.25,($chantier_spatial-5))); +$k = ceil(1200/pow(1.25,($chantier_spatial-1))); +$l = ceil(4680/pow(1.25,($chantier_spatial-3))); +$m = ceil(16800/pow(1.25,($chantier_spatial-6))); +$nV = ceil(18060/pow(1.25,($chantier_spatial-6))); +$p = ceil(32400/pow(1.25,($chantier_spatial-8))); +$q = ceil(117000/pow(1.25,($chantier_spatial-12))); + +if ($temps_spatial > 0) $unit = $nomvaisa[--$unit_s]; + +if ($chantier_spatial > 0) { + if (!isset($_GET['err'])) $_GET['err'] = ''; + $ERREUR = ''; + if ($_GET['err'] == 1) $ERREUR = '
Cette technologie est déjà en cours de recherche, vous ne pouvez pas la rajouter dans la file d\'attente

'; + elseif ($_GET['err'] == 2) $ERREUR = '
La production à la chaîne a été arrêtée

'; + elseif ($_GET['err'] == 3) $ERREUR = '
Vous n\'avez pas assez de ressources pour construire autant de vaisseaux

'; + + $template->set_filenames(array('chantier_spatial' => 'chantier_spatial.tpl')); + +$a=0; $b=0; $c=0; + + // Vaisseau n°1 : Cargos de classe Inquisitor/Transporteur Leger/Cargos de classe Parabola ; planete.vaisseau_1 + if ($chantier_spatial >= 1 && $reacteur >= 4) { + $i = 0; + $nom_bdd = 'vaisseau_'.($i+1); + if (${$nom_bdd} > 0) $niveau = '('.${$nom_bdd}.' vaisseau(x))'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=1000; $b=800; + if($bat == 9) $action = 'Le chantier spatial est en cours d\'évolution'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'chantier_spatial_validation.php?type='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($f), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($nomvaisn[$i]), 'DESCRIPTIONE' => addslashes($nomvaisd[$i]), 'LIEN' => $lien)); + } + + // Vaisseau n°2 : Cargos de classe Interdictor/Transporteur Lourd/Cargos de classe Laden ; planete.vaisseau_2 + if ($chantier_spatial >= 5 && $reacteur_f >= 2) { + $i = 1; + $nom_bdd = 'vaisseau_'.($i+1); + if (${$nom_bdd} > 0) $niveau = '('.${$nom_bdd}.' vaisseau(x))'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=4000; $b=3000; + if($bat == 9) $action = 'Le chantier spatial est en cours d\'évolution'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'chantier_spatial_validation.php?type='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($g), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($nomvaisn[$i]), 'DESCRIPTIONE' => addslashes($nomvaisd[$i]), 'LIEN' => $lien)); + } + + // Vaisseau n°3 : Vaisseau de colonisation de classe Returning/Colonisateur/Vaisseaux de colonisation de classe Odyssey ; planete.vaisseau_3 + if ($chantier_spatial >= 5 && $reacteur_ff >= 1) { + $i = 2; + $nom_bdd = 'vaisseau_'.($i+1); + if (${$nom_bdd} > 0) $niveau = '('.${$nom_bdd}.' vaisseau(x))'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=9000; $b=9000; $c=1000; + if($bat == 9) $action = 'Le chantier spatial est en cours d\'évolution'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'chantier_spatial_validation.php?type='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($h), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($nomvaisn[$i]), 'DESCRIPTIONE' => addslashes($nomvaisd[$i]), 'LIEN' => $lien)); + } + + // Vaisseau n°4 : Sonde de reconnaissance de classe Perception/0/Drones d’espionnage de classe Clarion ; planete.vaisseau_4 + if ($chantier_spatial >= 3 && $reacteur >= 5 && $detection >= 2) { + $i = 3; + $nom_bdd = 'vaisseau_'.($i+1); + if (${$nom_bdd} > 0) $niveau = '('.${$nom_bdd}.' vaisseau(x))'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=1000; $b=1200; $c=100; + if($bat == 9) $action = 'Le chantier spatial est en cours d\'évolution'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'chantier_spatial_validation.php?type='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($iV), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($nomvaisn[$i]), 'DESCRIPTIONE' => addslashes($nomvaisd[$i]), 'LIEN' => $lien)); + } + + // Vaisseau n°5 : Charognard/Recycleur/Recycleurs de classe Minotaur ; planete.vaisseau_5 + if ($chantier_spatial >= 5 && $reacteur_f >= 4 && $blindage >= 5) { + $i = 4; + $nom_bdd = 'vaisseau_'.($i+1); + if (${$nom_bdd} > 0) $niveau = '('.${$nom_bdd}.' vaisseau(x))'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=15000; $b=9000; $c=1000; + if($bat == 9) $action = 'Le chantier spatial est en cours d\'évolution'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'chantier_spatial_validation.php?type='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($j), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($nomvaisn[$i]), 'DESCRIPTIONE' => addslashes($nomvaisd[$i]), 'LIEN' => $lien)); + } + + // Vaisseau n°6 : Séraphin/Croiseur Forruner/C709 Longsword Interceptor ; planete.vaisseau_6 + if ($chantier_spatial >= 1 && $reacteur >= 4) { + $i = 5; + $nom_bdd = 'vaisseau_'.($i+1); + if (${$nom_bdd} > 0) $niveau = '('.${$nom_bdd}.' vaisseau(x))'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=1700; $b=1220; + if($bat == 9) $action = 'Le chantier spatial est en cours d\'évolution'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'chantier_spatial_validation.php?type='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($k), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($nomvaisn[$i]), 'DESCRIPTIONE' => addslashes($nomvaisd[$i]), 'LIEN' => $lien)); + } + + // Vaisseau n°7 : Frégate/Super-Destroyer/Frégate ; planete.vaisseau_7 + if ($chantier_spatial >= 3 && $reacteur_f >= 3 && $armement >=1) { + $i = 6; + $nom_bdd = 'vaisseau_'.($i+1); + if (${$nom_bdd} > 0) $niveau = '('.${$nom_bdd}.' vaisseau(x))'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=5800; $b=1400; + if($bat == 9) $action = 'Le chantier spatial est en cours d\'évolution'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'chantier_spatial_validation.php?type='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($l), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($nomvaisn[$i]), 'DESCRIPTIONE' => addslashes($nomvaisd[$i]), 'LIEN' => $lien)); + } + + // Vaisseau n°8 : Croiseur de classe CCS/Chasseur Leger/Croiseurs de classe Halcyon ; planete.vaisseau_8 + if ($chantier_spatial >= 6 && $reacteur_ff >= 2 && $armement >= 3 && $blindage >= 4) { + $i = 7; + $nom_bdd = 'vaisseau_'.($i+1); + if (${$nom_bdd} > 0) $niveau = '('.${$nom_bdd}.' vaisseau(x))'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=20000; $b=16000; $c=1600; + if($bat == 9) $action = 'Le chantier spatial est en cours d\'évolution'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'chantier_spatial_validation.php?type='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($m), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($nomvaisn[$i]), 'DESCRIPTIONE' => addslashes($nomvaisd[$i]), 'LIEN' => $lien)); + } + + // Vaisseau n°9 : Croiseur de classe Reverence/Chasseur Lourd/Croiseurs de classe Marathon ; planete.vaisseau_9 + if ($chantier_spatial >= 6 && $reacteur_ff >= 3 && $armement >= 4 && $blindage >= 4) { + $i = 8; + $nom_bdd = 'vaisseau_'.($i+1); + if (${$nom_bdd} > 0) $niveau = '('.${$nom_bdd}.' vaisseau(x))'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=26000; $b=16400; $c=1600; + if($bat == 9) $action = 'Le chantier spatial est en cours d\'évolution'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'chantier_spatial_validation.php?type='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($nV), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($nomvaisn[$i]), 'DESCRIPTIONE' => addslashes($nomvaisd[$i]), 'LIEN' => $lien)); + } + + // Vaisseau n°10 : Porte vaisseaux/Porte-vaisseaux/Porte vaisseaux ; planete.vaisseau_10 + if ($chantier_spatial >= 8 && $reacteur_ff >= 5 && $armement >=6 && $blindage >= 6) { + $i = 9; + $nom_bdd = 'vaisseau_'.($i+1); + if (${$nom_bdd} > 0) $niveau = '('.${$nom_bdd}.' vaisseau(x))'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=60000; $b=40000; $c=3000; + if($bat == 9) $action = 'Le chantier spatial est en cours d\'évolution'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'chantier_spatial_validation.php?type='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($p), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($nomvaisn[$i]), 'DESCRIPTIONE' => addslashes($nomvaisd[$i]), 'LIEN' => $lien)); + } + + // Vaisseau n°11 : Station orbitale covenant/Station orbitale/Station orbitale ; planete.vaisseau_11 + if ($chantier_spatial >= 12 && $reacteur_ff >= 10 && $armement >= 12 && $blindage >= 12) { + $i = 10; + $nom_bdd = 'vaisseau_'.($i+1); + if (${$nom_bdd} > 0) $niveau = '('.${$nom_bdd}.' vaisseau(x))'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=500000; $b=400000; $c=250000; + if($bat == 9) $action = 'Le chantier spatial est en cours d\'évolution'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'chantier_spatial_validation.php?type='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($q), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($nomvaisn[$i]), 'DESCRIPTIONE' => addslashes($nomvaisd[$i]), 'LIEN' => $lien)); + } + + // Vaisseau n°12 : Super porte vaisseaux/Super porte-vaisseaux/Super porte-vaisseaux ; planete.vaisseau_12 + if ($chantier_spatial >= 12 && $reacteur_ff >= 10 && $armement >= 12 && $blindage >= 12) { + $i = 11; + $nom_bdd = 'vaisseau_'.($i+1); + if (${$nom_bdd} > 0) $niveau = '('.${$nom_bdd}.' vaisseau(x))'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=500000; $b=400000; $c=250000; + if($bat == 9) $action = 'Le chantier spatial est en cours d\'évolution'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'chantier_spatial_validation.php?type='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($q), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($nomvaisn[$i]), 'DESCRIPTIONE' => addslashes($nomvaisd[$i]), 'LIEN' => $lien)); + } + + $CHAINE = ''; + $ut = false; + + $tr = $fileTemps_s[0] + $fileTemps_s[1] - time(); + if (!empty($fileVai[0])) $RESTE = $action = ''; + else $RESTE = ''; + + if (!empty($fileVai[0])) { + $comp = 1; + for ($i=0 ; $iassign_block_vars('file',array('NOM' => $comp.' '.$nomvaisa[$fileVai[$i]-1], 'NUM' => $fileVai[$i], 'I' => $i, 'RESTANT' => 'prochain : - ')); + $ut = true; + } + else $template->assign_block_vars('file',array('NOM' => $comp.' '.$nomvaisa[$fileVai[$i]-1], 'NUM' => $fileVai[$i], 'I' => $i)); + $comp = 1; + } + + } + //else $CHAINE = '
Arrêter de produire à la chaîne'; + } + $FILETXT = ''; + //if ($i == 1 && $vai_boucle == false) $CHAINE = '
Produire à la chaîne'; + } + else $FILETXT = 'Aucun vaisseau en attente'; + + $template->assign_vars(array('RACE' => $race, 'FILETXT' => $FILETXT, 'CHAINE => $CHAINE, 'RESTE' => $RESTE, 'ERREUR' => $ERREUR)); +} +else { + $template->set_filenames(array('chantier_spatial' => 'manque.tpl')); + $template->assign_vars( array('TEXTE' => 'Vous devez d\'abord construire un chantier spatial !')); +} +/* FIN Page chantier spatial + * + */ + +/* Page défenses + * + * +function verification_des_ress($numtec, $metal, $calcium, $nourriture, $ress_ness_metal, $ress_ness_calcium, $ress_ness_nourriture) { + if ($metal >= $ress_ness_metal && $calcium >= $ress_ness_calcium && $nourriture >= $ress_ness_nourriture) return '


'; + else return 'Vous n\'avez pas suffisament de ressources'; +} + +function verification_des_ressvf($numtec, $metal, $calcium, $nourriture, $ress_ness_metal, $ress_ness_calcium, $ress_ness_nourriture) { + if ($metal >= $ress_ness_metal && $calcium >= $ress_ness_calcium && $nourriture >= $ress_ness_nourriture) return true; + else return false; +} + +function ressources($fer, $cristal, $ro, $need_fer, $need_cristal, $need_ro) { + require 'noms.php'; + $return = ''; + if ($need_fer > 0) { + if ($fer <= $need_fer) { + $z=floor($fer)-$need_fer; + $return .= ''.$ressourc[0].' : '.$need_fer.' '; + } + else $return .= $ressourc[0].' : '.$need_fer.' '; + } + if ($need_cristal > 0) { + if ($cristal <= $need_cristal) { + $z=floor($cristal)-$need_cristal; + $return .= ''.$ressourc[1].' : '.$need_cristal.' '; + } + else $return .= $ressourc[1].' : '.$need_cristal.' '; + } + if ($need_ro > 0) { + if ($ro <= $need_ro) { + $z=floor($ro)-$need_ro; + $return .= ''.$ressourc[2].' : '.$need_ro.''; + } + else $return .= $ressourc[2].' : '.$need_ro.''; + } + return $return; +} + +function sec($time) { + $output = ''; + $tab = array ('jour' => '86400', 'heure' => '3600', 'minute' => '60', 'seconde' => '1'); + foreach ($tab as $key => $value) { + $compteur = 0; + while ($time > ($value-1)) { + $time = $time - $value; + $compteur++; + } + if ($compteur != 0) { + $output .= $compteur.' '.$key; + if ($compteur > 1) $output .= 's'; + if ($value != 1) $output .= ' '; + } + } + return $output; +} + +$template->set_filenames(array('defense' => 'defense.tpl')); + +$f = ceil(1080/pow(1.25,($chantier_spatial-1))); +$g = ceil(6300/pow(1.25,($chantier_spatial-5))); +$h = ceil(8280/pow(1.25,($chantier_spatial-5))); +$iV = ceil(1440/pow(1.25,($chantier_spatial-3))); +$j = ceil(7380/pow(1.25,($chantier_spatial-5))); +$k = ceil(1200/pow(1.25,($chantier_spatial-1))); +$l = ceil(4680/pow(1.25,($chantier_spatial-3))); +$m = ceil(16800/pow(1.25,($chantier_spatial-6))); +$nV = ceil(18060/pow(1.25,($chantier_spatial-6))); +$p = ceil(32400/pow(1.25,($chantier_spatial-8))); +$q = ceil(117000/pow(1.25,($chantier_spatial-12))); + +if ($temps_spatial > 0) $unit = $nomvaisa[--$unit_s]; + +if ($chantier_spatial > 0) { + if (!isset($_GET['err'])) $_GET['err'] = ''; + $ERREUR = ''; + if ($_GET['err'] == 1) $ERREUR = '
Cette technologie est déjà en cours de recherche, vous ne pouvez pas la rajouter dans la file d\'attente

'; + elseif ($_GET['err'] == 2) $ERREUR = '
La production à la chaîne a été arrêtée

'; + elseif ($_GET['err'] == 3) $ERREUR = '
Vous n\'avez pas assez de ressources pour construire autant de vaisseaux

'; + + $template->set_filenames(array('defense' => 'defense.tpl')); + +$a=0; $b=0; $c=0; + + // Défense n°1 : Shade/Tour à plasma/Mitrailleuse automatique M247 GP ; planete.def_1 + if ($chantier_spatial >= 1) { + $i = 8; + $nom_bdd = 'def_'.($i-7); + if (${$nom_bdd} > 0) $niveau = '('.${$nom_bdd}.' construit)'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=500; $b=200; + if($bat == 8) $action = 'Le chantier terrestre est en cours d\'évolution'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'defense_validation.php?type='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($nomterrn[$i])) $template->assign_block_vars('defense', array('IMAGE' => $nomterri[$i], 'NOM' => $nomterrn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomterde[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($f), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($nomterrn[$i]), 'DESCRIPTIONE' => addslashes($nomterde[$i]), 'LIEN' => $lien)); + } + + // Défense n°2 : Strong shade/Tour Ion/DCA légère ; planete.def_2 + if ($chantier_terrestre >= 3 && $energie_t >=2) { + $i = 9; + $nom_bdd = 'def_'.($i-7); + if (${$nom_bdd} > 0) $niveau = '('.${$nom_bdd}.' construit)'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=4000; $b=2000; + if($bat == 8) $action = 'Le chantier terrestre est en cours d\'évolution'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'defense_validation.php?type='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($nomterrn[$i])) $template->assign_block_vars('defense', array('IMAGE' => $nomterri[$i], 'NOM' => $nomterrn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomterde[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($g), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($nomterrn[$i]), 'DESCRIPTIONE' => addslashes($nomterde[$i]), 'LIEN' => $lien)); + } + + // Défense n°3 : Tourelle à barreau de combustible/Canon Orbital/DCA lourde ; planete.def_3 + if ($chantier_terrestre >= 4 && $armement >= 3 && $energie_t >= 3) { + $i = 10; + $nom_bdd = 'def_'.($i-7); + if (${$nom_bdd} > 0) $niveau = '('.${$nom_bdd}.' construit)'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=4500; $b=800; $c=600; + if($bat == 8) $action = 'Le chantier terrestre est en cours d\'évolution'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'defense_validation.php?type='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($nomterrn[$i])) $template->assign_block_vars('defense', array('IMAGE' => $nomterri[$i], 'NOM' => $nomterrn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomterde[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($h), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($nomterrn[$i]), 'DESCRIPTIONE' => addslashes($nomterde[$i]), 'LIEN' => $lien)); + } + + // Défense n°4 : Canon à plasma/Drone/Canon Gauss ; planete.def_4 + if ($chantier_terrestre >= 4 && $armement >= 1) { + $i = 11; + $nom_bdd = 'def_'.($i-7); + if (${$nom_bdd} > 0) $niveau = '('.${$nom_bdd}.' construit)'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=12000; $b=10000; $c=1000; + if($bat == 8) $action = 'Le chantier terrestre est en cours d\'évolution'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'defense_validation.php?type='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($nomterrn[$i])) $template->assign_block_vars('defense', array('IMAGE' => $nomterri[$i], 'NOM' => $nomterrn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomterde[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($h), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($nomterrn[$i]), 'DESCRIPTIONE' => addslashes($nomterde[$i]), 'LIEN' => $lien)); + } + + // Défense n°5 : Lanceur de torpilles plasma/Station de defense/Lanceur de missiles ; planete.def_5 + if ($chantier_terrestre >= 4 && $armement >= 1) { + $i = 12; + $nom_bdd = 'def_'.($i-7); + if (${$nom_bdd} > 0) $niveau = '('.${$nom_bdd}.' construit)'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=15000; $b=9500; $c=1500; + if($bat == 8) $action = 'Le chantier terrestre est en cours d\'évolution'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'defense_validation.php?type='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($nomterrn[$i])) $template->assign_block_vars('defense', array('IMAGE' => $nomterri[$i], 'NOM' => $nomterrn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomterde[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($h), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($nomterrn[$i]), 'DESCRIPTIONE' => addslashes($nomterde[$i]), 'LIEN' => $lien)); + } + + $CHAINE = ''; + $ut = false; + + $tr = $fileTemps_v[0] + $fileTemps_v[1] - time(); + if (!empty($fileVeh[0])) $RESTE = $action = ''; + else $RESTE = ''; + + if (!empty($fileVeh[0])) { + $comp = 1; + for ($i=0 ; $iassign_block_vars('file',array('NOM' => $comp.' '.$nomterrn[$fileVeh[$i]-1], 'NUM' => $fileVeh[$i], 'I' => $i, 'RESTANT' => 'prochain : - ')); + $ut = true; + } + else $template->assign_block_vars('file',array('NOM' => $comp.' '.$nomterrn[$fileVeh[$i]-1], 'NUM' => $fileVeh[$i], 'I' => $i)); + $comp = 1; + } + + } + //else $CHAINE = '
Arrêter de produire à la chaîne'; + } + $FILETXT = ''; + //if ($i == 1 && $vai_boucle == false) $CHAINE = '
Produire à la chaîne'; + } + else $FILETXT = 'Aucune défense en attente'; + + $template->assign_vars(array('RACE' => $race, 'FILETXT' => $FILETXT, 'CHAINE' => $CHAINE, 'RESTE' => $RESTE, 'ERREUR' => $ERREUR)); +} +else { + $template->set_filenames(array('defense' => 'manque.tpl')); + $template->assign_vars( array('TEXTE' => 'Vous devez d\'abord construire un chantier terrestre !')); +} +/* FIN Page défenses + * + */ + +/* Page Accueil => rename (renommer sa planète) + * + * +$template->set_filenames(array('rename' => 'rename.tpl')); +/* FIN Page rename + * + */ + +/* Page laboratoire + * + * +function verification_des_ress($numtec, $metal, $calcium, $nourriture, $ress_ness_metal, $ress_ness_calcium, $ress_ness_nourriture) { + if ($metal >= $ress_ness_metal && $calcium >= $ress_ness_calcium && $nourriture >= $ress_ness_nourriture) return 'Rechercher'; + else return 'Rechercher'; +} + +function verification_des_ressvf($numtec, $metal, $calcium, $nourriture, $ress_ness_metal, $ress_ness_calcium, $ress_ness_nourriture) { + if ($metal >= $ress_ness_metal && $calcium >= $ress_ness_calcium && $nourriture >= $ress_ness_nourriture) return true; + else return false; +} + +function ressources($fer, $cristal, $ro, $need_fer, $need_cristal, $need_ro) { + require 'noms.php'; + $return = ''; + if ($need_fer > 0) { + if ($fer <= $need_fer) { + $z=floor($fer)-$need_fer; + $return .= ''.$ressourc[0].' : '.$need_fer.' '; + } + else $return .= $ressourc[0].' : '.$need_fer.' '; + } + if ($need_cristal > 0) { + if ($cristal <= $need_cristal) { + $z=floor($cristal)-$need_cristal; + $return .= ''.$ressourc[1].' : '.$need_cristal.' '; + } + else $return .= $ressourc[1].' : '.$need_cristal.' '; + } + if ($need_ro > 0) { + if ($ro <= $need_ro) { + $z=floor($ro)-$need_ro; + $return .= ''.$ressourc[2].' : '.$need_ro.''; + } + else $return .= $ressourc[2].' : '.$need_ro.''; + } + return $return; +} +function sec($time) { + $output = ''; + $tab = array ('jour' => '86400', 'heure' => '3600', 'minute' => '60', 'seconde' => '1'); + foreach ($tab as $key => $value) { + $compteur = 0; + while ($time > ($value-1)) { + $time = $time - $value; + $compteur++; + } + if ($compteur != 0) { + $output .= $compteur.' '.$key; + if ($compteur > 1) $output .= 's'; + if ($value != 1) $output .= ' '; + } + } + return $output; +} + +if ($labo > 0) { + if (!isset($_GET['err'])) $_GET['err'] = ''; + $ERREUR = ''; + if ($_GET['err'] == 1) $ERREUR = '
Cette technologie est déjà en cours de recherche, vous ne pouvez pas la rajouter dans la file d\'attente

'; + elseif ($_GET['err'] == 2) $ERREUR = '
La production à la chaîne a été arrêtée

'; + + $template->set_filenames(array('laboratoire' => 'laboratoire.tpl')); + + // Technologie n°1 : Informatique/Informatique/IA ; user.informatique + if ($labo >= 1) { + $i = 0; + $nom_bdd = 'informatique'; + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $n=(${$nom_bdd}-1); $b=ceil(pow(2,$n)*500); $c=ceil(pow(2,$n)*150); + if (is_array($fileTec) && $tec == $i+1) { $tr=$fileTemps_t[0]+$fileTemps_t[1]-time(); $action = 'Recherche en cours, temps restant :
'; } + elseif (is_array($fileTec) && ereg(','.($i+1).',',','.implode(',', $fileTec).',')) { $tr=$fileTemps_t[0]+$fileTemps_t[1]-time(); $action = 'Recherche dans la file d\'attente'; } + elseif($bat == 7) $action = 'Le laboratoire est en cours d\'évolution'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, 0, $b, $c); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'laboratoire_validation.php?tec='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($technolo[$i])) $template->assign_block_vars('technologie', array('IMAGE' => $technoli[$i], 'NOM' => $technolo[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $technode[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, 0, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((420*2*($informatique+1))/pow(1.25,($labo-1)))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($technolo[$i]), 'DESCRIPTIONE' => addslashes($technode[$i]), 'LIEN' => $lien)); + } + + // Technologie n°2 : Detection/Detection/Radar ; user.detection + if ($labo >= 2 && $informatique >=2) { + $i = 1; + $nom_bdd = 'detection'; + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=ceil(pow(2,$n)*500); $b=ceil(pow(2,$n)*750); $c=ceil(pow(2,$n)*100); + if (is_array($fileTec) && $tec == $i+1) { $tr=$fileTemps_t[0]+$fileTemps_t[1]-time(); $action = 'Recherche en cours, temps restant :
'; } + elseif (is_array($fileTec) && ereg(','.($i+1).',',','.implode(',', $fileTec).',')) { $tr=$fileTemps_t[0]+$fileTemps_t[1]-time(); $action = 'Recherche dans la file d\'attente'; } + elseif($bat == 7) $action = 'Le laboratoire est en cours d\'évolution'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'laboratoire_validation.php?tec='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($technolo[$i])) $template->assign_block_vars('technologie', array('TEMPS' => sec(ceil((600*2*($detection+1))/pow(1.25,($labo-2)))), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'IMAGE' => $technoli[$i], 'NOM' => $technolo[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $technode[$i], 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($technolo[$i]), 'DESCRIPTIONE' => addslashes($technode[$i]), 'LIEN' => $lien)); + } + + // Technologie n°3 : Armement/Armement/Armement ; user.armement + if ($labo >= 5) { + $i = 2; + $nom_bdd = 'armement'; + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=ceil(pow(2,$n)*2500); $b=ceil(pow(2,$n)*500); + if (is_array($fileTec) && $tec == $i+1) { $tr=$fileTemps_t[0]+$fileTemps_t[1]-time(); $action = 'Recherche en cours, temps restant :
'; } + elseif (is_array($fileTec) && ereg(','.($i+1).',',','.implode(',', $fileTec).',')) { $tr=$fileTemps_t[0]+$fileTemps_t[1]-time(); $action = 'Recherche dans la file d\'attente'; } + elseif($bat == 7) $action = 'Le laboratoire est en cours d\'évolution'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'laboratoire_validation.php?tec='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($technolo[$i])) $template->assign_block_vars('technologie', array('TEMPS' => sec(ceil((1500*2*($armement+1))/pow(1.25,($labo-5)))), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h), 'IMAGE' => $technoli[$i], 'NOM' => $technolo[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $technode[$i], 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($technolo[$i]), 'DESCRIPTIONE' => addslashes($technode[$i]), 'LIEN' => $lien)); + } + + // Technologie n°4 : Bouclier/Bouclier/Blindage ; user.blindage + if ($labo >= 4) { + $i = 3; + $nom_bdd = 'blindage'; + $n=(${$nom_bdd}-1); + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $a=ceil(pow(2,$n)*4000); $b=ceil(pow(2,$n)*1500); + if (is_array($fileTec) && $tec == $i+1) { $tr=$fileTemps_t[0]+$fileTemps_t[1]-time(); $action = 'Recherche en cours, temps restant :
'; } + elseif (is_array($fileTec) && ereg(','.($i+1).',',','.implode(',', $fileTec).',')) { $tr=$fileTemps_t[0]+$fileTemps_t[1]-time(); $action = 'Recherche dans la file d\'attente'; } + elseif($bat == 7) $action = 'Le laboratoire est en cours d\'évolution'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'laboratoire_validation.php?tec='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($technolo[$i])) $template->assign_block_vars('technologie', array('TEMPS' => sec(ceil((1710*2*($blindage+1))/pow(1.25,($labo-4)))), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h), 'IMAGE' => $technoli[$i], 'NOM' => $technolo[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $technode[$i], 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($technolo[$i]), 'DESCRIPTIONE' => addslashes($technode[$i]), 'LIEN' => $lien)); + } + + // Technologie n°5 : Maitrise de l'énergie/Maitrise de l'énergie/Maitrise de l'énergie ; user.energie_t + if ($labo >= 2) { + $i = 4; + $nom_bdd = 'energie_t'; + $n=(${$nom_bdd}-1); + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $a=ceil(pow(2,$n)*2000); $b=ceil(pow(2,$n)*1500); $c=ceil(pow(2,$n)*300); + if (is_array($fileTec) && $tec == $i+1) { $tr=$fileTemps_t[0]+$fileTemps_t[1]-time(); $action = 'Recherche en cours, temps restant :
'; } + elseif (is_array($fileTec) && ereg(','.($i+1).',',','.implode(',', $fileTec).',')) { $tr=$fileTemps_t[0]+$fileTemps_t[1]-time(); $action = 'Recherche dans la file d\'attente'; } + elseif($bat == 7) $action = 'Le laboratoire est en cours d\'évolution'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'laboratoire_validation.php?tec='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($technolo[$i])) $template->assign_block_vars('technologie', array('TEMPS' => sec(ceil((900*2*($energie_t+1))/pow(1.25,($labo-2)))), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'IMAGE' => $technoli[$i], 'NOM' => $technolo[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $technode[$i], 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($technolo[$i]), 'DESCRIPTIONE' => addslashes($technode[$i]), 'LIEN' => $lien)); + } + + // Technologie n°6 : Réacteur à antigravité/Réacteur à antigravité/Réacteur à combustion ; user.energie_t + if ($labo >= 2) { + $i = 5; + $nom_bdd = 'reacteur'; + $n=(${$nom_bdd}-1); + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $a=ceil(pow(2,$n)*1400); $b=ceil(pow(2,$n)*400); + if (is_array($fileTec) && $tec == $i+1) { $tr=$fileTemps_t[0]+$fileTemps_t[1]-time(); $action = 'Recherche en cours, temps restant :
'; } + elseif (is_array($fileTec) && ereg(','.($i+1).',',','.implode(',', $fileTec).',')) { $tr=$fileTemps_t[0]+$fileTemps_t[1]-time(); $action = 'Recherche dans la file d\'attente'; } + elseif($bat == 7) $action = 'Le laboratoire est en cours d\'évolution'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'laboratoire_validation.php?tec='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($technolo[$i])) $template->assign_block_vars('technologie', array('TEMPS' => sec(ceil((510*2*($reacteur+1))/pow(1.25,($labo-2)))), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h), 'IMAGE' => $technoli[$i], 'NOM' => $technolo[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $technode[$i], 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($technolo[$i]), 'DESCRIPTIONE' => addslashes($technode[$i]), 'LIEN' => $lien)); + } + + // Technologie n°7 : Réacteur à fusion/Réacteur à fusion/Réacteur à fusion ; user.reacteur_f + if ($labo >= 4 && $energie_t >= 2 && $reacteur >= 4) { + $i = 6; + $nom_bdd = 'reacteur_f'; + $n=(${$nom_bdd}-1); + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $a=ceil(pow(2,$n)*3000); $b=ceil(pow(2,$n)*2100); $c=ceil(pow(2,$n)*750); + if (is_array($fileTec) && $tec == $i+1) { $tr=$fileTemps_t[0]+$fileTemps_t[1]-time(); $action = 'Recherche en cours, temps restant :
'; } + elseif (is_array($fileTec) && ereg(','.($i+1).',',','.implode(',', $fileTec).',')) { $tr=$fileTemps_t[0]+$fileTemps_t[1]-time(); $action = 'Recherche dans la file d\'attente'; } + elseif($bat == 7) $action = 'Le laboratoire est en cours d\'évolution'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'laboratoire_validation.php?tec='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($technolo[$i])) $template->assign_block_vars('technologie', array('TEMPS' => sec(ceil((1650*2*($reacteur_f+1))/pow(1.25,($labo-4)))), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'IMAGE' => $technoli[$i], 'NOM' => $technolo[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $technode[$i], 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($technolo[$i]), 'DESCRIPTIONE' => addslashes($technode[$i]), 'LIEN' => $lien)); + } + + // Technologie n°8 : Réacteur à fusion Forerunneur/Réacteur à fusion Forerunneur/Réacteur à fusion de type II ; user.reacteur_ff + if ($labo >= 6 && $energie_t >= 5 && $reacteur_f >= 4) { + $i = 7; + $nom_bdd = 'reacteur_ff'; + $n=(${$nom_bdd}-1); + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $a=ceil(pow(2,$n)*5000); $b=ceil(pow(2,$n)*4000); $c=ceil(pow(2,$n)*1500); + if (is_array($fileTec) && $tec == $i+1) { $tr=$fileTemps_t[0]+$fileTemps_t[1]-time(); $action = 'Recherche en cours, temps restant :
'; } + elseif (is_array($fileTec) && ereg(','.($i+1).',',','.implode(',', $fileTec).',')) { $tr=$fileTemps_t[0]+$fileTemps_t[1]-time(); $action = 'Recherche dans la file d\'attente'; } + elseif($bat == 7) $action = 'Le laboratoire est en cours d\'évolution'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'laboratoire_validation.php?tec='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($technolo[$i])) $template->assign_block_vars('technologie', array('TEMPS' => sec(ceil((2400*2*($reacteur_ff+1))/pow(1.25,($labo-6)))), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'IMAGE' => $technoli[$i], 'NOM' => $technolo[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $technode[$i], 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($technolo[$i]), 'DESCRIPTIONE' => addslashes($technode[$i]), 'LIEN' => $lien)); + } + + // Technologie n°9 : Médecine/Médecine/Médecine ; user.reacteur_ff + if ($labo >= 1) { + $i = 8; + $nom_bdd = 'medecine'; + $n=(${$nom_bdd}-1); + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $a=ceil(pow(2,$n)*800); $b=ceil(pow(2,$n)*1000); + if (is_array($fileTec) && $tec == $i+1) { $tr=$fileTemps_t[0]+$fileTemps_t[1]-time(); $action = 'Recherche en cours, temps restant :
'; } + elseif (is_array($fileTec) && ereg(','.($i+1).',',','.implode(',', $fileTec).',')) { $tr=$fileTemps_t[0]+$fileTemps_t[1]-time(); $action = 'Recherche dans la file d\'attente'; } + elseif($bat == 7) $action = 'Le laboratoire est en cours d\'évolution'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'laboratoire_validation.php?tec='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($technolo[$i])) $template->assign_block_vars('technologie', array('TEMPS' => sec(ceil((360*2*($medecine+1))/pow(1.25,($labo-1)))), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h), 'IMAGE' => $technoli[$i], 'NOM' => $technolo[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $technode[$i], 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($technolo[$i]), 'DESCRIPTIONE' => addslashes($technode[$i]), 'LIEN' => $lien)); + } + + // Technologie n°10 : Commandement militaire/Commandement militaire/Tactiques de combats ; user.tactique + if ($labo >= 3) { + $i = 9; + $nom_bdd = 'tactique'; + $n=(${$nom_bdd}-1); + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $a=ceil(pow(2,$n)*2600); $b=ceil(pow(2,$n)*2600); + if (is_array($fileTec) && $tec == $i+1) { $tr=$fileTemps_t[0]+$fileTemps_t[1]-time(); $action = 'Recherche en cours, temps restant :
'; } + elseif (is_array($fileTec) && ereg(','.($i+1).',',','.implode(',', $fileTec).',')) { $tr=$fileTemps_t[0]+$fileTemps_t[1]-time(); $action = 'Recherche dans la file d\'attente'; } + elseif($bat == 7) $action = 'Le laboratoire est en cours d\'évolution'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'laboratoire_validation.php?tec='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($technolo[$i])) $template->assign_block_vars('technologie', array('TEMPS' => sec(ceil((4410*2*($tactique+1))/pow(1.25,($labo-3)))), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h), 'IMAGE' => $technoli[$i], 'NOM' => $technolo[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $technode[$i], 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($technolo[$i]), 'DESCRIPTIONE' => addslashes($technode[$i]), 'LIEN' => $lien)); + } + + // Technologie n°11 : 0/0/Spartan ; user.spartan + if ($labo >= 8 && $medecine >= 5 && $informatique >= 8) { + $i = 10; + $nom_bdd = 'spartan'; + $n=(${$nom_bdd}-1); + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $a=ceil(pow(3,$n)*5200); $b=ceil(pow(3,$n)*4250); $c=ceil(pow(3,$n)*850); + if (is_array($fileTec) && $tec == $i+1) { $tr=$fileTemps_t[0]+$fileTemps_t[1]-time(); $action = 'Recherche en cours, temps restant :
'; } + elseif (is_array($fileTec) && ereg(','.($i+1).',',','.implode(',', $fileTec).',')) { $tr=$fileTemps_t[0]+$fileTemps_t[1]-time(); $action = 'Recherche dans la file d\'attente'; } + elseif($bat == 7) $action = 'Le laboratoire est en cours d\'évolution'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'laboratoire_validation.php?tec='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($technolo[$i])) $template->assign_block_vars('technologie', array('TEMPS' => sec(ceil((5000*2*($spartan+1))/pow(1.25,($labo-8)))), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'IMAGE' => $technoli[$i], 'NOM' => $technolo[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $technode[$i], 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($technolo[$i]), 'DESCRIPTIONE' => addslashes($technode[$i]), 'LIEN' => $lien)); + } + + $CHAINE = ''; + if (!empty($fileTec[0])) { + $l = count($fileTec); + for ($i=0 ; $i<$l ; $i++) { + if ($fileTec[$i] != 'e' && $i != 0) $template->assign_block_vars('file',array('NOM' => $technolo[$fileTec[$i]-1], 'NUM' => $fileTec[$i])); + elseif ($fileTec[$i] != 'e') $template->assign_block_vars('file',array('NOM' => $technolo[$fileTec[$i]-1], 'NUM' => $fileTec[$i], 'RESTANT' => ' - ')); + else $CHAINE = '
Arrêter de produire à la chaîne'; + } + $FILETXT = ''; + if ($i == 1 && $tec_boucle == false) $CHAINE = '
Produire à la chaîne'; + } + else $FILETXT = 'Aucune recherche en attente'; + $template->assign_vars(array('RACE' => $race, 'FILETXT' => $FILETXT, 'CHAINE' => $CHAINE)); +} +else { + $template->set_filenames(array('laboratoire' => 'manque.tpl')); + $template->assign_vars( array('TEXTE' => 'Vous devez d\'abord construire un centre de recherche !')); +} +/* FIN Page laboratoire + * + */ + +/* Page ressources + * + * +$template->set_filenames(array('ressources' => 'ressources.tpl')); + +$cap = (pow(2,$silo)*100000); +$temps_ecoule = 3600; +if ($mine_m > 0) $energie_m = ceil((exp($mine_m*0.28)*10)); else $energie_m= 0; +if ($mine_c > 0) $energie_c = ceil((exp($mine_c*0.28)*10)); else $energie_c= 0; +if ($mine_h > 0) $energie_h = ceil((exp($mine_h*0.31)*10)); else $energie_h= 0; +if ($centrale_f > 0) $energie_f = ceil((($centrale_f*80+(exp($centrale_f*0.38)*11)))); else $energie_f = 0; +if ($centrale_s > 0) $energie_s = ceil((($centrale_s*20+(exp($centrale_s*0.3)*10)))); else $energie_s = 0; + +//Calcul de la consomation d'énergie +$nrj = $energie_m + $energie_c + $energie_h; + +//Calcul de la production d'énergie +$t = $energie_s * $coeff_centrale_s + $energie_f * $coeff_centrale_f; + +$coeff = $t / $nrj; + +if ($coeff < 0) $coeff = 0; +elseif ($coeff == 0) $coeff = 0; +elseif ($coeff > 1) $coeff = 1; + +//Calcul des proportions +$point = $coeff * 3; + +if ($coeff_mine_m + $coeff_mine_c + $coeff_mine_h != 0) { + $p_mine_m = $coeff_mine_m / ($coeff_mine_m + $coeff_mine_c + $coeff_mine_h); + $p_mine_c = $coeff_mine_c / ($coeff_mine_m + $coeff_mine_c + $coeff_mine_h); + $p_mine_h = $coeff_mine_h / ($coeff_mine_m + $coeff_mine_c + $coeff_mine_h); +} +else { + $p_mine_m = 0.33333333; + $p_mine_c = 0.33333333; + $p_mine_h = 0.33333333; +} + +if ($metal >= $cap) { + $prod_met=0; + $metal = $cap; +} +else { + if ($mine_m < 0) $prod_met = 0.011*$temps_ecoule; + else $prod_met = ((ceil(((($mine_m*32)+(pow(1.41,$mine_m)*exp(0.066*$mine_m)))/0.36)*$temps_ecoule)/10000)*3.7 + 0.011*$temps_ecoule)*$coeff_mine_m; +} + +if ($cristal >= $cap) { + $prod_cri=0; + $cristal = $cap; +} +else { + if ($mine_c < 0) $prod_cri = 0.0055*$temps_ecoule; + else $prod_cri = (((ceil(((($mine_c*13)+(pow(1.36,$mine_c)*exp(0.0675*$mine_c)))/0.36)*$temps_ecoule)/10000)*7) + 0.0055*$temps_ecoule)*$coeff_mine_c; +} + +if ($hydrogene >= $cap) { + $prod_hy=0; + $hydrogene = $cap; +} +else { + if ($mine_h < 0) $prod_hy = 0; + else $prod_hy = ((((floor(((($mine_h*12)+(pow(1.394,$mine_h)*exp(0.072*$mine_h)))/0.36)*$temps_ecoule)/10000)*5)))*$coeff_mine_h; + if ($mine_h == 0) $prod_hy=0; + if ($prod_hy < 0) $prod_hy = 0; +} + +if ($centrale_f > 0) $conso_h = ((ceil((($centrale_f*5+(exp($centrale_f*0.3)*10)))/0.36)/10000)*$temps_ecoule)*$coeff_energie_f; +else $conso_h = 0; +$prod_mineh = $prod_hy; +$prod_hysv = $prod_hy; +$prod_hy -= $conso_h; + +if ($hydrogene+$prod_hy < 0) { + $prod_hy = $prod_hysv; + $conso_h = 0; + $coeff_energie_f = 0; +} + +$a=$metal+$prod_met; +$b=$cristal+$prod_cri; +$w = $prod_hy; +$c = $hydrogene+$prod_hy; +$u = ($energie_s*$coeff_energie_s+$energie_f*$coeff_energie_f) - ($energie_m+$energie_c+$energie_h); +$energie_f = $energie_f*$coeff_energie_f; + + + $template->assign_block_vars('batiment', array('NOM' => $batiment[0], 'NIVEAU' => $mine_m, 'COEFF' => (floor($coeff_mine_m*1000)/10).'%', 'CMETAL' => '#00FF00', 'CCRISTAL' => '#00FF00', 'CHYDROGENE' => '#00FF00', 'CENERGIE' => '#FF0000', 'PMETAL' => separerNombres(floor($prod_met)), 'PCRISTAL' => '', 'PHYDROGENE' => '', 'PENERGIE' => '-'.separerNombres(floor(abs($energie_m))))); + $template->assign_block_vars('batiment', array('NOM' => $batiment[1], 'NIVEAU' => $mine_c, 'COEFF' => (floor($coeff_mine_c*1000)/10).'%', 'CMETAL' => '#00FF00', 'CCRISTAL' => '#00FF00', 'CHYDROGENE' => '#00FF00', 'CENERGIE' => '#FF0000', 'PMETAL' => '', 'PCRISTAL' => separerNombres(floor($prod_cri)), 'PHYDROGENE' => '', 'PENERGIE' => '-'.separerNombres(floor(abs($energie_c))))); + if ($mine_h > 0) $template->assign_block_vars('batiment', array('NOM' => $batiment[2], 'NIVEAU' => $mine_h, 'COEFF' => (floor($coeff_mine_h*1000)/10).'%', 'CMETAL' => '#00FF00', 'CCRISTAL' => '#00FF00', 'CHYDROGENE' => '#00FF00', 'CENERGIE' => '#FF0000', 'PMETAL' => '', 'PCRISTAL' => '', 'PHYDROGENE' => separerNombres(floor($prod_mineh)), 'PENERGIE' => '-'.separerNombres(floor(abs($energie_h))))); + if ($centrale_s > 0) $template->assign_block_vars('batiment', array('NOM' => $batiment[3], 'NIVEAU' => $centrale_s, 'COEFF' => ($coeff_energie_s*100).'%', 'CMETAL' => '#FF0000', 'CCRISTAL' => '#FF0000', 'CHYDROGENE' => '#FF0000', 'CENERGIE' => '#00FF00', 'PMETAL' => '', 'PCRISTAL' => '', 'PHYDROGENE' => '', 'PENERGIE' => separerNombres(floor(abs($energie_s))))); + if ($centrale_f > 0) $template->assign_block_vars('batiment', array('NOM' => $batiment[4], 'NIVEAU' => $centrale_f, 'COEFF' => ($coeff_energie_f*100).'%', 'CMETAL' => '#FF0000', 'CCRISTAL' => '#FF0000', 'CHYDROGENE' => '#FF0000', 'CENERGIE' => '#00FF00', 'PMETAL' => '', 'PCRISTAL' => '', 'PHYDROGENE' => separerNombres(floor($conso_h*-1)), 'PENERGIE' => floor(abs($energie_f)))); + $template->assign_block_vars('batiment', array('NOM' => 'Capacité des dépôts', 'NIVEAU' => $silo, 'COEFF' => '', 'CMETAL' => '#00FF00', 'CCRISTAL' => '#00FF00', 'CHYDROGENE' => '#00FF00', 'CENERGIE' => '#FF0000', 'PMETAL' => separerNombres($cap), 'PCRISTAL' => separerNombres($cap), 'PHYDROGENE' => separerNombres($cap), 'PENERGIE' => '')); + if ($u < 0 && $prod_hy < 0) $template->assign_block_vars('batiment', array('NOM' => 'Total', 'NIVEAU' => '', 'COEFF' => '', 'CMETAL' => '#00FF00', 'CCRISTAL' => '#00FF00', 'CHYDROGENE' => '#FF0000', 'CENERGIE' => '#FF0000', 'PMETAL' => separerNombres(floor($prod_met)), 'PCRISTAL' => separerNombres(floor($prod_cri)), 'PHYDROGENE' => separerNombres(floor($w)), 'PENERGIE' => floor($u))); + elseif ($prod_hy < 0) $template->assign_block_vars('batiment', array('NOM' => 'Total', 'NIVEAU' => '', 'COEFF' => '', 'CMETAL' => '#00FF00', 'CCRISTAL' => '#00FF00', 'CHYDROGENE' => '#FF0000', 'CENERGIE' => '#00FF00', 'PMETAL' => separerNombres(floor($prod_met)), 'PCRISTAL' => separerNombres(floor($prod_cri)), 'PHYDROGENE' => separerNombres(floor($w)), 'PENERGIE' => floor($u))); + elseif ($u < 0) $template->assign_block_vars('batiment', array('NOM' => 'Total', 'NIVEAU' => '', 'COEFF' => '', 'CMETAL' => '#00FF00', 'CCRISTAL' => '#00FF00', 'CHYDROGENE' => '#00FF00', 'CENERGIE' => '#FF0000', 'PMETAL' => separerNombres(floor($prod_met)), 'PCRISTAL' => separerNombres(floor($prod_cri)), 'PHYDROGENE' => separerNombres(floor($w)), 'PENERGIE' => separerNombres(floor($u)))); + else $template->assign_block_vars('batiment', array('NOM' => 'Total', 'NIVEAU' => '', 'COEFF' => '', 'CMETAL' => '#00FF00', 'CCRISTAL' => '#00FF00', 'CHYDROGENE' => '#00FF00', 'CENERGIE' => '#00FF00', 'PMETAL' => ''.separerNombres(floor($prod_met)).'', 'PCRISTAL' => ''.separerNombres(floor($prod_cri)).'', 'PHYDROGENE' => ''.separerNombres(floor($w)).'', 'PENERGIE' => ''.separerNombres(floor($u)).'')); +/* FIN Page ressources + * + */ + +/* Page Flotte + * + * +$template->set_filenames(array('flotte' => 'flotte1.tpl')); +$ERREUR = ''; $FLOTTESEC = ''; +if (isset($_GET['err'])) { + if ($_GET['err'] == 'ok') $ERREUR = '
Votre flotte a correctement été envoyé

'; + elseif ($_GET['err'] == 0) $ERREUR = '
Vous n\'avez pas assez de slots disponible pour lancer cette flotte

'; + elseif ($_GET['err'] == 1) $ERREUR = '
Vous ne pouvez pas envoyer une flotte sur votre planète

'; + elseif ($_GET['err'] == 2) $ERREUR = '
Vous n\'avez pas assez de vaisseaux.

'; + elseif ($_GET['err'] == 3) $ERREUR = '
Vous n\'avez pas suffisament d\'hydrogène pour envoyer cette flotte.

'; + elseif ($_GET['err'] == 4) $ERREUR = '
Vous n\'avez pas suffisament de ressources dans vos réserve pour les transporter.

'; + elseif ($_GET['err'] == 5) $ERREUR = '
Vous devez au moins sélectionner un vaisseaux pour former une flotte

'; + elseif ($_GET['err'] == 6) $ERREUR = '
Vous n\'avez pas nommé votre flotte

'; + elseif ($_GET['err'] == 7) $ERREUR = '
Vous ne pouvez pas envoyer vos vaisseaux par ici dans la version béta ;-)

'; + elseif ($_GET['err'] == 8) $ERREUR = '
Les réserves de vos vaisseaux sont trop remplis

'; + elseif ($_GET['err'] == 9) $ERREUR = '
Vous ne pouvez pas aller sur cette planète

'; + elseif ($_GET['err'] == 10) $ERREUR = '
Aucune mission sélectionnée

'; + elseif (strtolower($_GET['err']) == 'a1') $ERREUR = '
Vous ne pouvez pas vous attaquer !

'; + elseif (strtolower($_GET['err']) == 'c1') $ERREUR = '
Vous ne pouvez pas coloniser une planète habitée !

'; + elseif (strtolower($_GET['err']) == 'c2') $ERREUR = '
Vous ne pouvez pas coloniser plus de planète, vus avez atteint le maximum !

'; + elseif (strtolower($_GET['err']) == 'e1') $ERREUR = '
Vous ne pouvez pas vous espionner !

'; + elseif (strtolower($_GET['err']) == 's1') $ERREUR = '
Vous ne pouvez pas stationner sur une planète ne vous appartenant pas !

'; +} + +$req = mysql_query("SELECT * FROM flottes WHERE `id_user` = '$id'"); +if (mysql_num_rows($req) > 0) { + $FLOTTESEC = ''; + while ($resultat = mysql_fetch_array($req)) { + $FLOTTESEC .= ''; + } + $FLOTTESEC .= '
Flottes en action
NomMissionNb. vaisseauxDestinationHeure d\'arrivéeRetourHeure de retour
'.$resultat['nom'].''.txtmission($resultat['mission']).''.$resultat['nb_vais'].''.$resultat['end_galaxie'].':'.$resultat['end_ss'].':'.$resultat['end_position'].''.date('d/m H:i:s',$resultat['start_time']+$resultat['end_time']).''.$resultat['start_galaxie'].':'.$resultat['start_ss'].':'.$resultat['start_position'].''.date('d/m H:i:s',$resultat['start_time']+2*$resultat['end_time']).'

'; +} + +$retour = mysql_query("SELECT COUNT(*) AS nbre_entrees FROM bug WHERE pseudo='$pseudo'"); +$donnees = mysql_fetch_array($retour); +$nbr = $donnees['nbre_entrees']; + +$trez = $informatique + 1; + +for ($i=1 ; $i<=12 ; $i++) { + if (${'vaisseau_'.$i} > 0 && $i != 11) $template->assign_block_vars('vaisseau',array('NOM' => $nomvaisa[$i-1], 'NB' => ${'vaisseau_'.$i}, 'NUM' => $i)); +} + + if ($nbr < $trez) $ACTION = ''; + else $ACTION = 'Nombre de flottes maximum simultaniées atteint'; + +$template->assign_vars(array('ERREUR' => $ERREUR, 'FLOTTESEC' => $FLOTTESEC, 'NBFLOTTE' => $nbr, 'NBFLOTTEMAX' => $trez, 'ACTION' => $ACTION)); +/* FIN Page Flotte + * + */ + +/* Page Flotte => Création + * + * +$_POST['vaisseau1'] = 1; + +$template->set_filenames(array('flotte' => 'flotte2.tpl')); +$_SESSION['FL_time'] = time(); + +$nombreVaisseau = 0; +for ($i=1 ; $i<=12 ; $i++) { + if (!isset($_POST['vaisseau'.$i]) || !is_numeric($_POST['vaisseau'.$i]) || $_POST['vaisseau'.$i] != abs(floor($_POST['vaisseau'.$i]))) $_POST['vaisseau'.$i] = 0; + if ($_POST['vaisseau'.$i] >= 0 && $i != 11) { + $template->assign_block_vars('vaisseau',array('NB' => $_POST['vaisseau'.$i], 'NUM' => $i)); + $_SESSION['FL_vaisseau'.$i] = $_POST['vaisseau'.$i]; + $nombreVaisseau += $_POST['vaisseau'.$i]; + } +} + +// On vérifie que l'utilisateur ait bien envoyé au moins un vaisseau +if ($nombreVaisseau <= 0) { + header('Location: flotte.php?err=5'); + exit; +} +$_SESSION['FL_nbvais'] = $nombreVaisseau; + +// Définition des paramètres de la flotte +$AvaisType = ''; $AvaisVitesseC = ''; $AvaisVitesseL = ''; $AvaisPrepC = ''; $AvaisPrepL = ''; $AvaisChauffe = ''; $AvaisContenu = 0; +for ($i=1 ; $i<=12 ; $i++) { + for ($j = 1; $j <= $_POST['vaisseau'.$i]; $j++) { + $AvaisType .= ($i).' '; + $AvaisVitesseC .= $nomvais_dc[$i].' '; + $AvaisVitesseL .= $nomvais_dl[$i].' '; + $AvaisContenu += $nomvais_rs[$i].' '; + $AvaisPrepC .= $nomvais_pdc[$i].' '; + $AvaisPrepL .= $nomvais_pdl[$i].' '; + $AvaisChauffe .= $nomvais_cdl[$i].' '; + } +} +$AvaisType = split(' ', trim($AvaisType)); $AvaisVitesseC = split(' ', trim($AvaisVitesseC)); $AvaisVitesseL = split(' ', trim($AvaisVitesseL)); $AvaisContenu = split(' ', trim($AvaisContenu)); $AvaisPrepC = split(' ', trim($AvaisPrepC)); $AvaisPrepL = split(' ', trim($AvaisPrepL)); $AvaisChauffe = split(' ', trim($AvaisChauffe)); + +if (min($AvaisVitesseL) != 0) { + $_SESSION['FL_vitesse'] = min($AvaisVitesseL); + $_SESSION['FL_preparation'] = min($AvaisPrepL); + $_SESSION['FL_chauffe'] = min($AvaisChauffe); +} +else { + $_SESSION['FL_vitesse'] = min($AvaisVitesseC); + $_SESSION['FL_preparation'] = min($AvaisPrepC); + $_SESSION['FL_chauffe'] = 0; +} + +/* FIN Page Création de flottes + * + */ + +/* Page Options + * + * +$template->set_filenames(array('options' => 'options.tpl')); + +$template->assign_vars(array('MAIL' => $mail)); +/* FIN Page Options + * + */ + +/* Page Messagerie + * + * +$template->set_filenames(array('messagerie' => 'messagerie_accueil.tpl')); + +$req = mysql_query("SELECT * FROM mail WHERE `destinataire` = '$pseudo' AND `expediteur` != '' ORDER BY temps DESC"); +$Nmes=true; +while($resultat = mysql_fetch_array($req)) { + $Nmes = false; + $template->assign_block_vars('messages',array('ID' => $resultat['id'], 'EXPEDITEUR' => $resultat['expediteur'], 'SUJET' => $resultat['sujet'], 'EXTRAIT' => substr($resultat['contenu'], 0, 50).'...', 'DATEHEURE' => dateFR(date('/D d M Y/Hi/',$resultat['temps'])))); +} +if ($Nmes) $template->assign_var('MESS','Aucun message privé actuellement'); + + +$req = mysql_query("SELECT * FROM mail WHERE `destinataire` = '$pseudo' AND `expediteur` = '' ORDER BY temps DESC"); +$Nmes=true; +while($resultat = mysql_fetch_array($req)) { + $Nmes = false; + $template->assign_block_vars('rapports',array('ID' => $resultat['id'], 'SUJET' => $resultat['sujet'], 'EXTRAIT' => substr($resultat['contenu'], 0, 50).'...', 'DATEHEURE' => dateFR(date('/D d M Y/Hi/',$resultat['temps'])))); +} +if ($Nmes) $template->assign_var('RAPO','Aucun rapport actuellement'); +/* FIN Page Messagerie + * + */ + +/* Page Carte spatiale + * + */ +$template->set_filenames(array('carte' => 'carte.tpl')); + +if (isset($_GET['galaxy'])) $g = floor($_GET['galaxy']); else $g = $_SESSION['galaxy']; +if ($g < 1) $g = 1; +if ($g > 15) $g = 1; + +if (isset($_GET['ss'])) $s=floor($_GET['ss']); else $s=$_SESSION['ss']; +if ($s < 1) $s = 1; +if ($s > 300) $s = 300; + +if ($s == 1 && $g > 1) { + $Gmu = $g - 1; + $Smu = 300; +} +elseif ($s == 1) { + $Gmu = 15; + $Smu = 300; +} +else { + $Gmu = $g; + $Smu = $s - 1; +} +if ($s == 300) { + $Gpu = $g + 1; + $Spu = 1; +} +else { + $Gpu = $g; + $Spu = $s + 1; +} + +$template->assign_vars(array('GALAXIE' => $g, 'SYSTEME' => $s, 'GALAXIEM' => $Gmu, 'SYSTEMEM' => $Smu, 'GALAXIEP' => $Gpu, 'SYSTEMEP' => $Spu)); + +for ($i=1; $i<=12; $i++) { + $resultat = mysql_query("SELECT * FROM planete WHERE galaxie='$g' AND ss='$s' AND position='$i'"); + if(mysql_num_rows($resultat)>=1) { + $x = mysql_query("SELECT * FROM planete WHERE galaxie='$g' AND ss='$s'AND position='$i'"); + $d = mysql_fetch_array($x); + + $id_user = $d['id_user']; + $y = mysql_query("SELECT race FROM user WHERE id='$id_user'"); + $e = mysql_fetch_array($y); + if ($e['race'] == 'covenant') $ra='(c)'; + elseif (md5($e['race'] && $auth_level >= 6) == '34c19b21bd4a3dda389e767d32fe9779') $ra='(f)'; + else $ra='(h)'; + + $template->assign_block_vars('planete',array('I' => $i, 'NOM' => $d['nom_planete'], 'DEB_MET' => $d['debris_met'], 'DEB_CRI' => $d['debris_cri'], 'RACE' => $ra, 'JOUEUR' => trouvNom($d['id_user']), 'MAIL' => 'Envoyer un message privé')); + } + else $template->assign_block_vars('planete',array('I' => $i)); +} +/* FIN Page Carte spatiale + * + */ + + + +$result = mysql_query("SELECT * FROM version ORDER BY temps DESC"); +$data = mysql_fetch_array($result); +$version = $data['version']; + +$template->set_filenames(array('base' => 'base.tpl')); +$template->assign_vars(array('PUB' => $PUB, 'VERSION' => $version, 'RES_IMAGE' => $RES_IMAGE, 'NOM_METAL' => strtolower($NOM_METAL), 'NOM_CRISTAL' => strtolower($NOM_CRISTAL), 'NOM_HYDROGENE' => strtolower($NOM_HYDROGENE), 'NOM_ENERGIE' => strtolower($NOM_ENERGIE), 'RES_METAL' => $RES_METAL, 'RES_CRISTAL' => $RES_CRISTAL, 'RES_HYDROGENE' => $RES_HYDROGENE, 'RES_ENERGIE' => $RES_ENERGIE, 'DATEHEURET' => date('/dm/ H:i'), 'COUNTHUMAINS' => '7500', 'COUNTCOVENANTS' => '4500', 'PSEUDO' => $pseudo)); +for ($i=0 ; $iassign_block_vars('planetes',array('RES_VALUE' => $Aplan_value[$i], 'RES_MORE' => $Aplan_more[$i], 'RES_IMG' => $Aplan_img[$i], 'RES_NOM' => $Aplan_nom[$i], 'RES_REF' => $Aplan_ref[$i])); +} +//$template->assign_var_from_handle('CONTENU', 'depart'); +//$template->assign_var_from_handle('CONTENU', 'batiments'); +//$template->assign_var_from_handle('CONTENU', 'version'); +//$template->assign_var_from_handle('CONTENU', 'prochainement'); +//$template->assign_var_from_handle('CONTENU', 'chantier_spatial'); +//$template->assign_var_from_handle('CONTENU', 'defense'); +//$template->assign_var_from_handle('CONTENU', 'rename'); +//$template->assign_var_from_handle('CONTENU', 'laboratoire'); +//$template->assign_var_from_handle('CONTENU', 'ressources'); +//$template->assign_var_from_handle('CONTENU', 'flotte'); +//$template->assign_var_from_handle('CONTENU', 'options'); +$template->assign_var_from_handle('CONTENU', 'carte'); +//$template->assign_var_from_handle('CONTENU', 'messagerie'); +$template->pparse('base'); +?> \ No newline at end of file diff --git a/pages/batiment.php b/pages/batiment.php index 8a18620..6265d6a 100644 --- a/pages/batiment.php +++ b/pages/batiment.php @@ -7,46 +7,41 @@ $ss=$_SESSION['ss']; $pos=$_SESSION['pos']; $_SESSION['dernPage'] = 'batiment.php'; -require_once 'bdd.php'; -require_once('../securite.php'); -require_once 'ressourcetem.php'; -require_once 'batiment_ajout.php'; -require_once 'noms.php'; +include_once('common.php'); require('../template.php'); $template = new Template('../templates/'.$templates); function verification_des_ress($num, $fer, $cristal, $ro, $need_fer, $need_cristal, $need_ro) { - if ($fer >= $need_fer && $cristal >= $need_cristal && $ro >= $need_ro) return 'Construire'; - else return 'Construire'; + if ($fer >= $need_fer && $cristal >= $need_cristal && $ro >= $need_ro) return 'Construire'; + else return 'Construire'; } function ressources($fer, $cristal, $ro, $need_fer, $need_cristal, $need_ro) { - require 'noms.php'; + require 'includes/noms.php'; $return = ''; if ($need_fer > 0) { if ($fer <= $need_fer) { $z=floor($fer)-$need_fer; - $return .= ''.$ressourc[0].' : '.$need_fer.' '; + $return .= ''.$ressourc[0].' : '.separerNombres($need_fer).' '; } - else $return .= $ressourc[0].' : '.$need_fer.' '; + else $return .= $ressourc[0].' : '.separerNombres($need_fer).' '; } if ($need_cristal > 0) { if ($cristal <= $need_cristal) { $z=floor($cristal)-$need_cristal; - $return .= ''.$ressourc[1].' : '.$need_cristal.' '; + $return .= ''.$ressourc[1].' : '.separerNombres($need_cristal).' '; } - else $return .= $ressourc[1].' : '.$need_cristal.' '; + else $return .= $ressourc[1].' : '.separerNombres($need_cristal).' '; } if ($need_ro > 0) { if ($ro <= $need_ro) { $z=floor($ro)-$need_ro; - $return .= ''.$ressourc[2].' : '.$need_ro.''; + $return .= ''.$ressourc[2].' : '.separerNombres($need_ro).''; } - else $return .= $ressourc[2].' : '.$need_ro.''; + else $return .= $ressourc[2].' : '.separerNombres($need_ro).''; } return $return; } - function sec($time) { $output = ''; $tab = array ('jour' => '86400', 'heure' => '3600', 'minute' => '60', 'seconde' => '1'); @@ -87,25 +82,173 @@ function ress_tem($fer, $cristal, $ro, $need_fer, $need_cristal, $need_ro, $mine echo ceil($tem); } -$case = $cases - ($mine_m + $mine_c + $mine_h + $centrale_s + $centrale_f + $radar + $labo + $chantier_terrestre + $chantier_spatial + $caserne + $silo); +$template->set_filenames(array('batiments' => 'batiments.tpl')); if (!isset($_GET['err'])) $_GET['err'] = ''; $ERREUR = ''; if ($_GET['err'] == 1) $ERREUR = '
Ce batiment est déjà en cours de construction, vous ne pouvez pas le rajouter dans la file d\'attente

'; elseif ($_GET['err'] == 2) $ERREUR = '
La production à la chaîne a été arrêtée

'; - $template->set_filenames(array('ressourcestpl' => 'ressources.tpl')); - $template->assign_vars( array('RES_IMAGE' => $RES_IMAGE, 'NOM_METAL' => $NOM_METAL, 'NOM_CRISTAL' => $NOM_CRISTAL, 'NOM_HYDROGENE' => $NOM_HYDROGENE, 'NOM_ENERGIE' => $NOM_ENERGIE, 'RES_METAL' => $RES_METAL, 'RES_CRISTAL' => $RES_CRISTAL, 'RES_HYDROGENE' => $RES_HYDROGENE, 'RES_ENERGIE' => $RES_ENERGIE, 'ERREUR' => $ERREUR, 'HEADER' => $HEADER, 'PUB' => $PUB)); - for ($i=0 ; $iassign_block_vars('planetes',array('RES_VALUE' => $Aplan_value[$i], 'RES_MORE' => $Aplan_more[$i], 'RES_REF' => $Aplan_ref[$i])); +$tr = 0; +$a=0; $b=0; $c=0; + + // Batiment n°1 : Purificateur de métal/Générateur de Métal/Usine de métallurgie ; planete.mine_m + $i = 0; + $nom_bdd = 'mine_m'; + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=ceil(exp(0.4*$mine_m)*190); $b=ceil(exp(0.4*$mine_m)*90); + if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } + elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; + elseif ($case <= 0) $action = 'Planète pleine'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); } + if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(1.7,$mine_m)*120)/(pow(1.23,$centre_info)+0.0025*$ingenieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i]))); + + // Batiment n°2 : Purificateur de cristal/Générateur de Cristal/Usine de cristal ; planete.mine_m + $i = 1; + $nom_bdd = 'mine_c'; + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=ceil(exp(0.43*$mine_c)*205); $b=ceil(exp(0.43*$mine_c)*110); + if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } + elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; + elseif ($case <= 0) $action = 'Planète pleine'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); } + if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(1.72,$mine_c)*160)/(pow(1.23,$centre_info)+0.0025*$ingenieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i]))); + + // Batiment n°3 : Ionisateur/Générateur d'Hydrogène/Synchronisateur d'hydrogène ; planete.mine_h + $i = 2; + $nom_bdd = 'mine_h'; + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=ceil(exp(0.445*$mine_h)*235); $b=ceil(exp(0.445*$mine_h)*150); + if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } + elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; + elseif ($case <= 0) $action = 'Planète pleine'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); } + if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(1.75,$mine_h)*180)/(pow(1.23,$centre_info)+0.0025*$ingenieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i]))); + + // Batiment n°4 : Centrale solaire/Générateur d'Energie/Centrale solaire ; planete.centrale_s + $i = 3; + $nom_bdd = 'centrale_s'; + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=ceil(exp(0.442*$centrale_s)*165); $b=ceil(exp(0.442*$centrale_s)*99); + if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } + elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; + elseif ($case <= 0) $action = 'Planète pleine'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); } + if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(1.68,$centrale_s)*190)/(pow(1.23,$centre_info)+0.0025*$ingenieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i]))); + + // Batiment n°5 : Centrale de fusion/0/Centrale énergétique ; planete.centrale_f + if ($centrale_s >= 12 && $energie_t >= 5) { + $i = 4; + $nom_bdd = 'centrale_f'; + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=ceil(pow(1.8,$centrale_f)*300); $b=ceil(pow(1.82,$centrale_f)*230); + if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } + elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; + elseif ($case <= 0) $action = 'Planète pleine'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); } + if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(1.8,$centrale_f)*300)/(pow(1.23,$centre_info)+0.0025*$ingenieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i]))); + } + + // Batiment n°6 : Oeil des prophètes/0/Base radar ; planete.centrale_f + if ($detection >= 1) { + $i = 5; + $nom_bdd = 'radar'; + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=ceil(pow(2,$radar)*750); $b=ceil(pow(2,$radar)*500); $c = 0; + if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } + elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; + elseif ($case <= 0) $action = 'Planète pleine'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); } + if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(2,$radar)*720)/(pow(1.23,$centre_info)+0.0025*$ingenieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i]))); + } + + // Batiment n°7 : Centre de recherches/Centre de recherches/Centre de recherches ; planete.labo + $i = 6; + $nom_bdd = 'labo'; + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=ceil(pow(2,$labo)*200); $b=ceil(pow(2,$labo)*150); $c = 0; + if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } + elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; + elseif ($case <= 0) $action = 'Planète pleine'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); } + if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(2,$labo)*720)/(pow(1.23,$centre_info)+0.0025*$ingenieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i]))); + + // Batiment n°8 : Chantier terrestre/Chantier terrestre/Chantier terrestre ; planete.chantier_terrestre + $i = 7; + $nom_bdd = 'chantier_terrestre'; + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=ceil(pow(2,$chantier_terrestre)*520); $b=ceil(pow(2,$chantier_terrestre)*380); $c = 0; + if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } + elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; + elseif ($case <= 0) $action = 'Planète pleine'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); } + if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(2,$chantier_terrestre)*420)/(pow(1.23,$centre_info)+0.0025*$ingenieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i]))); + + // Batiment n°9 : Chantier spatial/Chantier spatial/Chantier spatial ; planete.chantier_spatial + if ($chantier_terrestre >= 2) { + $i = 8; + $nom_bdd = 'chantier_spatial'; + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=ceil(pow(2,$chantier_spatial)*600); $b=ceil(pow(2,$chantier_spatial)*450); $c = 0; + if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } + elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; + elseif ($case <= 0) $action = 'Planète pleine'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); } + if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(2,$chantier_spatial)*600)/(pow(1.23,$centre_info)+0.0025*$ingenieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i]))); + } + + // Batiment n°10 : Caserne/0/Ecole militaire ; planete.caserne + $i = 9; + $nom_bdd = 'caserne'; + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=ceil(pow(2,$caserne)*200); $b=ceil(pow(2,$caserne)*100); $c = 0; + if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } + elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; + elseif ($case <= 0) $action = 'Planète pleine'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); } + if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(2,$caserne)*300)/(pow(1.23,$centre_info)+0.0025*$ingenieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i]))); + + // Batiment n°11 : Entrepôt/Entrepôt/Silo de stockage ; planete.silo + $i = 10; + $nom_bdd = 'silo'; + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=ceil(pow(2,$silo)*400); $b=ceil(pow(2,$silo)*260); $c = 0; + if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } + elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; + elseif ($case <= 0) $action = 'Planète pleine'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); } + if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(2,$silo)*1200)/(pow(1.23,$centre_info)+0.0025*$ingenieur))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i]))); + + // Batiment n°12 : Centrale informatique/0/Centrale informatique ; planete.centre_info + if ($informatique >= 2) { + $i = 11; + $nom_bdd = 'centre_info'; + if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; + $n=(${$nom_bdd}-1); $a=ceil(pow(1.7,$centre_info)*600); $b=ceil(pow(1.7,$centre_info)*420); $c=ceil(pow(1.7,$centre_info)*100); + if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } + elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; + elseif ($case <= 0) $action = 'Planète pleine'; + else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); + if ($action == 'Bâtiment dans la file d\'attente' || $action == 'Construction en cours, temps restant :
') { $ACT = 'stop'; $lien = 'annul_bat.php?bat='.($i+1); } elseif ($action == 'Construire') $ACT = 'none'; else { $ACT = ''; $lien = 'batiment_validation.php?bat='.($i+1); } + if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'LIEN' => $lien, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'DESCRIPTIONE' => addslashes($batimede[$i]), 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(1.9,$centre_info)*800)/((0.0025*$ingenieur)+1))), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($batiment[$i]))); } - $template->set_filenames(array('bati' => 'batiments.tpl')); - $template->assign_var_from_handle('RESSOURCES', 'ressourcestpl'); $CHAINE = ''; if (!empty($fileBat[0])) { for ($i=0 ; $iassign_block_vars('file',array('NOM' => $batiment[$fileBat[$i]-1], 'NUM' => $fileBat[$i])); + if ($fileBat[$i] != 'e' && $i != 0) $template->assign_block_vars('file',array('NOM' => $batiment[$fileBat[$i]-1], 'NUM' => $fileBat[$i])); + elseif ($fileBat[$i] != 'e') $template->assign_block_vars('file',array('NOM' => $batiment[$fileBat[$i]-1], 'NUM' => $fileBat[$i], 'RESTANT' => ' - ')); else $CHAINE = '
Arrêter de produire à la chaîne'; } $FILETXT = ''; @@ -114,147 +257,17 @@ $case = $cases - ($mine_m + $mine_c + $mine_h + $centrale_s + $centrale_f + $rad else $FILETXT = 'Aucun batiment en attente'; $template->assign_vars(array('RACE' => $race, 'FILETXT' => $FILETXT, 'CHAINE' => $CHAINE)); -$a=0; $b=0; $c=0; +require('../connectBDD.php'); +$result = mysql_query("SELECT * FROM version ORDER BY temps DESC"); +$data = mysql_fetch_array($result); +$version = $data['version']; +mysql_close(); - // Batiment n°1 : Purificateur de métal/Générateur de Métal/Usine de métallurgie ; planete.mine_m - $i = 0; - $nom_bdd = 'mine_m'; - if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; - $n=(${$nom_bdd}-1); $a=ceil(exp(0.4*$mine_m)*190); $b=ceil(exp(0.4*$mine_m)*90); - if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } - elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; - elseif ($case <= 0) $action = 'Planète pleine'; - else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); - if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(1.7,$mine_m)*120)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))), 'ACTION' => $action)); - - // Batiment n°2 : Purificateur de cristal/Générateur de Cristal/Usine de cristal ; planete.mine_m - $i = 1; - $nom_bdd = 'mine_c'; - if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; - $n=(${$nom_bdd}-1); $a=ceil(exp(0.43*$mine_c)*205); $b=ceil(exp(0.43*$mine_c)*110); - if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } - elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; - elseif ($case <= 0) $action = 'Planète pleine'; - else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); - if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(1.72,$mine_c)*160)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))), 'ACTION' => $action)); - - // Batiment n°3 : Ionisateur/Générateur d'Hydrogène/Synchronisateur d'hydrogène ; planete.mine_h - $i = 2; - $nom_bdd = 'mine_h'; - if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; - $n=(${$nom_bdd}-1); $a=ceil(exp(0.445*$mine_h)*235); $b=ceil(exp(0.445*$mine_h)*150); - if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } - elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; - elseif ($case <= 0) $action = 'Planète pleine'; - else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); - if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(1.75,$mine_h)*180)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))), 'ACTION' => $action)); - - // Batiment n°4 : Centrale solaire/Générateur d'Energie/Centrale solaire ; planete.centrale_s - $i = 3; - $nom_bdd = 'centrale_s'; - if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; - $n=(${$nom_bdd}-1); $a=ceil(exp(0.442*$centrale_s)*165); $b=ceil(exp(0.442*$centrale_s)*99); - if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } - elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; - elseif ($case <= 0) $action = 'Planète pleine'; - else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); - if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(1.68,$centrale_s)*190)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))), 'ACTION' => $action)); - - // Batiment n°5 : Centrale de fusion/0/Centrale énergétique ; planete.centrale_f - if ($centrale_s >= 12 && $energie_t >= 5) { - $i = 4; - $nom_bdd = 'centrale_f'; - if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; - $n=(${$nom_bdd}-1); $a=ceil(pow(1.8,$centrale_f)*300); $b=ceil(pow(1.82,$centrale_f)*230); - if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } - elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; - elseif ($case <= 0) $action = 'Planète pleine'; - else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); - if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(1.8,$centrale_f)*300)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))), 'ACTION' => $action)); - } - - // Batiment n°6 : Oeil des prophètes/0/Base radar ; planete.centrale_f - if ($detection >= 1) { - $i = 5; - $nom_bdd = 'radar'; - if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; - $n=(${$nom_bdd}-1); $a=ceil(pow(2,$radar)*750); $b=ceil(pow(2,$radar)*500); $c=ceil(pow(2,$radar)*50); - if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } - elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; - elseif ($case <= 0) $action = 'Planète pleine'; - else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); - if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(2,$radar)*720)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))), 'ACTION' => $action)); - } - - // Batiment n°7 : Centre de recherches/Centre de recherches/Centre de recherches ; planete.labo - $i = 6; - $nom_bdd = 'labo'; - if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; - $n=(${$nom_bdd}-1); $a=ceil(pow(2,$labo)*200); $b=ceil(pow(2,$labo)*150); - if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } - elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; - elseif ($case <= 0) $action = 'Planète pleine'; - else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); - if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(2,$labo)*720)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))), 'ACTION' => $action)); - - // Batiment n°8 : Chantier terrestre/Chantier terrestre/Chantier terrestre ; planete.chantier_terrestre - $i = 7; - $nom_bdd = 'chantier_terrestre'; - if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; - $n=(${$nom_bdd}-1); $a=ceil(pow(2,$chantier_terrestre)*520); $b=ceil(pow(2,$chantier_terrestre)*380); - if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } - elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; - elseif ($case <= 0) $action = 'Planète pleine'; - else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); - if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(2,$chantier_terrestre)*420)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))), 'ACTION' => $action)); - - // Batiment n°9 : Chantier spatial/Chantier spatial/Chantier spatial ; planete.chantier_spatial - if ($chantier_terrestre >= 2) { - $i = 8; - $nom_bdd = 'chantier_spatial'; - if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; - $n=(${$nom_bdd}-1); $a=ceil(pow(2,$chantier_spatial)*600); $b=ceil(pow(2,$chantier_spatial)*450); - if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } - elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; - elseif ($case <= 0) $action = 'Planète pleine'; - else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); - if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(2,$chantier_spatial)*600)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))), 'ACTION' => $action)); - } - - // Batiment n°10 : Caserne/0/Ecole militaire ; planete.caserne - $i = 9; - $nom_bdd = 'caserne'; - if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; - $n=(${$nom_bdd}-1); $a=ceil(pow(2,$caserne)*200); $b=ceil(pow(2,$caserne)*100); - if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } - elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; - elseif ($case <= 0) $action = 'Planète pleine'; - else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); - if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(2,$caserne)*300)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))), 'ACTION' => $action)); - - // Batiment n°11 : Entrepôt/Entrepôt/Silo de stockage ; planete.silo - $i = 10; - $nom_bdd = 'silo'; - if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; - $n=(${$nom_bdd}-1); $a=ceil(pow(2,$silo)*400); $b=ceil(pow(2,$silo)*260); - if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } - elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; - elseif ($case <= 0) $action = 'Planète pleine'; - else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); - if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(2,$silo)*1200)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))), 'ACTION' => $action)); - - // Batiment n°12 : Centrale informatique/0/Centrale informatique ; planete.centre_info - if ($informatique >= 2) { - $i = 11; - $nom_bdd = 'centre_info'; - if (${$nom_bdd} > 0) $niveau = '(Niveau '.${$nom_bdd}.')'; else $niveau = ''; - $n=(${$nom_bdd}-1); $a=ceil(pow(1.7,$centre_info)*600); $b=ceil(pow(1.7,$centre_info)*420); $c=ceil(pow(1.7,$centre_info)*100); - if (is_array($fileBat) && $bat == $i+1) { $tr=$fileTemps_b[0]+$fileTemps_b[1]-time(); $action = 'Construction en cours, temps restant :
'; } - elseif (is_array($fileBat) && ereg(','.($i+1).',',','.implode(',', $fileBat).',')) $action = 'Bâtiment dans la file d\'attente'; - elseif ($case <= 0) $action = 'Planète pleine'; - else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); - if (!empty($batimeni[$i])) $template->assign_block_vars('batiment', array('IMAGE' => $batimeni[$i], 'NOM' => $batiment[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $batimede[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec(ceil((pow(1.9,$centre_info)*800)/((0.0025*$ingeneieur)+1))), 'ACTION' => $action)); - } - -$template->pparse('bati'); +$template->set_filenames(array('base' => 'base.tpl')); +$template->assign_vars(array('PUB' => $PUB, 'VERSION' => $version, 'RES_IMAGE' => $RES_IMAGE, 'NOM_METAL' => strtolower($NOM_METAL), 'NOM_CRISTAL' => strtolower($NOM_CRISTAL), 'NOM_HYDROGENE' => strtolower($NOM_HYDROGENE), 'NOM_ENERGIE' => strtolower($NOM_ENERGIE), 'RES_METAL' => $RES_METAL, 'RES_CRISTAL' => $RES_CRISTAL, 'RES_HYDROGENE' => $RES_HYDROGENE, 'RES_ENERGIE' => $RES_ENERGIE)); +for ($i=0 ; $iassign_block_vars('planetes',array('RES_VALUE' => $Aplan_value[$i], 'RES_MORE' => $Aplan_more[$i], 'RES_IMG' => $Aplan_img[$i], 'RES_NOM' => $Aplan_nom[$i], 'RES_REF' => $Aplan_ref[$i])); +} +$template->assign_var_from_handle('CONTENU', 'batiments'); +$template->pparse('base'); ?> \ No newline at end of file diff --git a/pages/batiment_validation.php b/pages/batiment_validation.php index 3c403c2..e2bc7a9 100644 --- a/pages/batiment_validation.php +++ b/pages/batiment_validation.php @@ -7,8 +7,7 @@ $ss=$_SESSION['ss']; $pos=$_SESSION['pos']; $race=$_SESSION['race']; -require_once('bdd.php'); -require_once('noms.php'); +include_once('common.php'); require('../connectBDD.php'); if (ereg(','.$_GET['bat'].',', implode(',',$fileBat).',')) { header('Location: batiment.php?err=1'); exit; } @@ -24,75 +23,75 @@ else { if ($_GET['bat'] == 1) { $metal -= ceil(exp(0.4*$mine_m)*190); $cristal -= ceil(exp(0.4*$mine_m)*90); - $temps_bat = ceil((pow(1.7,$mine_m)*120)/(pow(1.23,$centre_info)+0.0025*$ingeneieur)); + $temps_bat = ceil((pow(1.7,$mine_m)*120)/(pow(1.23,$centre_info)+0.0025*$ingenieur)); $bat = 1; } elseif ($_GET['bat'] == 2) { $metal -= ceil(exp(0.43*$mine_c)*205); $cristal -= ceil(exp(0.43*$mine_c)*110); - $temps_bat = ceil((pow(1.72,$mine_c)*160)/(pow(1.23,$centre_info)+0.0025*$ingeneieur)); + $temps_bat = ceil((pow(1.72,$mine_c)*160)/(pow(1.23,$centre_info)+0.0025*$ingenieur)); $bat = 2; } elseif ($_GET['bat'] == 3) { $metal -= ceil(exp(0.445*$mine_h)*235); $cristal -= ceil(exp(0.445*$mine_h)*150); - $temps_bat = ceil((pow(1.75,$mine_h)*180)/(pow(1.23,$centre_info)+0.0025*$ingeneieur)); + $temps_bat = ceil((pow(1.75,$mine_h)*180)/(pow(1.23,$centre_info)+0.0025*$ingenieur)); $bat = 3; } elseif ($_GET['bat'] == 4) { $metal -= ceil(exp(0.442*$centrale_s)*165); $cristal -= ceil(exp(0.442*$centrale_s)*99); - $temps_bat = ceil((pow(1.68,$centrale_s)*190)/(pow(1.23,$centre_info)+0.0025*$ingeneieur)); + $temps_bat = ceil((pow(1.68,$centrale_s)*190)/(pow(1.23,$centre_info)+0.0025*$ingenieur)); $bat = 4; } elseif ($_GET['bat'] == 5 && $centrale_s >= 12 && $energie_t >= 5) { $metal -= ceil(pow(1.8,$centrale_f)*300); $cristal -= ceil(pow(1.82,$centrale_f)*230); - $temps_bat = ceil((pow(1.8,$centrale_f)*300)/(pow(1.23,$centre_info)+0.0025*$ingeneieur)); + $temps_bat = ceil((pow(1.8,$centrale_f)*300)/(pow(1.23,$centre_info)+0.0025*$ingenieur)); $bat = 5; } elseif ($_GET['bat'] == 6 && $detection >= 1) { $metal -= ceil(pow(2,$radar)*750); $cristal -= ceil(pow(2,$radar)*500); $hydrogene -= ceil(pow(2,$radar)*50); - $temps_bat = ceil((pow(2,$radar)*720)/(pow(1.23,$centre_info)+0.0025*$ingeneieur)); + $temps_bat = ceil((pow(2,$radar)*720)/(pow(1.23,$centre_info)+0.0025*$ingenieur)); $bat = 6; } elseif ($_GET['bat'] == 7) { $metal -= ceil(pow(2,$labo)*200); $cristal -= ceil(pow(2,$labo)*150); - $temps_bat = ceil((pow(2,$labo)*720)/(pow(1.23,$centre_info)+0.0025*$ingeneieur)); + $temps_bat = ceil((pow(2,$labo)*720)/(pow(1.23,$centre_info)+0.0025*$ingenieur)); $bat = 7; } elseif ($_GET['bat'] == 8) { $metal -= ceil(pow(2,$chantier_terrestre)*520); $cristal -= ceil(pow(2,$chantier_terrestre)*380); - $temps_bat = ceil((pow(2,$chantier_terrestre)*420)/(pow(1.23,$centre_info)+0.0025*$ingeneieur)); + $temps_bat = ceil((pow(2,$chantier_terrestre)*420)/(pow(1.23,$centre_info)+0.0025*$ingenieur)); $bat = 8; } elseif ($_GET['bat'] == 9 && $chantier_terrestre >= 2) { $metal -= ceil(pow(2,$chantier_spatial)*600); $cristal -= ceil(pow(2,$chantier_spatial)*450); - $temps_bat = ceil((pow(2,$chantier_spatial)*600)/(pow(1.23,$centre_info)+0.0025*$ingeneieur)); + $temps_bat = ceil((pow(2,$chantier_spatial)*600)/(pow(1.23,$centre_info)+0.0025*$ingenieur)); $bat = 9; } elseif ($_GET['bat'] == 10) { $metal -= ceil(pow(2,$caserne)*200); $cristal -= ceil(pow(2,$caserne)*100); - $temps_bat = ceil((pow(2,$caserne)*300)/(pow(1.23,$centre_info)+0.0025*$ingeneieur)); + $temps_bat = ceil((pow(2,$caserne)*300)/(pow(1.23,$centre_info)+0.0025*$ingenieur)); $bat = 10; } elseif ($_GET['bat'] == 11) { $metal -= ceil(pow(2,$silo)*400); $cristal -= ceil(pow(2,$silo)*260); - $temps_bat = ceil((pow(2,$silo)*1200)/(pow(1.23,$centre_info)+0.0025*$ingeneieur)); + $temps_bat = ceil((pow(2,$silo)*1200)/(pow(1.23,$centre_info)+0.0025*$ingenieur)); $bat = 11; } elseif ($_GET['bat'] == 12 && $informatique >= 2) { $metal -= ceil(pow(1.7,$centre_info)*600); $cristal -=ceil(pow(1.7,$centre_info)*420); $hydrogene -=ceil(pow(1.7,$centre_info)*100); - $temps_bat = ceil((pow(1.9,$centre_info)*800)/((0.0025*$ingeneieur)+1)); + $temps_bat = ceil((pow(1.9,$centre_info)*800)/((0.0025*$ingenieur)+1)); $bat = 12; } } diff --git a/pages/bdd.php b/pages/bdd.php index ef27831..a85231c 100644 --- a/pages/bdd.php +++ b/pages/bdd.php @@ -12,7 +12,7 @@ $mdp = $donnees['mdp']; $auth_level = $donnees['auth_level']; $race = $donnees['race']; $mail = $donnees['mail']; -$ip = $donnees['ip']; +$ip = $donnees['last_ip']; $mv = $donnees['mv']; $last_visite = $donnees['last_visite']; $points = $donnees['points']; @@ -26,7 +26,7 @@ $place_terrestre = $donnees['place_terrestre']; //$fileTemps_t = split(' ', trim('11111111199 2222222222 3333333333 4444444444 5555555555 6666666666 7777777777 8888888888 9999999999 ')); $fileTemps_t = split(' ', trim($donnees['temps_t'])); -if (!is_array($fileTemps_t)) $temps_tec = 0; +if (!is_array($fileTemps_t) || !isset($fileTemps_t[1])) $temps_tec = 0; else $temps_tec = $fileTemps_t[0] + $fileTemps_t[1]; //$fileTec = split(' ', trim('1 2 3 4 5 6 7 8 9 ')); $fileTec = split(' ', trim($donnees['tec'])); @@ -44,8 +44,9 @@ $reacteur_f = $donnees['reacteur_f']; $reacteur_ff = $donnees['reacteur_ff']; $medecine = $donnees['medecine']; $tactique = $donnees['tactique']; -$developement = $donnees['developement']; +//$developement = $donnees['developement']; $blindage = $donnees['blindage']; +$spartan = $donnees['spartan']; $y = mysql_query("SELECT * FROM planete WHERE id_user='$id' AND galaxie='$galaxy' AND position='$pos' AND ss='$ss'"); $donnees = mysql_fetch_array($y); @@ -68,7 +69,7 @@ $energie = $donnees['energie']; //$fileTemps_b = split(' ', trim('1195602663 3600 3333333333 4444444444 5555555555 6666666666 7777777777 8888888888 9999999999 ')); $fileTemps_b = split(' ', trim($donnees['temps_b'])); -if (!is_array($fileTemps_b)) $temps_b = 0; +if (!is_array($fileTemps_b) || !isset($fileTemps_b[1])) $temps_b = 0; else $temps_b = $fileTemps_b[0] + $fileTemps_b[1]; //$fileBat = split(' ', trim('1 2 3 4 5 6 7 8 9 ')); $fileBat = split(' ', trim($donnees['bat'])); @@ -109,7 +110,7 @@ $soldat_lourd = $donnees['soldat_lourd']; //$fileTemps_s = split(' ', trim('1195902663 3600 3333333333 4444444444 5555555555 6666666666 7777777777 8888888888 9999999999 ')); $fileTemps_s = split(' ', trim($donnees['temps_spatial'])); -if (!is_array($fileTemps_s)) $temps_s = 0; +if (!is_array($fileTemps_s) || !isset($fileTemps_s[1])) $temps_s = 0; else $temps_s = $fileTemps_s[0] + $fileTemps_s[1]; //$fileVai = split(' ', trim('1 1 2 2 5 2 2 2 2 ')); $fileVai = split(' ', trim($donnees['unit_s'])); @@ -134,7 +135,7 @@ $vaisseau_12 = $donnees['vaisseau_12']; //$fileTemps_v = split(' ', trim('1197500068 3600 3333333333 4444444444 5555555555 6666666666 7777777777 8888888888 9999999999 ')); $fileTemps_v = split(' ', trim($donnees['temps_t'])); -if (!is_array($fileTemps_v)) $temps_v = 0; +if (!is_array($fileTemps_v) || !isset($fileTemps_v[1])) $temps_v = 0; else $temps_v = $fileTemps_v[0] + $fileTemps_v[1]; //$fileVeh = split(' ', trim('9 9 10 10 11 11 12 12 12 ')); $fileVeh = split(' ', trim($donnees['unit_t'])); @@ -148,7 +149,6 @@ $vais_0 = $donnees['vais_0']; $vais_1 = $donnees['vais_1']; $vais_2 = $donnees['vais_2']; $vais_3 = $donnees['vais_3']; -$vais_4 = $donnees['vais_4']; $vcl_1 = $donnees['vcl_1']; $vcl_2 = $donnees['vcl_2']; @@ -161,12 +161,15 @@ $def_3 = $donnees['def_3']; $def_4 = $donnees['def_4']; $def_5 = $donnees['def_5']; -require_once('caserne_ajout.php'); require_once('batiment_ajout.php'); +//require_once('caserne_ajout.php'); require_once('chantier_spacial_ajout.php'); //require_once('chantier_terrestre_ajout.php'); -require_once('laboratoire_ajout.php'); require_once('defense_ajout.php'); +require_once('laboratoire_ajout.php'); -$templates = ''; +$case = $cases - ($mine_m + $mine_c + $mine_h + $centrale_s + $centrale_f + $radar + $labo + $chantier_terrestre + $chantier_spatial + $caserne + $silo); + +if (md5($race) == '34c19b21bd4a3dda389e767d32fe9779' && $auth_level >= 6) $templates = strtolower($race).'/'; +else $templates = 'humain/'; ?> \ No newline at end of file diff --git a/pages/carte.php b/pages/carte.php index 50c7b13..f4e8188 100644 --- a/pages/carte.php +++ b/pages/carte.php @@ -1,12 +1,22 @@ set_filenames(array('carte' => 'carte.tpl')); + if (isset($_GET['galaxy'])) $g = floor($_GET['galaxy']); else $g = $_SESSION['galaxy']; if ($g < 1) $g = 1; if ($g > 15) $g = 1; @@ -15,59 +25,60 @@ if (isset($_GET['ss'])) $s=floor($_GET['ss']); else $s=$_SESSION['ss']; if ($s < 1) $s = 1; if ($s > 300) $s = 300; -if ($s == 1 && $g > 1) { $Gmu = $g - 1; $Smu = 300; } -elseif ($s == 1) { $Gmu = 15; $Smu = 300; } -else { $Gmu = $g; $Smu = $s - 1; } -if ($s == 300) { $Gpu = $g + 1; $Spu = 1; } -else { $Gpu = $g; $Spu = $s + 1; } -?> - - -TD.z { -border: 0px; +if ($s == 1 && $g > 1) { + $Gmu = $g - 1; + $Smu = 300; +} +elseif ($s == 1) { + $Gmu = 15; + $Smu = 300; +} +else { + $Gmu = $g; + $Smu = $s - 1; +} +if ($s == 300) { + $Gpu = $g + 1; + $Spu = 1; +} +else { + $Gpu = $g; + $Spu = $s + 1; } - +$template->assign_vars(array('GALAXIE' => $g, 'SYSTEME' => $s, 'GALAXIEM' => $Gmu, 'SYSTEMEM' => $Smu, 'GALAXIEP' => $Gpu, 'SYSTEMEP' => $Spu)); -
- - - - -
- - -
Galaxie
- - -
Système solaire
<<<>>>
-
-
- - -'; for ($i=1; $i<=12; $i++) { - $resultat = mysql_query("SELECT * FROM planete WHERE galaxie='$g' AND ss='$s' AND position='$i' "); + $resultat = mysql_query("SELECT * FROM planete WHERE galaxie='$g' AND ss='$s' AND position='$i'"); if(mysql_num_rows($resultat)>=1) { - $x = mysql_query("SELECT * FROM planete WHERE galaxie='$g' AND ss='$s'AND position='$i' "); + $x = mysql_query("SELECT * FROM planete WHERE galaxie='$g' AND ss='$s'AND position='$i'"); $d = mysql_fetch_array($x); $id_user = $d['id_user']; - $y = mysql_query("SELECT race FROM user WHERE id='$id_user' "); + $y = mysql_query("SELECT race FROM user WHERE id='$id_user'"); $e = mysql_fetch_array($y); if ($e['race'] == 'covenant') $ra='(c)'; elseif (md5($e['race'] && $auth_level >= 6) == '34c19b21bd4a3dda389e767d32fe9779') $ra='(f)'; else $ra='(h)'; - echo ''; + $template->assign_block_vars('planete',array('I' => $i, 'NOM' => $d['nom_planete'], 'DEB_MET' => $d['debris_met'], 'DEB_CRI' => $d['debris_cri'], 'RACE' => $ra, 'JOUEUR' => trouvNom($d['id_user']), 'MAIL' => 'Envoyer un message privé')); } - - else echo ''; + else $template->assign_block_vars('planete',array('I' => $i)); } -echo '
Système '.$g.' : '.$s.'
PositionNomDébris métalDébris cristalJoueurMessage
'.$i.''.$d['nom_planete'].''.$d['debris_met'].''.$d['debris_cri'].''.$ra.' '.trouvNom($d['id_user']).'
'.$i.'
'; +/* FIN Page Carte spatiale + * + */ +$result = mysql_query("SELECT * FROM version ORDER BY temps DESC"); +$data = mysql_fetch_array($result); +$version = $data['version']; mysql_close(); -?> - - \ No newline at end of file + +$template->set_filenames(array('base' => 'base.tpl')); +$template->assign_vars(array('PUB' => $PUB, 'VERSION' => $version, 'RES_IMAGE' => $RES_IMAGE, 'NOM_METAL' => strtolower($NOM_METAL), 'NOM_CRISTAL' => strtolower($NOM_CRISTAL), 'NOM_HYDROGENE' => strtolower($NOM_HYDROGENE), 'NOM_ENERGIE' => strtolower($NOM_ENERGIE), 'RES_METAL' => $RES_METAL, 'RES_CRISTAL' => $RES_CRISTAL, 'RES_HYDROGENE' => $RES_HYDROGENE, 'RES_ENERGIE' => $RES_ENERGIE)); +for ($i=0 ; $iassign_block_vars('planetes',array('RES_VALUE' => $Aplan_value[$i], 'RES_MORE' => $Aplan_more[$i], 'RES_IMG' => $Aplan_img[$i], 'RES_NOM' => $Aplan_nom[$i], 'RES_REF' => $Aplan_ref[$i])); +} +$template->assign_var_from_handle('CONTENU', 'carte'); +$template->pparse('base'); +?> \ No newline at end of file diff --git a/pages/chantier_spacial_ajout.php b/pages/chantier_spacial_ajout.php index 8c63b2e..624f212 100644 --- a/pages/chantier_spacial_ajout.php +++ b/pages/chantier_spacial_ajout.php @@ -29,13 +29,13 @@ while($continue) { $depart = 0; $nb = 1; $eff = 0; - $newArray_vai = ''; $newArray_temps_v = $fileTemps_s[0].' '; + $newArray_vai = ''; $newArray_temps_v = $temps_spatial.' '; for ($i=0 ; $i= $nb || $i < $depart) { $newArray_vai .= $fileVai[$i].' '; $newArray_temps_v .= $fileTemps_s[$i+1].' '; } - elseif ($i == 0) { $newArray_temps_v = $temps_spatial.' '; $eff++; } + elseif ($i == 0) { $newArray_temps_v = ($fileTemps_s[0] + $fileTemps_s[1]).' '; $eff++; } else $eff++; } $fileVai = split(' ', trim($newArray_vai)); @@ -52,6 +52,7 @@ while($continue) { if (!is_array($fileTemps_s)) $temps_s = 0; else $temps_s = $fileTemps_s[0] + $fileTemps_s[1]; + $temps_spatial = $temps_s; if (!is_array($fileVai)) $unit_s = 0; else $unit_s = $fileVai[0]; if (ereg('e;',implode(',',$fileVai).';')) $vai_boucle = true; diff --git a/pages/chantier_spatial.php b/pages/chantier_spatial.php index 2c04231..bc01d7d 100644 --- a/pages/chantier_spatial.php +++ b/pages/chantier_spatial.php @@ -5,43 +5,51 @@ $id=$_SESSION['id']; $galaxy=$_SESSION['galaxy']; $ss=$_SESSION['ss']; $pos=$_SESSION['pos']; +$race=$_SESSION['race']; $_SESSION['dernPage'] = 'chantier_spatial.php'; -require_once 'bdd.php'; -require_once('../securite.php'); -require_once 'ressourcetem.php'; -require_once 'noms.php'; +include_once('common.php'); +require('../connectBDD.php'); + require('../template.php'); $template = new Template('../templates/'.$templates); +/* Page chantier spatial + * + */ function verification_des_ress($numtec, $metal, $calcium, $nourriture, $ress_ness_metal, $ress_ness_calcium, $ress_ness_nourriture) { - if ($metal >= $ress_ness_metal && $calcium >= $ress_ness_calcium && $nourriture >= $ress_ness_nourriture) return '

'; - else return 'Vous n\'avez pas suffisament de ressources'; + if ($metal >= $ress_ness_metal && $calcium >= $ress_ness_calcium && $nourriture >= $ress_ness_nourriture) return '


'; + else return 'Vous n\'avez pas suffisament de ressources'; +} + +function verification_des_ressvf($numtec, $metal, $calcium, $nourriture, $ress_ness_metal, $ress_ness_calcium, $ress_ness_nourriture) { + if ($metal >= $ress_ness_metal && $calcium >= $ress_ness_calcium && $nourriture >= $ress_ness_nourriture) return true; + else return false; } function ressources($fer, $cristal, $ro, $need_fer, $need_cristal, $need_ro) { - require 'noms.php'; + require 'includes/noms.php'; $return = ''; if ($need_fer > 0) { if ($fer <= $need_fer) { $z=floor($fer)-$need_fer; - $return .= ''.$ressourc[0].' : '.$need_fer.' '; + $return .= ''.$ressourc[0].' : '.separerNombres($need_fer).' '; } - else $return .= $ressourc[0].' : '.$need_fer.' '; + else $return .= $ressourc[0].' : '.separerNombres($need_fer).' '; } if ($need_cristal > 0) { if ($cristal <= $need_cristal) { $z=floor($cristal)-$need_cristal; - $return .= ''.$ressourc[1].' : '.$need_cristal.' '; + $return .= ''.$ressourc[1].' : '.separerNombres($need_cristal).' '; } else $return .= $ressourc[1].' : '.$need_cristal.' '; } if ($need_ro > 0) { if ($ro <= $need_ro) { $z=floor($ro)-$need_ro; - $return .= ''.$ressourc[2].' : '.$need_ro.''; + $return .= ''.$ressourc[2].' : '.separerNombres($need_ro).''; } - else $return .= $ressourc[2].' : '.$need_ro.''; + else $return .= $ressourc[2].' : '.separerNombres($need_ro).''; } return $return; } @@ -64,6 +72,7 @@ function sec($time) { return $output; } +$template->set_filenames(array('chantier_spatial' => 'chantier_spatial.tpl')); $f = ceil(1080/pow(1.25,($chantier_spatial-1))); $g = ceil(6300/pow(1.25,($chantier_spatial-5))); @@ -86,38 +95,7 @@ if ($chantier_spatial > 0) { elseif ($_GET['err'] == 2) $ERREUR = '
La production à la chaîne a été arrêtée

'; elseif ($_GET['err'] == 3) $ERREUR = '
Vous n\'avez pas assez de ressources pour construire autant de vaisseaux

'; - $template->set_filenames(array('ressourcestpl' => 'ressources.tpl')); - $template->assign_vars( array('RES_IMAGE' => $RES_IMAGE, 'NOM_METAL' => $NOM_METAL, 'NOM_CRISTAL' => $NOM_CRISTAL, 'NOM_HYDROGENE' => $NOM_HYDROGENE, 'NOM_ENERGIE' => $NOM_ENERGIE, 'RES_METAL' => $RES_METAL, 'RES_CRISTAL' => $RES_CRISTAL, 'RES_HYDROGENE' => $RES_HYDROGENE, 'RES_ENERGIE' => $RES_ENERGIE, 'ERREUR' => $ERREUR, 'HEADER' => $HEADER, 'PUB' => $PUB)); - for ($i=0 ; $iassign_block_vars('planetes',array('RES_VALUE' => $Aplan_value[$i], 'RES_MORE' => $Aplan_more[$i], 'RES_REF' => $Aplan_ref[$i])); - } - $template->set_filenames(array('chantier_spatial' => 'chantier_spatial.tpl')); - $template->assign_var_from_handle('RESSOURCES', 'ressourcestpl'); - $CHAINE = ''; - if (!empty($fileVai[0])) { - $comp = 1; - for ($i=0 ; $iassign_block_vars('file',array('NOM' => $comp.' '.$nomvaisa[$fileVai[$i]-1], 'NUM' => $fileVai[$i], 'I' => $i)); - $comp = 1; - } - - } - //else $CHAINE = '
Arrêter de produire à la chaîne'; - } - $FILETXT = ''; - //if ($i == 1 && $vai_boucle == false) $CHAINE = '
Produire à la chaîne'; - } - else $FILETXT = 'Aucun vaisseau en attente'; - - $tr = $fileTemps_s[0] + $fileTemps_s[1] - time(); - if (!empty($fileVai[0])) $RESTE = $action = ''; - else $RESTE = ''; - - $template->assign_vars(array('RACE' => $race, 'FILETXT' => $FILETXT, 'CHAINE' => $CHAINE, 'RESTE' => $RESTE)); $a=0; $b=0; $c=0; @@ -129,7 +107,8 @@ $a=0; $b=0; $c=0; $n=(${$nom_bdd}-1); $a=1000; $b=800; if($bat == 9) $action = 'Le chantier spatial est en cours d\'évolution'; else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); - if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($f), 'ACTION' => $action)); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'chantier_spatial_validation.php?type='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($f), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($nomvaisn[$i]), 'DESCRIPTIONE' => addslashes($nomvaisd[$i]), 'LIEN' => $lien)); } // Vaisseau n°2 : Cargos de classe Interdictor/Transporteur Lourd/Cargos de classe Laden ; planete.vaisseau_2 @@ -140,7 +119,8 @@ $a=0; $b=0; $c=0; $n=(${$nom_bdd}-1); $a=4000; $b=3000; if($bat == 9) $action = 'Le chantier spatial est en cours d\'évolution'; else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); - if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($g), 'ACTION' => $action)); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'chantier_spatial_validation.php?type='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($g), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($nomvaisn[$i]), 'DESCRIPTIONE' => addslashes($nomvaisd[$i]), 'LIEN' => $lien)); } // Vaisseau n°3 : Vaisseau de colonisation de classe Returning/Colonisateur/Vaisseaux de colonisation de classe Odyssey ; planete.vaisseau_3 @@ -151,7 +131,8 @@ $a=0; $b=0; $c=0; $n=(${$nom_bdd}-1); $a=9000; $b=9000; $c=1000; if($bat == 9) $action = 'Le chantier spatial est en cours d\'évolution'; else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); - if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($h), 'ACTION' => $action)); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'chantier_spatial_validation.php?type='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($h), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($nomvaisn[$i]), 'DESCRIPTIONE' => addslashes($nomvaisd[$i]), 'LIEN' => $lien)); } // Vaisseau n°4 : Sonde de reconnaissance de classe Perception/0/Drones d’espionnage de classe Clarion ; planete.vaisseau_4 @@ -162,7 +143,8 @@ $a=0; $b=0; $c=0; $n=(${$nom_bdd}-1); $a=1000; $b=1200; $c=100; if($bat == 9) $action = 'Le chantier spatial est en cours d\'évolution'; else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); - if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($iV), 'ACTION' => $action)); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'chantier_spatial_validation.php?type='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($iV), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($nomvaisn[$i]), 'DESCRIPTIONE' => addslashes($nomvaisd[$i]), 'LIEN' => $lien)); } // Vaisseau n°5 : Charognard/Recycleur/Recycleurs de classe Minotaur ; planete.vaisseau_5 @@ -173,7 +155,8 @@ $a=0; $b=0; $c=0; $n=(${$nom_bdd}-1); $a=15000; $b=9000; $c=1000; if($bat == 9) $action = 'Le chantier spatial est en cours d\'évolution'; else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); - if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($j), 'ACTION' => $action)); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'chantier_spatial_validation.php?type='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($j), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($nomvaisn[$i]), 'DESCRIPTIONE' => addslashes($nomvaisd[$i]), 'LIEN' => $lien)); } // Vaisseau n°6 : Séraphin/Croiseur Forruner/C709 Longsword Interceptor ; planete.vaisseau_6 @@ -184,7 +167,8 @@ $a=0; $b=0; $c=0; $n=(${$nom_bdd}-1); $a=1700; $b=1220; if($bat == 9) $action = 'Le chantier spatial est en cours d\'évolution'; else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); - if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($k), 'ACTION' => $action)); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'chantier_spatial_validation.php?type='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($k), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($nomvaisn[$i]), 'DESCRIPTIONE' => addslashes($nomvaisd[$i]), 'LIEN' => $lien)); } // Vaisseau n°7 : Frégate/Super-Destroyer/Frégate ; planete.vaisseau_7 @@ -195,7 +179,8 @@ $a=0; $b=0; $c=0; $n=(${$nom_bdd}-1); $a=5800; $b=1400; if($bat == 9) $action = 'Le chantier spatial est en cours d\'évolution'; else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); - if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($l), 'ACTION' => $action)); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'chantier_spatial_validation.php?type='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($l), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($nomvaisn[$i]), 'DESCRIPTIONE' => addslashes($nomvaisd[$i]), 'LIEN' => $lien)); } // Vaisseau n°8 : Croiseur de classe CCS/Chasseur Leger/Croiseurs de classe Halcyon ; planete.vaisseau_8 @@ -206,7 +191,8 @@ $a=0; $b=0; $c=0; $n=(${$nom_bdd}-1); $a=20000; $b=16000; $c=1600; if($bat == 9) $action = 'Le chantier spatial est en cours d\'évolution'; else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); - if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($m), 'ACTION' => $action)); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'chantier_spatial_validation.php?type='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($m), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($nomvaisn[$i]), 'DESCRIPTIONE' => addslashes($nomvaisd[$i]), 'LIEN' => $lien)); } // Vaisseau n°9 : Croiseur de classe Reverence/Chasseur Lourd/Croiseurs de classe Marathon ; planete.vaisseau_9 @@ -217,7 +203,8 @@ $a=0; $b=0; $c=0; $n=(${$nom_bdd}-1); $a=26000; $b=16400; $c=1600; if($bat == 9) $action = 'Le chantier spatial est en cours d\'évolution'; else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); - if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($nV), 'ACTION' => $action)); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'chantier_spatial_validation.php?type='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($nV), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($nomvaisn[$i]), 'DESCRIPTIONE' => addslashes($nomvaisd[$i]), 'LIEN' => $lien)); } // Vaisseau n°10 : Porte vaisseaux/Porte-vaisseaux/Porte vaisseaux ; planete.vaisseau_10 @@ -228,7 +215,8 @@ $a=0; $b=0; $c=0; $n=(${$nom_bdd}-1); $a=60000; $b=40000; $c=3000; if($bat == 9) $action = 'Le chantier spatial est en cours d\'évolution'; else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); - if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($p), 'ACTION' => $action)); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'chantier_spatial_validation.php?type='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($p), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($nomvaisn[$i]), 'DESCRIPTIONE' => addslashes($nomvaisd[$i]), 'LIEN' => $lien)); } // Vaisseau n°11 : Station orbitale covenant/Station orbitale/Station orbitale ; planete.vaisseau_11 @@ -239,7 +227,8 @@ $a=0; $b=0; $c=0; $n=(${$nom_bdd}-1); $a=500000; $b=400000; $c=250000; if($bat == 9) $action = 'Le chantier spatial est en cours d\'évolution'; else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); - if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($q), 'ACTION' => $action)); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'chantier_spatial_validation.php?type='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($q), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($nomvaisn[$i]), 'DESCRIPTIONE' => addslashes($nomvaisd[$i]), 'LIEN' => $lien)); } // Vaisseau n°12 : Super porte vaisseaux/Super porte-vaisseaux/Super porte-vaisseaux ; planete.vaisseau_12 @@ -250,22 +239,59 @@ $a=0; $b=0; $c=0; $n=(${$nom_bdd}-1); $a=500000; $b=400000; $c=250000; if($bat == 9) $action = 'Le chantier spatial est en cours d\'évolution'; else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); - if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($q), 'ACTION' => $action)); + if (verification_des_ressvf($i+1, $metal, $cristal, $hydrogene, $a, $b, $c)) { $ACT = ''; $lien = 'chantier_spatial_validation.php?type='.($i+1); } else { $ACT = 'none'; $lien = ''; } + if (!empty($nomvaisn[$i])) $template->assign_block_vars('vaisseau', array('IMAGE' => $nomvaisi[$i], 'NOM' => $nomvaisn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomvaisd[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($q), 'ACTION' => $action, 'NEC_METAL' => separerNombres($a), 'NEC_CRISTAL' => separerNombres($b), 'NEC_HYDROGENE' => separerNombres($c), 'ACT' => $ACT, 'NOME' => addslashes($nomvaisn[$i]), 'DESCRIPTIONE' => addslashes($nomvaisd[$i]), 'LIEN' => $lien)); } - $template->pparse('chantier_spatial'); + $CHAINE = ''; + $ut = false; + + if (is_array($fileTemps_s) && isset($fileTemps_s[1])) $tr = $fileTemps_s[0] + $fileTemps_s[1] - time(); + else $tr = 0; + if (!empty($fileVai[0])) $RESTE = $action = ''; + else $RESTE = ''; + + if (!empty($fileVai[0])) { + $comp = 1; + for ($i=0 ; $iassign_block_vars('file',array('NOM' => $comp.' '.$nomvaisa[$fileVai[$i]-1], 'NUM' => $fileVai[$i], 'I' => $i, 'RESTANT' => 'prochain : - ')); + $ut = true; + } + else $template->assign_block_vars('file',array('NOM' => $comp.' '.$nomvaisa[$fileVai[$i]-1], 'NUM' => $fileVai[$i], 'I' => $i)); + $comp = 1; + } + + } + //else $CHAINE = '
Arrêter de produire à la chaîne'; + } + $FILETXT = ''; + //if ($i == 1 && $vai_boucle == false) $CHAINE = '
Produire à la chaîne'; + } + else $FILETXT = 'Aucun vaisseau en attente'; + + $template->assign_vars(array('RACE' => $race, 'FILETXT' => $FILETXT, 'CHAINE' => $CHAINE, 'RESTE' => $RESTE, 'ERREUR' => $ERREUR)); } else { - $template->set_filenames(array('ressourcestpl' => 'ressources.tpl')); - $template->assign_vars( array('RES_IMAGE' => $RES_IMAGE, 'NOM_METAL' => $NOM_METAL, 'NOM_CRISTAL' => $NOM_CRISTAL, 'NOM_HYDROGENE' => $NOM_HYDROGENE, 'NOM_ENERGIE' => $NOM_ENERGIE, 'RES_METAL' => $RES_METAL, 'RES_CRISTAL' => $RES_CRISTAL, 'RES_HYDROGENE' => $RES_HYDROGENE, 'RES_ENERGIE' => $RES_ENERGIE, 'ERREUR' => $ERREUR, 'HEADER' => $HEADER, 'PUB' => $PUB)); - for ($i=0 ; $iassign_block_vars('planetes',array('RES_VALUE' => $Aplan_value[$i], 'RES_MORE' => $Aplan_more[$i], 'RES_REF' => $Aplan_ref[$i])); - } - - $template->set_filenames(array('manque' => 'manque.tpl')); - $template->assign_var_from_handle('RESSOURCES', 'ressourcestpl'); - - $template->assign_vars( array('TEXTE' => 'Vous devez d\'abord construire un chantier spatial !', 'PUB' => $PUB)); - $template->pparse('manque'); + $template->set_filenames(array('chantier_spatial' => 'manque.tpl')); + $template->assign_vars( array('TEXTE' => 'Vous devez d\'abord construire un chantier spatial !')); } -?> \ No newline at end of file +/* FIN Page chantier spatial + * + */ + +$result = mysql_query("SELECT * FROM version ORDER BY temps DESC"); +$data = mysql_fetch_array($result); +$version = $data['version']; + +$template->set_filenames(array('base' => 'base.tpl')); +$template->assign_vars(array('PUB' => $PUB, 'VERSION' => $version, 'RES_IMAGE' => $RES_IMAGE, 'NOM_METAL' => strtolower($NOM_METAL), 'NOM_CRISTAL' => strtolower($NOM_CRISTAL), 'NOM_HYDROGENE' => strtolower($NOM_HYDROGENE), 'NOM_ENERGIE' => strtolower($NOM_ENERGIE), 'RES_METAL' => $RES_METAL, 'RES_CRISTAL' => $RES_CRISTAL, 'RES_HYDROGENE' => $RES_HYDROGENE, 'RES_ENERGIE' => $RES_ENERGIE, 'DATEHEURET' => date('/dm/ H:i'), 'COUNTHUMAINS' => '7500', 'COUNTCOVENANTS' => '4500', 'PSEUDO' => $pseudo)); +for ($i=0 ; $iassign_block_vars('planetes',array('RES_VALUE' => $Aplan_value[$i], 'RES_MORE' => $Aplan_more[$i], 'RES_IMG' => $Aplan_img[$i], 'RES_NOM' => $Aplan_nom[$i], 'RES_REF' => $Aplan_ref[$i])); +} + +$template->assign_var_from_handle('CONTENU', 'chantier_spatial'); +$template->pparse('base'); \ No newline at end of file diff --git a/pages/chantier_spatial_validation.php b/pages/chantier_spatial_validation.php index 358cad2..ca04602 100644 --- a/pages/chantier_spatial_validation.php +++ b/pages/chantier_spatial_validation.php @@ -7,95 +7,97 @@ $ss=$_SESSION['ss']; $pos=$_SESSION['pos']; $race=$_SESSION['race']; -require_once('bdd.php'); -require_once('noms.php'); +include_once('common.php'); require('../connectBDD.php'); -if ($_POST['type'] == 'e' && $labo >= 1 && !ereg('e,', implode(',',$fileVai).',')) { - $temps_s = ''; - $vai = 'e'; +if (isset($_POST['type'])) $_GET['type'] = $_POST['type']; +elseif (!isset($_GET['type'])) $_GET['type'] = ''; + +if ($_GET['type'] == 'e' && $labo >= 1 && !ereg('e,', implode(',',$fileVai).',')) { + //$temps_s = ''; + //$vai = 'e'; } else { // Annulation de la production en chaîne si elle existe - //if (ereg('e,', implode(',',$fileVai).',')) { header('Location: annul_bat.php?bat=e&go='.$_POST['type']); exit; } + //if (ereg('e,', implode(',',$fileVai).',')) { header('Location: annul_bat.php?bat=e&go='.$_GET['type']); exit; } if (!isset($_POST['sa'])) exit; else $sa = abs(floor($_POST['sa'])); - if ($_POST['type'] == 1 && $chantier_spatial >= 1 && $reacteur >= 4) { + if ($_GET['type'] == 1 && $chantier_spatial >= 1 && $reacteur >= 4) { $metal -= 1000*$sa; $cristal -= 800*$sa; $temps_s = ceil(1080/pow(1.25,($chantier_spatial-1))); $vai = 1; } - elseif ($_POST['type'] == 2 && $chantier_spatial >= 5 && $reacteur_f >= 2) { + elseif ($_GET['type'] == 2 && $chantier_spatial >= 5 && $reacteur_f >= 2) { $metal -= 4000*$sa; $cristal -= 3000*$sa; $temps_s = ceil(6300/pow(1.25,($chantier_spatial-5))); $vai = 2; } - elseif ($_POST['type'] == 3 && $chantier_spatial >= 5 && $reacteur_ff >= 1) { + elseif ($_GET['type'] == 3 && $chantier_spatial >= 5 && $reacteur_ff >= 1) { $metal -= 9000*$sa; $cristal -= 9000*$sa; $hydrogene -= 1000*$sa; $temps_s = ceil(8280/pow(1.25,($chantier_spatial-5))); $vai = 3; } - elseif ($_POST['type'] == 4 && $chantier_spatial >= 3 && $reacteur >= 5 && $detection >= 2) { + elseif ($_GET['type'] == 4 && $chantier_spatial >= 3 && $reacteur >= 5 && $detection >= 2) { $metal -= 1000*$sa; $cristal -= 1200*$sa; $hydrogene -= 100*$sa; $temps_s = ceil(1440/pow(1.25,($chantier_spatial-3))); $vai = 4; } - elseif ($_POST['type'] == 5 && $chantier_spatial >= 5 && $reacteur_f >= 4 && $blindage >= 5) { + elseif ($_GET['type'] == 5 && $chantier_spatial >= 5 && $reacteur_f >= 4 && $blindage >= 5) { $metal -= 15000*$sa; $cristal -= 9000*$sa; $hydrogene -= 1000*$sa; $temps_s = ceil(7380/pow(1.25,($chantier_spatial-5))); $vai = 5; } - elseif ($_POST['type'] == 6 && $chantier_spatial >= 1 && $reacteur >= 4) { + elseif ($_GET['type'] == 6 && $chantier_spatial >= 1 && $reacteur >= 4) { $metal -= 1700*$sa; $cristal -= 1220*$sa; $temps_s = ceil(1200/pow(1.25,($chantier_spatial-1))); $vai = 6; } - elseif ($_POST['type'] == 7 && $chantier_spatial >= 3 && $reacteur_f >= 3 && $armement >=1) { + elseif ($_GET['type'] == 7 && $chantier_spatial >= 3 && $reacteur_f >= 3 && $armement >=1) { $metal -= 5800*$sa; $cristal -= 1400*$sa; $temps_s = ceil(4680/pow(1.25,($chantier_spatial-3))); $vai = 7; } - elseif ($_POST['type'] == 8 && $chantier_spatial >= 6 && $reacteur_ff >= 2 && $armement >= 3 && $blindage >= 4) { + elseif ($_GET['type'] == 8 && $chantier_spatial >= 6 && $reacteur_ff >= 2 && $armement >= 3 && $blindage >= 4) { $metal -= 20000*$sa; $cristal -= 16000*$sa; $hydrogene -= 1600*$sa; $temps_s = ceil(16800/pow(1.25,($chantier_spatial-6))); $vai = 8; } - elseif ($_POST['type'] == 9 && $chantier_spatial >= 6 && $reacteur_ff >= 3 && $armement >= 4 && $blindage >= 4) { + elseif ($_GET['type'] == 9 && $chantier_spatial >= 6 && $reacteur_ff >= 3 && $armement >= 4 && $blindage >= 4) { $metal -= 26000*$sa; $cristal -= 16400*$sa; $hydrogene -= 1600*$sa; $temps_s = ceil(18060/pow(1.25,($chantier_spatial-6))); $vai = 9; } - elseif ($_POST['type'] == 10 && $chantier_spatial >= 8 && $reacteur_ff >= 5 && $armement >=6 && $blindage >= 6) { + elseif ($_GET['type'] == 10 && $chantier_spatial >= 8 && $reacteur_ff >= 5 && $armement >=6 && $blindage >= 6) { $metal -= 60000*$sa; $cristal -= 40000*$sa; $hydrogene -= 3000*$sa; $temps_s = ceil(32400/pow(1.25,($chantier_spatial-8))); $vai = 10; } - elseif ($_POST['type'] == 11 && $chantier_spatial >= 12 && $reacteur_ff >= 10 && $armement >= 12 && $blindage >= 12) { + elseif ($_GET['type'] == 11 && $chantier_spatial >= 12 && $reacteur_ff >= 10 && $armement >= 12 && $blindage >= 12) { $metal -= 500000*$sa; $cristal -= 400000*$sa; $hydrogene -= 250000*$sa; $temps_s = ceil(117000/pow(1.25,($chantier_spatial-12))); $vai = 11; } - elseif ($_POST['type'] == 12 && $chantier_spatial >= 12 && $reacteur_ff >= 10 && $armement >= 12 && $blindage >= 12) { + elseif ($_GET['type'] == 12 && $chantier_spatial >= 12 && $reacteur_ff >= 10 && $armement >= 12 && $blindage >= 12) { $metal -= 500000*$sa; $cristal -= 400000*$sa; $hydrogene -= 250000*$sa; diff --git a/pages/charg.php b/pages/charg.php index b636585..e2b0e78 100644 --- a/pages/charg.php +++ b/pages/charg.php @@ -16,7 +16,7 @@ print ' '; -require_once 'bdd.php'; +include_once('common.php'); print '
Chargement de votre compte en cours ...
diff --git a/pages/common.php b/pages/common.php new file mode 100644 index 0000000..833034f --- /dev/null +++ b/pages/common.php @@ -0,0 +1,25 @@ + \ No newline at end of file diff --git a/pages/creerflotte.php b/pages/creerflotte.php index cff2c9b..f3cdf52 100644 --- a/pages/creerflotte.php +++ b/pages/creerflotte.php @@ -5,127 +5,18 @@ if (isset($_POST['vaisseau1']) || isset($_POST['vaisseau2']) || isset($_POST['va isset($_POST['vaisseau5']) || isset($_POST['vaisseau6']) || isset($_POST['vaisseau7']) || isset($_POST['vaisseau8']) || isset($_POST['vaisseau9']) || isset($_POST['vaisseau10']) || isset($_POST['vaisseau11']) || isset($_POST['vaisseau12'])) { -define('DESIGN', 'descriptions/diz/base.css'); -define('HEAD', ''); - $id=$_SESSION['id']; +$auth_level = $_SESSION['auth_level']; $galaxy=$_SESSION['galaxy']; $ss=$_SESSION['ss']; $pos=$_SESSION['pos']; -require_once('noms.php'); -require_once('bdd.php'); +include_once('common.php'); require_once('../fonctions.php'); require('../connectBDD.php'); - if (isset($_POST['action']) && $_POST['action'] == 'avt') { -require('../header.php'); -require_once('ressource.php'); -?> -
- -'; -if (isset($_POST['vaisseau2'])) print ''; -if (isset($_POST['vaisseau3'])) print ''; -if (isset($_POST['vaisseau4'])) print ''; -if (isset($_POST['vaisseau5'])) print ''; -if (isset($_POST['vaisseau6'])) print ''; -if (isset($_POST['vaisseau7'])) print ''; -if (isset($_POST['vaisseau8'])) print ''; -if (isset($_POST['vaisseau9'])) print ''; -if (isset($_POST['vaisseau10'])) print ''; -if (isset($_POST['vaisseau11'])) print ''; -if (isset($_POST['vaisseau12'])) print ''; - -$AvaisType = ''; $AvaisVitesseC = ''; $AvaisVitesseL = ''; $AvaisPrepC = ''; $AvaisChauffe = ''; $AvaisContenu = 0; -for ($i=0 ; $i<=12 ; $i++) { - for ($j = 1; $j <= $_POST['vaisseau'.$i]; $j++) { - $AvaisType .= ($i).' '; - $AvaisVitesseC .= $nomvais_dc[$i].' '; - $AvaisVitesseL .= $nomvais_dl[$i].' '; - $AvaisContenu += $nomvais_rs[$i].' '; - $AvaisPrepC .= $nomvais_pdc[$i].' '; - $AvaisPrepL .= $nomvais_pdl[$i].' '; - $AvaisChauffe .= $nomvais_cdl[$i].' '; - } -} -$AvaisType = split(' ', trim($AvaisType)); $AvaisVitesseC = split(' ', trim($AvaisVitesseC)); $AvaisVitesseL = split(' ', trim($AvaisVitesseL)); $AvaisContenu = split(' ', trim($AvaisContenu)); $AvaisPrepC = split(' ', trim($AvaisPrepC)); $AvaisPrepL = split(' ', trim($AvaisPrepL)); $AvaisChauffe = split(' ', trim($AvaisChauffe)); -//if(min($AvaisVitesseC) == 0 && min($AvaisVitesseL) == 0) { print ''; exit; } -if(min($AvaisVitesseC) == 0 && min($AvaisVitesseL) == 0) $AvaisVitesseL = $AvaisVitesseC; -?> - - - - - - - - - - - - - -
Préparation de la flotte
Nom
Destination::
Vitesse
Temps de déplacement
Consomation
Mission & Contenu
Mission
Métal
Cristal
Hydrogène
-
- $informatique + 1) { @@ -232,16 +123,17 @@ if (isset($_POST['vaisseau3']) && $_POST['vaisseau3'] > 0) print '