Version 0.9a

This commit is contained in:
nemunaire 2007-11-13 12:00:00 +01:00
commit 59fbc7104e
141 changed files with 8686 additions and 1156 deletions

View file

@ -6,23 +6,47 @@ $galaxy=$_SESSION['galaxy'];
$ss=$_SESSION['ss'];
$pos=$_SESSION['pos'];
$_SESSION['dernPage'] = 'defense.php';
require_once '../securite.php';
echo"<html>
<head>
<title>Halo battle</title>
<link rel=stylesheet media=screen type=text/css title=design href=descriptions/diz/base.css >
<meta http-equiv=pragma content=no-cache >
<meta http-equiv=content-type content=text/html;charset=iso-8869-1 >
<link rel=shortcut icon type=image/x-icon href=favicon.ico >";
require_once 'bdd.php';
require_once 'ressource.php';
require_once 'chantier_terrestre_ajout.php';
require_once('../securite.php');
require_once 'ressourcetem.php';
require_once 'noms.php';
require('../template.php');
$template = new Template('../templates/'.$templates);
function sec ($time) {
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 '<form method="post" action="defense_validation.php"><input type="text" class="zone_texte" size="4" maxlength="4" name="sa" /><input type="hidden" name="type" value="'.$numtec.'" /><br /><input type="submit" value="Envoyer" class="bouton"></form>';
else return '<font color="red">Vous n\'avez pas suffisament de ressources</font>';
}
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 .= '<font color="red">'.$ressourc[0].' : <acronym title="Manque : '.abs($z).' unités de '.$ressourc[0].'">'.$need_fer.'</acronym></font> ';
}
else $return .= $ressourc[0].' : <span class="rc">'.$need_fer.' </span>';
}
if ($need_cristal > 0) {
if ($cristal <= $need_cristal) {
$z=floor($cristal)-$need_cristal;
$return .= '<font color="red">'.$ressourc[1].' : <acronym title="Manque : '.abs($z).' unités de '.$ressourc[0].'">'.$need_cristal.'</acronym></font> ';
}
else $return .= $ressourc[1].' : <span class="rc">'.$need_cristal.' </span>';
}
if ($need_ro > 0) {
if ($ro <= $need_ro) {
$z=floor($ro)-$need_ro;
$return .= '<font color="red">'.$ressourc[2].' : <acronym title="Manque : '.abs($z).' unités de '.$ressourc[0].'">'.$need_ro.'</acronym></font>';
}
else $return .= $ressourc[2].' : <span class="rc">'.$need_ro.'</span>';
}
return $return;
}
function sec($time) {
$output = '';
$tab = array ('jour' => '86400', 'heure' => '3600', 'minute' => '60', 'seconde' => '1');
foreach ($tab as $key => $value) {
@ -37,7 +61,7 @@ function sec ($time) {
if ($value != 1) $output .= ' ';
}
}
echo $output;
return $output;
}
@ -48,128 +72,116 @@ $i = ceil(6720/pow(1.25,($chantier_terrestre-4)));
$j = ceil(12960/pow(1.25,($chantier_terrestre-8)));
if ($temps_t > 0) $unit = $nomterra[--$unit_v];
if ($temps_t > 0) $unit = $nomterra[--$unit_t];
?>
<script language="javascript" src="time.js"></script>
</head>
<body>
<script language="javascript" src="time.js"></script>
<?php
if ($chantier_terrestre > 0) {
if ($temps_t > 0) {
echo "<table align=center><tr><td>
Construction terminé dans : ";
$tr=$temps_t-time();
echo '<span id="axion"></span>';
echo '<script language="JavaScript">reste('.$tr.');</script>';
echo '</td></tr><tr><td>Construction de : '.$cons_terrestre.' '.$unit.'</td></tr></table><br>';
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 />';
elseif ($_GET['err'] == 3) $ERREUR = '<div class="centre"><table style="margin-left: auto; margin-right: auto;"><tr><td><font color="#FF0000"><b>Vous n\'avez pas assez de ressources pour construire autant de défenses</b></font></td></tr></table></div><br />';
$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 ; $i<count($Aplan_value) ; $i++) {
$template->assign_block_vars('planetes',array('RES_VALUE' => $Aplan_value[$i], 'RES_MORE' => $Aplan_more[$i], 'RES_REF' => $Aplan_ref[$i]));
}
$template->set_filenames(array('defenses' => 'defenses.tpl'));
$template->assign_var_from_handle('RESSOURCES', 'ressourcestpl');
$CHAINE = '';
if (!empty($fileVeh[0])) {
$comp = 1;
for ($i=0 ; $i<count($fileVeh) ; $i++) {
if ($fileVeh[$i] != 'e') {
if ($fileVeh[$i+1] == $fileVeh[$i]) $comp++;
else {
$template->assign_block_vars('file',array('NOM' => $comp.' '.$nomterrn[$fileVeh[$i]-1], 'NUM' => $fileVeh[$i], 'I' => $i));
$comp = 1;
}
if ($chantier_terrestre >= 1) {
echo'<div class=d><a href="arbre_vehicules_'.$race.'.php">Arbre des technologies</a></div><br class="a">
<div class="centre"><table style="margin-left: auto; margin-right: auto;"><tr><td style="border:none; background: transparent;">
<div class=a>
<img src="images/terrestre/'.$nomterri[8].'" alt="" />
</div>
<div class=b>
<a href=\"descriptions/.php\">'.$nomterrn[8].'</a>'; if ($def_1 > 0) echo" (".$def_1." unités)";
echo '<br><span class="description">'.$nomterde[8].'</span><br>Besoin de : '.$ressourc[0].' : <span class=rc>500</span> '.$ressourc[1].' : <span class=rc>200</span><br>
Temps de construction : '; sec($f);
echo '</div>
<div class="c">';
echo'<form method="post" action="validation_def.php">';
if ($bat == 8) echo '<br><br><br>Chantier terrestre en construction';
else {
if ($metal >= 500 && $cristal >= 200) { if ($temps_t < time()) { echo '<br><br><br><input type="text" class="zone_texte" size="4" maxlength="4" name="cons_def_1" /><br><input type="submit" value="Envoyer" class="bouton"">'; }}
else {
if ($unit_t<9 && $unit_t>0) echo '<br><br><font color="red">Construction en cours dans le </font><a href="chantier_terrestre.php">chantier terrestre</a>';
}
}
echo '</form></div><br class=a>'; }
}
}
$FILETXT = '';
}
else $FILETXT = 'Aucune défense en attente';
if ($chantier_terrestre >= 3 && $energie_t >=2) {
echo'<div class=a>
<img src="images/terrestre/'.$nomterri[9].'" alt="" />
</div>
<div class=b>
<a href=\"descriptions/.php\">'.$nomterrn[9].'</a>'; if ($def_2 > 0) echo" (".$def_2." unités)";
echo '<br><span class="description">'.$nomterde[9].'</span><br>Besoin de : '.$ressourc[0].' : <span class=rc>4.000</span> '.$ressourc[1].' : <span class=rc>2.000</span><br>
Temps de construction : '; sec($g);
echo '</div>
<div class="c">';
echo'<form method="post" action="validation_def.php">';
if ($bat == 8) echo '<br><br><br>Chantier terrestre en construction';
else {
if ($metal >= 4000 && $cristal >= 2000) { if ($temps_t < time()) { echo '<br><br><br><input type="text" class="zone_texte" size="4" maxlength="4" name="cons_def_2" /><br><input type="submit" value="Envoyer" class="bouton"">'; }}
else {
if ($unit_t<9 && $unit_t>0) echo '<br><br><font color="red">Construction en cours dans le </font><a href="chantier_terrestre.php">chantier terrestre</a>';
}
}
echo '</form></div><br class=a>'; }
$tr = $fileTemps_v[0] + $fileTemps_v[1] - time();
if (!empty($fileVeh[0])) $RESTE = $action = '<script type="text/javascript">reste('.$tr.');</script>';
else $RESTE = '';
if ($chantier_terrestre >= 4 && $armement >= 1) {
echo'<div class=a>
<img src="images/terrestre/'.$nomterri[10].'" alt="" />
</div>
<div class=b>
<a href=\"descriptions/.php\">'.$nomterrn[10].'</a>'; if ($def_3 > 0) echo" (".$def_3." unités)";
echo '<br><span class="description">'.$nomterde[10].'</span><br>Besoin de : '.$ressourc[0].' : <span class=rc>4.500</span> '.$ressourc[1].' : <span class=rc>800</span> '.$ressourc[2].' : <span class=rc>600</span><br>
Temps de construction : '; sec($h);
echo '</div>
<div class="c">';
echo'<form method="post" action="validation_def.php">';
if ($bat == 8) echo '<br><br><br>Chantier terrestre en construction';
else {
if ($metal >= 4500 && $cristal >= 800 && $hydrogene >= 600) { if ($temps_t < time()) { echo '<br><br><br><input type="text" class="zone_texte" size="4" maxlength="4" name="cons_def_3" /><br><input type="submit" value="Envoyer" class="bouton"">'; }}
else {
if ($unit_t<9 && $unit_t>0) echo '<br><br><font color="red">Construction en cours dans le </font><a href="chantier_terrestre.php">chantier terrestre</a>';
}
}
echo '</form></div><br class=a>'; }
$template->assign_vars(array('RACE' => $race, 'FILETXT' => $FILETXT, 'CHAINE' => $CHAINE, 'RESTE' => $RESTE));
if ($chantier_terrestre >= 4 && $armement >= 3 && $energie_t >= 3) {
echo'<div class=a>
<img src="images/terrestre/'.$nomterri[11].'" alt="" />
</div>
<div class=b>
<a href=\"descriptions/.php\">'.$nomterrn[11].'</a>'; if ($def_4 > 0) echo" (".$def_4." unités)";
echo '<br><span class="description">'.$nomterde[11].'</span><br>Besoin de : '.$ressourc[0].' : <span class=rc>12.000</span> '.$ressourc[1].' : <span class=rc>10.000</span> '.$ressourc[2].' : <span class=rc>1.000</span><br>
Temps de construction : '; sec($i);
echo '</div>
<div class="c">';
echo'<form method="post" action="validation_def.php">';
if ($bat == 8) echo '<br><br><br>Chantier terrestre en construction';
else {
if ($metal >= 12000 && $cristal >= 10000 && $hydrogene >= 1000) { if ($temps_t < time()) { echo '<br><br><br><input type="text" class="zone_texte" size="4" maxlength="4" name="cons_def_4" /><br><input type="submit" value="Envoyer" class="bouton"">'; }}
else {
if ($unit_t<9 && $unit_t>0) echo '<br><br><font color="red">Construction en cours dans le </font><a href="chantier_terrestre.php">chantier terrestre</a>';
}
}
echo '</form></div><br class=a>'; }
$a=0; $b=0; $c=0;
if ($chantier_terrestre >= 8 && $armement >= 5 && $informatique >= 4) {
echo'<div class=a>
<img src="images/terrestre/'.$nomterri[12].'" alt="" />
</div>
<div class=b>
<a href=\"descriptions/.php\">'.$nomterrn[12].'</a>'; if ($def_5 > 0) echo" (".$def_5." unités)";
echo '<br><span class="description">'.$nomterde[12].'</span><br>Besoin de : '.$ressourc[0].' : <span class=rc>15.000</span> '.$ressourc[1].' : <span class=rc>9.500</span> '.$ressourc[2].' : <span class=rc>1.500</span><br>
Temps de construction : '; sec($j);
echo '</div>
<div class="c">';
echo'<form method="post" action="validation_def.php">';
if ($bat == 8) echo '<br><br><br>Chantier terrestre en construction';
else {
if ($metal >= 15000 && $cristal >= 9500 && $hydrogene >= 1500) { if ($temps_t < time()) { echo '<br><br><br><input type="text" class="zone_texte" size="4" maxlength="4" name="cons_def_5" /><br><input type="submit" value="Envoyer" class="bouton"">'; }}
else {
if ($unit_t<9 && $unit_t>0) echo '<br><br><font color="red">Construction en cours dans le </font><a href="chantier_terrestre.php">chantier terrestre</a>';
}
}
echo '</form></div><br class=a>'; }
// 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 (!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));
}
} else echo '<table align=center><tr><td>Vous devez d\'abord construire un chantier terrestre !</td></tr></table>';
?>
</body>
</html>
// 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 (!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));
}
// 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 (!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));
}
// 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 (!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));
}
// 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 (!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));
}
$template->pparse('defenses');
}
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 ; $i<count($Aplan_value) ; $i++) {
$template->assign_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');
}
?>