Réactive l'envois de flotte #18

Merged
nemunaire merged 15 commits from task/fix_envoi_flotte into master 2021-01-30 17:36:33 +00:00
15 changed files with 623 additions and 149 deletions

View File

@ -9,12 +9,12 @@ require_once("Class/JSON.php");
require_once("Class/flotte.php"); require_once("Class/flotte.php");
require_once("Class/planete.php"); require_once("Class/planete.php");
if (isset($SESS) && isset($SESS->values['connected']) && $SESS->values['connected'] && !empty($SESS->values['id']) && !empty($SESS->level) && !empty($SESS->values['idPlan'])) { if (isset($SESS) && isset($SESS->values['connected']) && $SESS->values['connected'] && !empty($SESS->values['id']) && !empty($SESS->values['idPlan'])) {
$idPrep = gpc("cds_temp", "post"); $idPrep = gpc("cds_temp", "post");
$json = new Services_JSON(); $json = new Services_JSON();
$nbtrajet = 2; $nbtrajet = 2;
if (empty($config['flottes']) && $SESS->level <= 1) { if (empty($VAR['flottes']) && $SESS->level <= 1) {
$datas = array( $datas = array(
'root' => array( 'root' => array(
'destination' => '<input class="dest" type="text" id="amas" name="amas" maxlength="2" value="'.gpc('galaxie', 'post').'" />:<input class="dest" type="text" id="ss" name="ss" maxlength="2" value="'.gpc('ss', 'post').'" />:<input class="dest" type="text" id="plan" name="pos" maxlength="2" value="'.gpc('pos', 'post').'" />', 'destination' => '<input class="dest" type="text" id="amas" name="amas" maxlength="2" value="'.gpc('galaxie', 'post').'" />:<input class="dest" type="text" id="ss" name="ss" maxlength="2" value="'.gpc('ss', 'post').'" />:<input class="dest" type="text" id="plan" name="pos" maxlength="2" value="'.gpc('pos', 'post').'" />',
@ -107,7 +107,8 @@ if (isset($SESS) && isset($SESS->values['connected']) && $SESS->values['connecte
$places -= ($met+$cri+$hyd); $places -= ($met+$cri+$hyd);
} }
$tactique = ''; $tactique = '';
if ($_POST['mission'] == '1') { // si la mission est une mission d'attaque
if ($_POST['mission'] == '3') {
$tactique = '<label for="selecttactique">Tactique d\'attaque :</label><select id="selecttactique" name="tactique">'; $tactique = '<label for="selecttactique">Tactique d\'attaque :</label><select id="selecttactique" name="tactique">';
//On récupère le niveau actuel de la technologie Commandement militaire //On récupère le niveau actuel de la technologie Commandement militaire
$id_user = $SESS->values['id']; $id_user = $SESS->values['id'];

View File

@ -87,10 +87,12 @@ class dDonnees
} }
} }
public static function print_neededCheck($tableau, surface $planete) public static function print_neededCheck($tableau, surface $planete, $race = null)
{ {
global $LANG; global $LANG;
$race = $planete->race; if ($race == null) {
$race = $planete->race;
}
if (!is_array($tableau)) { if (!is_array($tableau)) {
return 'Débloqué'; return 'Débloqué';
} else { } else {

View File

@ -3,9 +3,12 @@ require_once("Class/Donnees/interface.php");
class dSpatial implements Donnees class dSpatial implements Donnees
{ {
public static function metal($id, $nombre, surface $planete) public static function metal($id, $nombre, surface $planete, $race = null)
{ {
if ($planete->race == "humain") { if ($race == null) {
$race = $planete->race;
}
if ($race == "humain") {
switch ($id) { switch ($id) {
case 0: case 0:
$metal = 1000; $metal = 1000;
@ -118,9 +121,12 @@ class dSpatial implements Donnees
return $metal * $nombre; return $metal * $nombre;
} }
public static function cristal($id, $nombre, surface $planete) public static function cristal($id, $nombre, surface $planete, $race = null)
{ {
if ($planete->race == "humain") { if ($race == null) {
$race = $planete->race;
}
if ($race == "humain") {
switch ($id) { switch ($id) {
case 0: case 0:
$cristal = 800; $cristal = 800;
@ -233,9 +239,12 @@ class dSpatial implements Donnees
return $cristal * $nombre; return $cristal * $nombre;
} }
public static function hydrogene($id, $nombre, surface $planete) public static function hydrogene($id, $nombre, surface $planete, $race = null)
{ {
if ($planete->race == "humain") { if ($race == null) {
$race = $planete->race;
}
if ($race == "humain") {
switch ($id) { switch ($id) {
case 0: case 0:
$hydrogene = 180; $hydrogene = 180;
@ -348,14 +357,17 @@ class dSpatial implements Donnees
return $hydrogene * $nombre; return $hydrogene * $nombre;
} }
public static function credits($id, $nombre, surface $planete) public static function credits($id, $nombre, surface $planete, $race = null)
{ {
return 0; return 0;
} }
public static function temps($id, $nombre, surface $planete) public static function temps($id, $nombre, surface $planete, $race = null)
{ {
if ($planete->race == "humain") { if ($race == null) {
$race = $planete->race;
}
if ($race == "humain") {
switch ($id) { switch ($id) {
case 0: case 0:
$temps = 733; $temps = 733;
@ -502,10 +514,12 @@ class dSpatial implements Donnees
} }
} }
public static function image($id, surface $planete, $race = null)
public static function image($id, surface $planete)
{ {
if ($planete->race == "humain") { if ($race == null) {
$race = $planete->race;
}
if ($race == "humain") {
switch ($id) { switch ($id) {
case 0: case 0:
return "csnucargoparabola2mc9.jpg"; return "csnucargoparabola2mc9.jpg";
@ -542,7 +556,7 @@ class dSpatial implements Donnees
break; break;
} }
return Donnees::image_humain_default; return Donnees::image_humain_default;
} elseif ($planete->race == "covenant") { } else {
switch ($id) { switch ($id) {
case 0: case 0:
return "cargo2pb6.jpg"; return "cargo2pb6.jpg";
@ -553,39 +567,32 @@ class dSpatial implements Donnees
case 2: case 2:
return "colocopiers4.jpg"; return "colocopiers4.jpg";
break; break;
case 3: case 6:
return "sonde_despionnage1.jpg";
break;
case 4:
return "chasseurlourd7id.jpg"; return "chasseurlourd7id.jpg";
break; break;
case 5:
return "contactharvestbynameleszk3.jpg";
break;
case 6:
return "vaisseauuu0.jpg";
break;
case 7: case 7:
return "vaisseaudebataille9na.jpg"; return "sonde_despionnage1.jpg";
break; break;
case 8: case 8:
return "pv.jpg"; return "contactharvestbynameleszk3.jpg";
break; break;
case 9: case 9:
return "stationorbitalezt7.jpg"; return "vaisseauuu0.jpg";
break; break;
case 10: case 10:
return "vaisseaudebataille9na.jpg";
break;
case 14:
return "pv.jpg";
break;
case 16:
return "citecovenant.jpg"; return "citecovenant.jpg";
break; break;
} }
return Donnees::image_covenant_default; return Donnees::image_covenant_default;
} else {
trigger_error("Impossible de trouver la race pour ".$planete->race, E_USER_ERROR);
} }
} }
public static function needed($id, surface $planete, $print = false, $race = null) public static function needed($id, surface $planete, $print = false, $race = null)
{ {
if ($race == null) { if ($race == null) {
@ -648,8 +655,8 @@ class dSpatial implements Donnees
array('technologies', 7,9) array('technologies', 7,9)
), ),
array( array(
array('batiments', 8, 10), array('batiments', 8, 3),
array('technologies', 7,10) array('technologies', 7, 4)
) )
); );
} else { } else {
@ -727,16 +734,18 @@ class dSpatial implements Donnees
} }
if ($print) { if ($print) {
return dDonnees::print_neededCheck($neededSpatial[$id], $planete); return dDonnees::print_neededCheck($neededSpatial[$id], $planete, $race);
} else { } else {
return dDonnees::neededCheck($neededSpatial[$id], $planete); return dDonnees::neededCheck($neededSpatial[$id], $planete);
} }
} }
public static function tailleCales($id, surface $planete, $race = null)
public static function tailleCales($id, surface $planete)
{ {
if ($planete->race == "humain") { if ($race == null) {
$race = $planete->race;
}
if ($race == "humain") {
switch ($id) { switch ($id) {
case 0: case 0:
$vitesse = 10000; $vitesse = 10000;
@ -845,7 +854,6 @@ class dSpatial implements Donnees
return $vitesse; return $vitesse;
} }
public static function vitesseP($id, surface $planete) public static function vitesseP($id, surface $planete)
{ {
if ($planete->race == "humain") { if ($planete->race == "humain") {
@ -1178,4 +1186,346 @@ class dSpatial implements Donnees
//On tient compte des bonus //On tient compte des bonus
return $vitesse; return $vitesse;
} }
public static function attaque($id, surface $planete, $race = null)
{
if ($race == null) {
$race = $planete->race;
}
if ($race == "humain") {
switch ($id) {
case 0:
$attaque = 10;
break;
case 1:
$attaque = 20;
break;
case 2:
$attaque = 20;
break;
case 3:
$attaque = 20;
break;
case 4:
$attaque = 50;
break;
case 5:
$attaque = 250;
break;
case 6:
$attaque = 720;
break;
case 7:
$attaque = 1240;
break;
case 8:
$attaque = 1990;
break;
case 9:
$attaque = 3250;
break;
case 10:
$attaque = 4250;
break;
case 11:
$attaque = 8500;
break;
case 12:
$attaque = 16000;
break;
case 13:
$attaque = 20;
break;
default:
trigger_error("Vaisseau ".$id." introuvable dans les données", E_USER_ERROR);
}
} else {
switch ($id) {
case 0:
$attaque = 0;
break;
case 1:
$attaque = 25;
break;
case 2:
$attaque = 25;
break;
case 3:
$attaque = 25;
break;
case 4:
$attaque = 50;
break;
case 5:
$attaque = 100;
break;
case 6:
$attaque = 250;
break;
case 7:
$attaque = 740;
break;
case 8:
$attaque = 1300;
break;
case 9:
$attaque = 2000;
break;
case 10:
$attaque = 3400;
break;
case 11:
$attaque = 4400;
break;
case 12:
$attaque = 9300;
break;
case 13:
$attaque = 8400;
break;
case 14:
$attaque = 8300;
break;
case 15:
$attaque = 11500;
break;
case 16:
$attaque = 0;
break;
default:
trigger_error("Vaisseau ".$id." introuvable dans les données", E_USER_ERROR);
}
}
//On tient compte des bonus
return $attaque;
}
public static function bouclier($id, surface $planete, $race = null)
{
if ($race == null) {
$race = $planete->race;
}
if ($race == "humain") {
switch ($id) {
case 0:
$bouclier = 500;
break;
case 1:
$bouclier = 2000;
break;
case 2:
$bouclier = 2000;
break;
case 3:
$bouclier = 1500;
break;
case 4:
$bouclier = 250;
break;
case 5:
$bouclier = 1000;
break;
case 6:
$bouclier = 1750;
break;
case 7:
$bouclier = 3000;
break;
case 8:
$bouclier = 5000;
break;
case 9:
$bouclier = 9000;
break;
case 10:
$bouclier = 10000;
break;
case 11:
$bouclier = 10250;
break;
case 12:
$bouclier = 12750;
break;
case 13:
$bouclier = 750;
break;
default:
trigger_error("Vaisseau ".$id." introuvable dans les données", E_USER_ERROR);
}
} else {
switch ($id) {
case 0:
$bouclier = 400;
break;
case 1:
$bouclier = 1800;
break;
case 2:
$bouclier = 2000;
break;
case 3:
$bouclier = 400;
break;
case 4:
$bouclier = 200;
break;
case 5:
$bouclier = 300;
break;
case 6:
$bouclier = 900;
break;
case 7:
$bouclier = 1500;
break;
case 8:
$bouclier = 3000;
break;
case 9:
$bouclier = 4600;
break;
case 10:
$bouclier = 8000;
break;
case 11:
$bouclier = 9000;
break;
case 12:
$bouclier = 15000;
break;
case 13:
$bouclier = 10400;
break;
case 14:
$bouclier = 9700;
break;
case 15:
$bouclier = 11500;
break;
case 16:
$bouclier = 50000;
break;
default:
trigger_error("Vaisseau ".$id." introuvable dans les données", E_USER_ERROR);
}
}
//On tient compte des bonus
return $bouclier;
}
public static function armature($id, surface $planete, $race = null)
{
if ($race == null) {
$race = $planete->race;
}
if ($race == "humain") {
switch ($id) {
case 0:
$armature = 100;
break;
case 1:
$armature = 400;
break;
case 2:
$armature = 400;
break;
case 3:
$armature = 300;
break;
case 4:
$armature = 50;
break;
case 5:
$armature = 200;
break;
case 6:
$armature = 350;
break;
case 7:
$armature = 600;
break;
case 8:
$armature = 1000;
break;
case 9:
$armature = 1800;
break;
case 10:
$armature = 2000;
break;
case 11:
$armature = 2050;
break;
case 12:
$armature = 2550;
break;
case 13:
$armature = 150;
break;
default:
trigger_error("Vaisseau ".$id." introuvable dans les données", E_USER_ERROR);
}
} else {
switch ($id) {
case 0:
$armature = 200;
break;
case 1:
$armature = 600;
break;
case 2:
$armature = 800;
break;
case 3:
$armature = 120;
break;
case 4:
$armature = 100;
break;
case 5:
$armature = 150;
break;
case 6:
$armature = 300;
break;
case 7:
$armature = 600;
break;
case 8:
$armature = 600;
break;
case 9:
$armature = 1400;
break;
case 10:
$armature = 2800;
break;
case 11:
$armature = 3000;
break;
case 12:
$armature = 3000;
break;
case 13:
$armature = 3600;
break;
case 14:
$armature = 3600;
break;
case 15:
$armature = 3500;
break;
case 16:
$armature = 30000;
break;
default:
trigger_error("Vaisseau ".$id." introuvable dans les données", E_USER_ERROR);
}
}
//On tient compte des bonus
return $armature;
}
} }

View File

@ -1046,8 +1046,11 @@ class dTechnologies implements Donnees
} }
public static function needed($object, surface $planete, $print = false) public static function needed($object, surface $planete, $print = false, $race = null)
{ {
if ($race == null) {
$race = $planete->race;
}
switch ($object[0]) { switch ($object[0]) {
case 0: case 0:
$tableau = array( $tableau = array(
@ -1488,64 +1491,125 @@ class dTechnologies implements Donnees
); );
break; break;
case 7: case 7:
$tableau = array( if ($race == "humain") {
array( $tableau = array(
array('batiments', 6, 1) array(
), array('batiments', 6, 1)
array( ),
array("technologies", 7, 0), array(
array('batiments', 6, 2) array("technologies", 7, 0),
), array('batiments', 6, 2)
array( ),
array("technologies", 7, 1), array(
array('batiments', 6, 3) array("technologies", 7, 1),
), array('batiments', 6, 3)
array( ),
array("technologies", 7, 2), array(
array('batiments', 6, 5) array("technologies", 7, 2),
), array('batiments', 6, 5)
array( ),
array("technologies", 7, 1), array(
array('batiments', 6, 3) array("technologies", 7, 1),
), array('batiments', 6, 3)
array( ),
array("technologies", 7, 3), array(
array('batiments', 6, 8) array("technologies", 7, 3),
), array('batiments', 6, 8)
array( ),
array("technologies", 7, 5), array(
array('batiments', 6, 10) array("technologies", 7, 5),
), array('batiments', 6, 10)
array( ),
array("technologies", 7, 6), array(
array('batiments', 6, 15) array("technologies", 7, 6),
), array('batiments', 6, 15)
array( ),
array("technologies", 7, 7), array(
array('batiments', 6, 20) array("technologies", 7, 7),
), array('batiments', 6, 20)
array( ),
array("technologies", 7, 8), array(
array('batiments', 6, 30) array("technologies", 7, 8),
), array('batiments', 6, 30)
array( ),
array("technologies", 7, 5), array(
array('batiments', 6, 10) array("technologies", 7, 5),
), array('batiments', 6, 10)
array( ),
array("technologies", 7, 5), array(
array('batiments', 6, 10) array("technologies", 7, 4),
), array('batiments', 6, 3)
array( ),
array('batiments', 6, 5) array(
), array('batiments', 6, 5)
array( ),
array("technologies", 7, 12) array(
), array("technologies", 7, 12)
array( ),
array("technologies", 7, 13) array(
), array("technologies", 7, 13)
); ),
);
} else {
$tableau = array(
array(
array('batiments', 6, 1)
),
array(
array("technologies", 7, 0),
array('batiments', 6, 2)
),
array(
array("technologies", 7, 1),
array('batiments', 6, 3)
),
array(
array("technologies", 7, 2),
array('batiments', 6, 5)
),
array(
array("technologies", 7, 1),
array('batiments', 6, 3)
),
array(
array("technologies", 7, 3),
array('batiments', 6, 8)
),
array(
array("technologies", 7, 5),
array('batiments', 6, 10)
),
array(
array("technologies", 7, 6),
array('batiments', 6, 15)
),
array(
array("technologies", 7, 7),
array('batiments', 6, 20)
),
array(
array("technologies", 7, 8),
array('batiments', 6, 30)
),
array(
array("technologies", 7, 5),
array('batiments', 6, 10)
),
array(
array("technologies", 7, 5),
array('batiments', 6, 10)
),
array(
array('batiments', 6, 5)
),
array(
array("technologies", 7, 12)
),
array(
array("technologies", 7, 13)
),
);
}
break; break;
case 8: case 8:
$tableau = array( $tableau = array(
@ -1614,7 +1678,7 @@ class dTechnologies implements Donnees
} }
if ($print) { if ($print) {
return dDonnees::print_neededCheck($tableau[$object[1]], $planete); return dDonnees::print_neededCheck($tableau[$object[1]], $planete, $race);
} else { } else {
return dDonnees::neededCheck($tableau[$object[1]], $planete); return dDonnees::neededCheck($tableau[$object[1]], $planete);
} }

View File

@ -738,7 +738,7 @@ class dTerrestre implements Donnees
} }
if ($print) { if ($print) {
return dDonnees::print_neededCheck($neededTerrestre[$id], $planete); return dDonnees::print_neededCheck($neededTerrestre[$id], $planete, $race);
} else { } else {
return dDonnees::neededCheck($neededTerrestre[$id], $planete); return dDonnees::neededCheck($neededTerrestre[$id], $planete);
} }

View File

@ -562,6 +562,26 @@ class Flotte
} }
public function attaquer()
{
//Si la planète d'arrivé n'est pas chargée, on charge les planètes
if (is_numeric($this->end_planete)) {
$this->load_planete();
}
//On charge la classe des combats
//On réalise le combat
//On envoit le résultat
//On update la flotte avec les pertes et gains
//On dis à la flotte de rentrer
$this->statut = 1;
$this->addModifFlotte("statut");
}
public function espionner() public function espionner()
{ {
//Si la planète d'arrivé n'est pas chargée, on charge les planètes //Si la planète d'arrivé n'est pas chargée, on charge les planètes
@ -573,17 +593,17 @@ class Flotte
if (($this->start_planete->technologies[1]& 67108864) == 67108864) { if (($this->start_planete->technologies[1]& 67108864) == 67108864) {
$espionnage_A = 3; $espionnage_A = 3;
} elseif (($this->start_planete->technologies[1]& 33554432) == 33554432) { } elseif (($this->start_planete->technologies[1]& 33554432) == 33554432) {
$espionnage_A = 3; $espionnage_A = 2;
} elseif (($this->start_planete->technologies[1]& 16777216) == 16777216) { } elseif (($this->start_planete->technologies[1]& 16777216) == 16777216) {
$espionnage_A = 3; $espionnage_A = 1;
} else { } else {
$espionnage_A = 0; $espionnage_A = 0;
} }
if (($this->start_planete->technologies[1]& 536870912) == 536870912) { if (($this->end_planete->technologies[1]& 536870912) == 536870912) {
$contreespionnage_B = 3; $contreespionnage_B = 3;
} elseif (($this->start_planete->technologies[1]& 268435456) == 268435456) { } elseif (($this->end_planete->technologies[1]& 268435456) == 268435456) {
$contreespionnage_B = 2; $contreespionnage_B = 2;
} elseif (($this->start_planete->technologies[1]& 134217728) == 134217728) { } elseif (($this->end_planete->technologies[1]& 134217728) == 134217728) {
$contreespionnage_B = 1; $contreespionnage_B = 1;
} else { } else {
$contreespionnage_B = 0; $contreespionnage_B = 0;
@ -592,8 +612,20 @@ class Flotte
//Création du rapport //Création du rapport
$rapport = new Rapport(5, $this->start_planete, $this->end_planete, $this->start_time + $this->end_time); $rapport = new Rapport(5, $this->start_planete, $this->end_planete, $this->start_time + $this->end_time);
$rapport->addInfo($this->end_planete, 0); $rapport->addInfo($this->end_planete, 0);
$rapport->addInfo($contreespionnage_B/$espionnage_A/10, 1); //Rend aléatoire le niveau affiché des bâtiments
$rapport->addInfo($espionnage_A+2-$contreespionnage_B+1, 2); $diff_esp = $espionnage_A - $contreespionnage_B;
//Il y a au moins 2 niveaux d'erreur (soit 1 positif et 1 négatif)
if ($diff_esp == 0) {
$diff_esp = 1;
}
$rapport->addInfo($diff_esp, 1);
//Où x est le résultat de cette formule, si x >= y, ça donne accès a plus d'informations
// si y >= 1 : ressources
// si y >= 2 : batiment
// si y >= 3 : défenses
// si y >= 4 : flottes
$rapport->addInfo($espionnage_A + 2 - $contreespionnage_B + 1, 2);
//Si le joueur a au moins le niveau 1 du contre-espionnage, on le prévient qu'il a été espionné, sinon il n'en sait rien
$rapport->addInfo($contreespionnage_B, 3); $rapport->addInfo($contreespionnage_B, 3);
$rapport->send(); $rapport->send();

View File

@ -128,7 +128,7 @@ class Planete extends Surface
$this->file_cas = new FileCaserne(); $this->file_cas = new FileCaserne();
} }
foreach ($terrestreVAR as $ter) { foreach ($terrestreVAR[$this->race] as $ter) {
$this->terrestres[] = $plan[$ter]; $this->terrestres[] = $plan[$ter];
} }
if (!empty($plan["file_ter"])) { if (!empty($plan["file_ter"])) {

View File

@ -91,36 +91,42 @@ class Rapport
if ($this->var[2] > 2) { if ($this->var[2] > 2) {
$this->rapportA .= "<table style=\"margin: auto;\"><tr><th>Niveau</th><th>B&acirc;timent</th></tr>"; $this->rapportA .= "<table style=\"margin: auto;\"><tr><th>Niveau</th><th>B&acirc;timent</th></tr>";
foreach ($this->var[0]->batiments as $key => $batiment) { foreach ($this->var[0]->batiments as $key => $batiment) {
$this->rapportA .= "<tr><td>".rand($batiment * (1 - $this->var[1]), $batiment * (1 + $this->var[1]))."</td><td>".$LANG[$this->var[0]->race]["batiments"]["noms_sing"][$key]."</td></tr>"; $this->rapportA .= "<tr><td>".rand(($batiment - $this->var[1]), ($batiment + $this->var[1]))."</td><td>".$LANG[$this->var[0]->race]["batiments"]["noms_sing"][$key]."</td></tr>";
} }
$this->rapportA .= "</table><br />"; $this->rapportA .= "</table><br />";
} }
//Flottes en orbite
if ($this->var[2] > 3) {
}
//Flottes au sol //Flottes au sol
if ($this->var[2] > 5) { if ($this->var[2] > 4) {
$this->rapportA .= "<table style=\"margin: auto;\"><tr><th>Nombre</th><th>Vaisseaux</th></tr>"; $this->rapportA .= "<table style=\"margin: auto;\"><tr><th>Nombre</th><th>Vaisseaux</th></tr>";
foreach ($this->var[0]->vaisseaux as $key => $vaisseau) { foreach ($this->var[0]->vaisseaux as $key => $vaisseau) {
$this->rapportA .= "<tr><td>".rand($vaisseau * (1 - $this->var[1]), $vaisseau * (1 + $this->var[1]))."</td><td>".$LANG[$this->var[0]->race]["vaisseaux"]["noms_sing"][$key]."</td></tr>"; $this->rapportA .= "<tr><td>".rand(($vaisseau - $this->var[1]), ($vaisseau + $this->var[1]))."</td><td>".$LANG[$this->var[0]->race]["vaisseaux"]["noms_sing"][$key]."</td></tr>";
} }
$this->rapportA .= "</table><br />"; $this->rapportA .= "</table><br />";
} }
//Défenses //Défenses
if ($this->var[2] > 4) { if ($this->var[2] > 3) {
$this->rapportA .= "<table style=\"margin: auto;\"><tr><th>Nombre</th><th>Défenses</th></tr>"; $this->rapportA .= "<table style=\"margin: auto;\"><tr><th>Nombre</th><th>Défenses</th></tr>";
foreach ($this->var[0]->terrestres as $key => $unite) { foreach ($this->var[0]->terrestres as $key => $unite) {
if (!dTerrestre::type($key)) { if (!dTerrestre::type($key, $this->var[0])) {
$this->rapportA .= "<tr><td>".rand($unite * (1 - $this->var[1]), $unite * (1 + $this->var[1]))."</td><td>".$LANG[$this->var[0]->race]["terrestre"]["noms_sing"][$key]."</td></tr>"; $this->rapportA .= "<tr><td>".rand($unite * floor(1 - $this->var[1]), $unite * ceil(1 + $this->var[1]))."</td><td>".$LANG[$this->var[0]->race]["terrestre"]["noms_sing"][$key]."</td></tr>";
} }
} }
$this->rapportA .= "</table><br />"; $this->rapportA .= "</table><br />";
} }
} }
//On envoit le rapport d'espionnage
$temps = $this->timestamp;
$db = new BDD();
$db->escape($this->titreA);
$db->escape($this->rapportA);
$db->query("INSERT INTO ".$this->table." (destinataire, sujet, contenu, temps) VALUES(".$this->utilA->id_user.", '$this->titreA', '$this->rapportA', '$temps');");
$db->deconnexion();
//On envoit le rapport de cdontre-espionnage
if ($this->var[3] >= 1) { if ($this->var[3] >= 1) {
$this->titreB = "Rapport de contre-espionnage"; $this->titreB = "Rapport de contre-espionnage";
if (!isset($this->var[0]->nom_planete)) { if (!isset($this->var[0]->nom_planete)) {
@ -128,8 +134,15 @@ class Rapport
} else { } else {
$this->rapportB = "Nous venons d'apprendre que notre planète : ".$this->var[0]->nom_planete."[".$this->var[0]->galaxie.":".$this->var[0]->ss.":".$this->var[0]->position."] a été la cible d'un espionnage de la part de ".$this->utilA->pseudo; $this->rapportB = "Nous venons d'apprendre que notre planète : ".$this->var[0]->nom_planete."[".$this->var[0]->galaxie.":".$this->var[0]->ss.":".$this->var[0]->position."] a été la cible d'un espionnage de la part de ".$this->utilA->pseudo;
} }
$temps = $this->timestamp;
$db = new BDD();
$db->escape($this->titreB);
$db->escape($this->rapportB);
$db->query("INSERT INTO ".$this->table." (destinataire, sujet, contenu, temps) VALUES(".$this->utilB->id_user.", '$this->titreB', '$this->rapportB', '$temps');");
$db->deconnexion();
} }
$this->rapportA = $this->rapportA;
} }
public function sendTransport() public function sendTransport()

View File

@ -29,5 +29,7 @@ $technologiesVAR = array("techno_indu", "techno_inge", "techno_inge2", "techno_p
$batimentsVAR = array("mine_m", "mine_c", "mine_h", "centrale_s", "centrale_f", "radar", "labo", "chantier_terrestre", "chantier_spatial", "caserne", "silo", "centre_info", "habitation", "arcologies", "bunker", "stations", "commercial", "loisir", "administration"); $batimentsVAR = array("mine_m", "mine_c", "mine_h", "centrale_s", "centrale_f", "radar", "labo", "chantier_terrestre", "chantier_spatial", "caserne", "silo", "centre_info", "habitation", "arcologies", "bunker", "stations", "commercial", "loisir", "administration");
$caserneVAR = array("soldat1", "soldat2", "soldat3", "soldat4", "sniper", "spartan", "medecin", "ingenieur", "soldat_lourd"); $caserneVAR = array("soldat1", "soldat2", "soldat3", "soldat4", "sniper", "spartan", "medecin", "ingenieur", "soldat_lourd");
$spatialVAR = array("vaisseau_1", "vaisseau_2", "vaisseau_3", "vaisseau_4", "vaisseau_5", "vaisseau_6", "vaisseau_7", "vaisseau_8", "vaisseau_9", "vaisseau_10", "vaisseau_11", "vaisseau_12", "vaisseau_13", "vaisseau_14", "vaisseau_15", "vaisseau_16", "vaisseau_17"); $spatialVAR = array("vaisseau_1", "vaisseau_2", "vaisseau_3", "vaisseau_4", "vaisseau_5", "vaisseau_6", "vaisseau_7", "vaisseau_8", "vaisseau_9", "vaisseau_10", "vaisseau_11", "vaisseau_12", "vaisseau_13", "vaisseau_14", "vaisseau_15", "vaisseau_16", "vaisseau_17");
$terrestreVAR = array("vais_0", "vais_1", "vais_2", "vais_3", "vcl_1", "vcl_2", "vcl_3", "vcl_4", "def_1", "def_2", "def_3", "def_4", "def_5", "def_6", "def_7", "def_8"); $terrestreVAR = array();
$terrestreVAR["humain"] = array("vais_0", "vais_1", "vais_2", "vais_3", "vcl_1", "vcl_2", "vcl_3", "vcl_4", "def_1", "def_2", "def_3", "def_4", "def_5", "def_6", "def_7", "def_8");
$terrestreVAR["covenant"] = array("vais_0", "vais_1", "vais_2", "vais_3", "vcl_1", "vcl_2", "vcl_3", "vcl_4", "def_1", "def_2", "def_3", "def_4", "def_5");
$coeffVAR = array("coeff_mine_m", "coeff_mine_c", "coeff_mine_h", "coeff_centrale_s", "coeff_centrale_f"); $coeffVAR = array("coeff_mine_m", "coeff_mine_c", "coeff_mine_h", "coeff_centrale_s", "coeff_centrale_f");

View File

@ -44,13 +44,13 @@ if (SURFACE == "asteroide") {
} }
function traiterBrancheTechnologie($TEMP_liste, $branche, $i) function traiterBrancheTechnologie($TEMP_liste, $branche, $i, $race)
{ {
global $LANG, $planete; global $LANG, $planete;
foreach ($i as $key => $id) { foreach ($i as $key => $id) {
if (is_array($id)) { if (is_array($id)) {
$TEMP_liste = traiterBrancheTechnologie($TEMP_liste, $branche, $id); $TEMP_liste = traiterBrancheTechnologie($TEMP_liste, $branche, $id, $race);
} else { } else {
$niveau = dTechnologies::niveau_du_joueur($branche, $id, $planete); $niveau = dTechnologies::niveau_du_joueur($branche, $id, $planete);
$niveau_max = dTechnologies::niveau_max($branche, $id, $planete, $LANG); $niveau_max = dTechnologies::niveau_max($branche, $id, $planete, $LANG);
@ -61,7 +61,7 @@ function traiterBrancheTechnologie($TEMP_liste, $branche, $i)
'branche' => $branche, 'branche' => $branche,
'niveau' => $niveau, 'niveau' => $niveau,
'niveau_max' => $niveau_max, 'niveau_max' => $niveau_max,
'etat' => dTechnologies::needed($object, $planete, true) 'etat' => dTechnologies::needed($object, $planete, true, $race)
); );
} }
} }
@ -72,7 +72,7 @@ $TEMP_liste = array();
$branche = 0; $branche = 0;
while ($branche < 9) { while ($branche < 9) {
$TEMP_liste[$branche] = array(); $TEMP_liste[$branche] = array();
$TEMP_liste = traiterBrancheTechnologie($TEMP_liste, $branche, dTechnologies::type($branche, $planete->race)); $TEMP_liste = traiterBrancheTechnologie($TEMP_liste, $branche, dTechnologies::type($branche, $planete->race), $race);
$branche++; $branche++;
} }
$template->assign('technologies', $TEMP_liste); $template->assign('technologies', $TEMP_liste);
@ -89,7 +89,7 @@ foreach ($planete->casernes as $id => $unite) {
$template->assign('caserne', $TEMP_liste); $template->assign('caserne', $TEMP_liste);
$TEMP_liste = array(); $TEMP_liste = array();
$id = 1; $id = 0;
$max_unite = count($LANG[$race]["terrestre"]["noms_sing"]); $max_unite = count($LANG[$race]["terrestre"]["noms_sing"]);
while ($id <= $max_unite) { while ($id <= $max_unite) {
if (!empty($LANG[$race]["terrestre"]["noms_sing"][$id])) { if (!empty($LANG[$race]["terrestre"]["noms_sing"][$id])) {
@ -103,7 +103,7 @@ while ($id <= $max_unite) {
$template->assign('unites', $TEMP_liste); $template->assign('unites', $TEMP_liste);
$TEMP_liste = array(); $TEMP_liste = array();
$id = 1; $id = 0;
$max_unite = count($LANG[$race]["vaisseaux"]["noms_sing"]); $max_unite = count($LANG[$race]["vaisseaux"]["noms_sing"]);
while ($id <= $max_unite) { while ($id <= $max_unite) {
if (!empty($LANG[$race]["vaisseaux"]["noms_sing"][$id])) { if (!empty($LANG[$race]["vaisseaux"]["noms_sing"][$id])) {

View File

@ -110,12 +110,12 @@ if (isset($_GET['t']) && is_numeric($_GET['t']) && !empty($LANG[$race]["technolo
$template->assign('type', 'vaisseaux'); $template->assign('type', 'vaisseaux');
$t = intval(gpc('v')); $t = intval(gpc('v'));
$template->assign('id', $t); $template->assign('id', $t);
$template->assign('image', dSpatial::image($t, $planete)); $template->assign('image', dSpatial::image($t, $planete, $race));
$template->assign('ressourcesNext', array(dSpatial::metal($t, 1, $planete), dSpatial::cristal($t, 1, $planete), dSpatial::hydrogene($t, 1, $planete), dSpatial::temps($t, 1, $planete))); $template->assign('ressourcesNext', array(dSpatial::metal($t, 1, $planete, $race), dSpatial::cristal($t, 1, $planete, $race), dSpatial::hydrogene($t, 1, $planete, $race), dSpatial::temps($t, 1, $planete, $race)));
$template->assign('etat', dSpatial::needed($t, $planete, $race)); $template->assign('etat', dSpatial::needed($t, $planete, $race));
$template->assign('caract', array($nomvais_at[$t], $nomvais_bc[$t], $nomvais_pv[$t], $nomvais_rs[$t])); $template->assign('caract', array(dSpatial::attaque($t, $planete, $race), dSpatial::bouclier($t, $planete, $race), dSpatial::armature($t, $planete, $race), dSpatial::tailleCales($t, $planete, $race)));
} elseif (isset($_GET['d']) && is_numeric($_GET['d']) && !empty($LANG[$race]["terrestre"]["noms_sing"][$_GET['d']])) { } elseif (isset($_GET['d']) && is_numeric($_GET['d']) && !empty($LANG[$race]["terrestre"]["noms_sing"][$_GET['d']])) {
$template->assign('type', 'terrestre'); $template->assign('type', 'terrestre');
$t = gpc('d'); $t = gpc('d');

View File

@ -70,7 +70,7 @@ if ($mission == 4 && $SESS->values["prepFlottes"][$idPrep]['vaisseaux'][3] <= 0)
} }
//On vérifie la mission, si elle est d'espionner, il faut qu'il y ait des sondes //On vérifie la mission, si elle est d'espionner, il faut qu'il y ait des sondes
if ($mission == 5 && $SESS->values["prepFlottes"][$idPrep]['vaisseaux'][6] <= 0 && $SESS->values["prepFlottes"][$idPrep]['vaisseaux'][13] <= 0) { if ($mission == 5 && (($planete->race == "humain" && $SESS->values["prepFlottes"][$idPrep]['vaisseaux'][13] <= 0) || ($planete->race == "covenant" && $SESS->values["prepFlottes"][$idPrep]['vaisseaux'][7] <= 0))) {
erreur('Vous ne pouvez pas espionner sans sonde d\'espionnage !', "red", '?p=flotte'); erreur('Vous ne pouvez pas espionner sans sonde d\'espionnage !', "red", '?p=flotte');
} }
@ -156,9 +156,18 @@ elseif ($mission == 5) {
erreur('La planète sur laquelle vous désirez stationner ne vous appartient pas.', "red", '?p=flotte', 3000); erreur('La planète sur laquelle vous désirez stationner ne vous appartient pas.', "red", '?p=flotte', 3000);
} elseif ($mission == 7 && !$resultat) { } elseif ($mission == 7 && !$resultat) {
erreur('La planète sur laquelle vous désirez donner vos vaisseaux n\'existe pas.', "red", '?p=flotte', 3000); erreur('La planète sur laquelle vous désirez donner vos vaisseaux n\'existe pas.', "red", '?p=flotte', 3000);
} elseif ($mission == 7) {
$bdd->reconnexion();
$resultatu = $bdd->unique_query("SELECT race FROM $table_user WHERE id = ".$resultat['id_user'].";");
$bdd->deconnexion();
if ($resultatu['race'] != $planete->race) {
erreur("Vous ne pouvez pas donner vos vaisseaux a une autre race que la votre", "red");
}
} }
//Création de la flotte //Création de la flotte
$flotte = new flotte(); $flotte = new flotte();
$flotte->creer($planete, $SESS->values["prepFlottes"][$idPrep], $resultat); $flotte->creer($planete, $SESS->values["prepFlottes"][$idPrep], $resultat);

View File

@ -23,13 +23,14 @@ if ($SESS->values["prepFlottes"][$idPrep]['type'] == 1) {
if ($SESS->values["prepFlottes"][$idPrep]['vaisseaux'][2]) { if ($SESS->values["prepFlottes"][$idPrep]['vaisseaux'][2]) {
$missions[2] = "Coloniser"; $missions[2] = "Coloniser";
} }
if ($planete->technologies[7]& 16 && $VAR["attaques"]) { //Stratégie millitaire est nécessaire
if ($planete->technologies[3]& 4096 && $VAR["attaques"]) {
$missions[3] = "Attaquer"; $missions[3] = "Attaquer";
} }
if ($SESS->values["prepFlottes"][$idPrep]['type'] == 1 && $SESS->values["prepFlottes"][$idPrep]['vaisseaux'][3]) { if ($SESS->values["prepFlottes"][$idPrep]['type'] == 1 && $SESS->values["prepFlottes"][$idPrep]['vaisseaux'][3]) {
$missions[4] = "Recycler"; $missions[4] = "Recycler";
} }
if ($SESS->values["prepFlottes"][$idPrep]['type'] == 1 && ($SESS->values["prepFlottes"][$idPrep]['vaisseaux'][6] || $SESS->values["prepFlottes"][$idPrep]['vaisseaux'][13])) { if ($SESS->values["prepFlottes"][$idPrep]['type'] == 1 && (($planete->race == "humain" && $SESS->values["prepFlottes"][$idPrep]['vaisseaux'][13]) || ($planete->race == "covenant" && $SESS->values["prepFlottes"][$idPrep]['vaisseaux'][7]))) {
$missions[5] = "Espionner"; $missions[5] = "Espionner";
} }

View File

@ -870,20 +870,20 @@
</var> </var>
<var name="7"> <var name="7">
<var name="0">Prototype Intercepteur Longsword</var> <var name="0">Prototype Intercepteur Longsword</var>
<var name="1">Prototype Bombardier Longsword</var> <var name="1">Prototype Séraphin</var>
<var name="2">Corvette de classe Mako</var> <var name="2">Prototype de chasseur lourd Tarasque</var>
<var name="3">Prototype de Frégate</var> <var name="3">Prototype de bombardier Gigas</var>
<var name="4">Récupération</var> <var name="4">Récupération</var>
<var name="5">Prototype de Destroyer</var> <var name="5">Prototype de Destroyer</var>
<var name="6">Prototype de Croiseur de classe Halcyon</var> <var name="6">Prototype de Destroyer de classe CVP</var>
<var name="7">Prototype de Croiseur de classe Marathon</var> <var name="7">Prototype de Croiseur de classe CCS</var>
<var name="8">Prototype de Porte-vaisseaux</var> <var name="8">Prototype de Croiseur de classe Révérence</var>
<var name="9">Prototype de Super Porte-Vaisseaux</var> <var name="9">Prototype de Cuirassé</var>
<var name="10">Prototype de Vaisseau d'exfiltration de classe Black Cat</var> <var name="10">Prototype de Super croiseur</var>
<var name="11">Prototype de Super canon à accélération magnétique</var> <var name="11">Prototype de Porte-vaisseau</var>
<var name="12">Bunker souterrain</var> <var name="12">Prototype de Porte-vaisseau lourd</var>
<var name="13">Bunker souterrain</var> <var name="13">Prototype de station orbitale</var>
<var name="14">Bunker souterrain</var> <var name="14">Prototype de ...</var>
</var> </var>
<var name="8"> <var name="8">
<var name="0">Expansion</var> <var name="0">Expansion</var>

View File

@ -8,7 +8,7 @@
{if $flottesEC} {if $flottesEC}
{foreach from=$flottesEC item=flotteEC} {foreach from=$flottesEC item=flotteEC}
<tr> <tr>
<td><a href="{$menu.flotte}&amp;n={$flotteEC->id}">{$flotteEC->nom|escape}</a></td> <td><a href="{$menu.flotte}&amp;n={$flotteEC->id_flotte}">{$flotteEC->nom|escape}</a></td>
<td>{$flotteEC->txtMission($flotteEC->mission)}</td> <td>{$flotteEC->txtMission($flotteEC->mission)}</td>
<td>{$flotteEC->nb_vais}</td> <td>{$flotteEC->nb_vais}</td>
<td>{if $flotteEC->end_type == "2"}{$flotteEC->end_planete->nom_alliance} [{$flotteEC->end_planete->galaxie}:{$flotteEC->end_planete->ss}:A]{elseif $flotteEC->end_type == "1"}[{$flotteEC->end_planete}]{elseif $flotteEC->end_type == "3"}[{$flotteEC->end_planete}:A]{else}{$flotteEC->end_planete->nom_planete} [{$flotteEC->end_planete->galaxie}:{$flotteEC->end_planete->ss}:{$flotteEC->end_planete->position}]{/if}</td> <td>{if $flotteEC->end_type == "2"}{$flotteEC->end_planete->nom_alliance} [{$flotteEC->end_planete->galaxie}:{$flotteEC->end_planete->ss}:A]{elseif $flotteEC->end_type == "1"}[{$flotteEC->end_planete}]{elseif $flotteEC->end_type == "3"}[{$flotteEC->end_planete}:A]{else}{$flotteEC->end_planete->nom_planete} [{$flotteEC->end_planete->galaxie}:{$flotteEC->end_planete->ss}:{$flotteEC->end_planete->position}]{/if}</td>
@ -69,4 +69,4 @@
</tbody> </tbody>
</table> </table>
</form> </form>
{include file='game/footer.tpl'} {include file='game/footer.tpl'}