type = $type;
$this->utilA = $utilA;
$this->utilB = $utilB;
$this->timestamp = $time;
}
function addInfo($info, $id){
$this->var[$id] = $info;
}
function send(){
if ($this->type == '1') $this->sendCombat();
elseif ($this->type == '2') $this->sendTransport();
elseif ($this->type == '3') $this->sendColonisation();
elseif ($this->type == '4') $this->sendRecyclage();
elseif ($this->type == '5') $this->sendEspionnage();
elseif ($this->type == '6') $this->sendAlliance();
}
function sendEspionnage(){
include_once('includes/function.php');
$titreA = 'Rapport d\'espionnage de '.$this->var[0]['nom_planete'].' ['.$this->var[0]['galaxie'].':'.$this->var[0]['ss'].':'.$this->var[0]['position'].']';
$rapportA = 'Espionnage de '.trouvNom($this->utilB).' sur '.$this->var[0]['nom_planete'].'['.$this->var[0]['galaxie'].':'.$this->var[0]['ss'].':'.$this->var[0]['position'].']
';
$race = trouvInfo($this->utilB, 'race');
$auth_level = 0;
include('includes/noms.php');
include('includes/vars.php');
if (isset($this->var[1]) && $this->var[1] == false) $rapportA .= 'Nos sondes n\'ont pas pu récolter d\'information sur cette planète.';
else {
$rapportA .= '
Ressources sur la planète : |
---|
Métal : | '.$this->var[0]['metal'].' |
Cristal : | '.$this->var[0]['cristal'].' |
Hydrogène : | '.$this->var[0]['hydrogene'].' |
';
if (isset($this->var[1]) && $this->var[1] == true) {
$rapportA .= 'Nombre | Vaisseaux |
';
$nbvais = count($nomvaisn);
for($i=1 ; $i<$nbvais ; $i++) {
if ($this->var[0]['vaisseau_'.$i] >= 1) $rapportA .= ''.$this->var[0]['vaisseau_'.$i].' | '.$nomvaisn[$i-1].' |
';
}
$rapportA .= '
';
}
if (isset($this->var[2]) && $this->var[2] == true) {
$rapportA .= 'Nombre | Défenses |
';
$nbdef = count($nomterrn) - 7;
for($i=1 ; $i<$nbdef ; $i++) {
if ($this->var[0]['def_'.$i] >= 1) $rapportA .= ''.$this->var[0]['def_'.$i].' | '.$nomterrn[$i+7].' |
';
}
$rapportA .= '
';
}
if (isset($this->var[3]) && $this->var[3] == true) {
$rapportA .= 'Niveau | Batiment |
';
$nbbat = count($batiment);
for($i=1 ; $i<$nbbat ; $i++) {
if ($this->var[0][$batimentVAR[$i-1]] >= 1) $rapportA .= ''.$this->var[0][$batimentVAR[$i-1]].' | '.$batiment[$i-1].' |
';
}
$rapportA .= '
';
}
if (isset($this->var[4]) && is_array($this->var[4])) {
$rapportA .= 'Niveau | Technologie |
';
$nbtec = count($technolo);
for($i=1 ; $i<$nbtec ; $i++) {
if ($this->var[4][$technoloVAR[$i-1]] >= 1) $rapportA .= ''.$this->var[4][$technoloVAR[$i-1]].' | '.$technolo[$i-1].' |
';
}
$rapportA .= '
';
}
if (isset($this->var[5]) && is_array($this->var[5])) {
//ISOLEMENT
}
}
$titreB = 'Rapport de contre-espionnage';
$rapportB = 'Nous vennons 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 '.trouvNom($this->utilA);
$titreA = mysql_real_escape_string($titreA);
$rapportA = mysql_real_escape_string($rapportA);
$titreB = mysql_real_escape_string($titreB);
$rapportB = mysql_real_escape_string($rapportB);
$temps = $this->timestamp;
mysql_query("INSERT INTO mail VALUES('', '1', '".trouvNom($this->utilA)."', '', '$titreA', '$rapportA', '$temps')");
mysql_query("INSERT INTO mail VALUES('', '1', '".trouvNom($this->utilB)."', '', '$titreB', '$rapportB', '$temps')");
}
function sendAlliance(){
include_once('includes/function.php');
$titreA = 'Déclaration officielle de votre alliance !';
$rapportA = 'Félicitations, votre alliance a recueilli suffisament de signature, sa déclaration est maintenant officielle !
Vous pouvez dès maintenant administrer votre alliance en vous randant sur la page Alliance.';
$titreA = mysql_real_escape_string($titreA);
$rapportA = mysql_real_escape_string($rapportA);
$temps = $this->timestamp;
mysql_query("INSERT INTO mail VALUES('', '1', '".trouvNom($this->utilA)."', '', '$titreA', '$rapportA', '$temps')");
}
}
?>