= $ress_ness_metal && $calcium >= $ress_ness_calcium && $nourriture >= $ress_ness_nourriture) return '
';
else return 'Vous n\'avez pas suffisament de ressources';
}
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;
}
$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('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;
// 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 (!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));
}
// 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 (!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));
}
// 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 (!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));
}
// 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 (!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));
}
// 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 (!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));
}
// 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 (!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));
}
// 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 (!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));
}
// 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 (!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));
}
// 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 (!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));
}
// 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 (!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));
}
// 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 (!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));
}
// 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 (!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));
}
$template->pparse('chantier_spatial');
}
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');
}
?>