game/pages/laboratoire.php

276 lines
23 KiB
PHP

<?php
session_start();
$id=$_SESSION['id'];
$galaxy=$_SESSION['galaxy'];
$ss=$_SESSION['ss'];
$pos=$_SESSION['pos'];
$_SESSION['dernPage'] = 'laboratoire.php';
include_once('common.php');
require('../template.php');
$template = new Template('../templates/'.$templates);
/* 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 '<span style="color: teal"><a href="laboratoire_validation.php?tec='.$numtec.'">Rechercher</a></span>';
else return '<span style="color: #FF0000;">Rechercher</span>';
}
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 'includes/noms.php';
$return = '';
if ($need_fer > 0) {
if ($fer <= $need_fer) {
$z=floor($fer)-$need_fer;
$return .= '<span style="color: #FF0000;">'.$ressourc[0].' : <acronym title="Manque : '.separerNombres(abs($z)).' unités de '.$ressourc[0].'">'.separerNombres($need_fer).'</acronym></span> ';
}
else $return .= $ressourc[0].' : <span class="rc">'.separerNombres($need_fer).' </span>';
}
if ($need_cristal > 0) {
if ($cristal <= $need_cristal) {
$z=floor($cristal)-$need_cristal;
$return .= '<span style="color: #FF0000;">'.$ressourc[1].' : <acronym title="Manque : '.separerNombres(abs($z)).' unités de '.$ressourc[1].'">'.separerNombres($need_cristal).'</acronym></span> ';
}
else $return .= $ressourc[1].' : <span class="rc">'.separerNombres($need_cristal).' </span>';
}
if ($need_ro > 0) {
if ($ro <= $need_ro) {
$z=floor($ro)-$need_ro;
$return .= '<span style="color: #FF0000;">'.$ressourc[2].' : <acronym title="Manque : '.separerNombres(abs($z)).' unités de '.$ressourc[2].'">'.separerNombres($need_ro).'</acronym></span>';
}
else $return .= $ressourc[2].' : <span class="rc">'.separerNombres($need_ro).'</span>';
}
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 = '<div class="centre"><table style="margin-left: auto; margin-right: auto;"><tr><td><font color="#FF0000"><b>Cette technologie est déjà en cours de recherche, vous ne pouvez pas la rajouter dans la file d\'attente</b></font></td></tr></table></div><br />';
elseif ($_GET['err'] == 2) $ERREUR = '<div class="centre"><table style="margin-left: auto; margin-right: auto;"><tr><td><font color="#FFCC00"><b>La production à la chaîne a été arrêtée</b></font></td></tr></table></div><br />';
$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 : <span id="axion"></span><br /><script type="text/javascript">reste('.$tr.');</script>'; }
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 : <span id="axion"></span><br /><script type="text/javascript">reste('.$tr.');</script>'; }
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 : <span id="axion"></span><br /><script type="text/javascript">reste('.$tr.');</script>'; }
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 : <span id="axion"></span><br /><script type="text/javascript">reste('.$tr.');</script>'; }
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 : <span id="axion"></span><br /><script type="text/javascript">reste('.$tr.');</script>'; }
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 : <span id="axion"></span><br /><script type="text/javascript">reste('.$tr.');</script>'; }
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 : <span id="axion"></span><br /><script type="text/javascript">reste('.$tr.');</script>'; }
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 : <span id="axion"></span><br /><script type="text/javascript">reste('.$tr.');</script>'; }
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 : <span id="axion"></span><br /><script type="text/javascript">reste('.$tr.');</script>'; }
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 : <span id="axion"></span><br /><script type="text/javascript">reste('.$tr.');</script>'; }
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 : <span id="axion"></span><br /><script type="text/javascript">reste('.$tr.');</script>'; }
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' => '<span id="axion"></span><script type="text/javascript">reste('.$tr.');</script> - '));
else $CHAINE = ' <br /> <a href="annul_tec.php?tec=e"><i>Arrêter de produire à la chaîne</i></a>';
}
$FILETXT = '';
if ($i == 1 && $tec_boucle == false) $CHAINE = ' <br /> <a href="laboratoire_validation.php?tec=e"><i>Produire à la chaîne</i></a>';
}
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
*
*/
require('../connectBDD.php');
$result = mysql_query("SELECT * FROM version ORDER BY temps DESC");
$data = mysql_fetch_array($result);
$version = $data['version'];
mysql_close();
$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 ; $i<count($Aplan_value) ; $i++) {
$template->assign_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', 'laboratoire');
$template->pparse('base');
?>