table = $table_mail; $this->type = $type; $this->utilA = $utilA; $this->utilB = $utilB; $this->timestamp = $time; } function addInfo($info, $id) { $this->var[$id] = $info; } function send() { if ($this->type == '3') $this->sendCombat(); elseif ($this->type == '1') $this->sendTransport(); elseif ($this->type == '2') $this->sendColonisation(); elseif ($this->type == '4') $this->sendRecyclage(); elseif ($this->type == '5') $this->sendEspionnage(); elseif ($this->type == '6') $this->sendAlliance(); elseif ($this->type == '7') $this->sendAlliance2(); } function sendEspionnage() { global $LANG; if (!isset($this->var[0]->nom_planete)) { $titreA = 'Rapport d\'espionnage de '.$this->var[0]->nom_asteroide.' ['.$this->var[0]->galaxie.':'.$this->var[0]->ss.':A]'; $rapportA = 'Espionnage de '.$this->var[0]->pseudo.' sur '.$this->var[0]->nom_asteroide.'['.$this->var[0]->galaxie.':'.$this->var[0]->ss.':A]

'; } else { $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 '.$this->var[0]->pseudo.' sur '.$this->var[0]->nom_planete.'['.$this->var[0]->galaxie.':'.$this->var[0]->ss.':'.$this->var[0]->position.']

'; } if ($this->var[2] < 1) $rapportA .= 'Nos sondes n\'ont pas pu récolter d\'informations sur cette planète.'; else { //Ressources if ($this->var[2] > 1) $rapportA .= '
Ressources sur la planète :
'.$LANG[$this->var[0]->race]["ressources"]["noms"]["metal"].' :'.$this->var[0]->metal.'
'.$LANG[$this->var[0]->race]["ressources"]["noms"]["cristal"].' :'.$this->var[0]->cristal.'
'.$LANG[$this->var[0]->race]["ressources"]["noms"]["hydrogene"].' :'.$this->var[0]->hydrogene.'

'; //Bâtiments if ($this->var[2] > 2) { $rapportA .= ''; foreach ($this->var[0]->batiments as $key => $batiment) { $rapportA .= ''; } $rapportA .= '
NiveauBâtiment
'.rand($batiment * (1 - $this->var[1]), $batiment * (1 + $this->var[1])).''.$LANG[$this->var[0]->race]["batiments"]["noms_sing"][$key].'

'; } //Flottes en orbite if ($this->var[2] > 3) { } //Flottes au sol if ($this->var[2] > 5) { $rapportA .= ''; foreach ($this->var[0]->vaisseaux as $key => $vaisseau) { $rapportA .= ''; } $rapportA .= '
NombreVaisseaux
'.rand($vaisseau * (1 - $this->var[1]), $vaisseau * (1 + $this->var[1])).''.$LANG[$this->var[0]->race]["vaisseaux"]["noms_sing"][$key].'

'; } //Défenses if ($this->var[2] > 4) { $rapportA .= ''; foreach ($this->var[0]->terrestres as $key => $unite) { if (!Donnee::typeTerrestre($key)) $rapportA .= ''; } $rapportA .= '
NombreDéfenses
'.rand($unite * (1 - $this->var[1]), $unite * (1 + $this->var[1])).''.$LANG[$this->var[0]->race]["terrestre"]["noms_sing"][$key].'

'; } } $titreB = 'Rapport de contre-espionnage'; if (!isset($this->var[0]->nom_planete)) $rapportB = 'Nous venons d\'apprendre que notre planète : '.$this->var[0]->nom_asteroide.'['.$this->var[0]->galaxie.':'.$this->var[0]->ss.':A] a été la cible d\'un espionnage de la part de '.$this->utilA->pseudo; else $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($titreA); $db->escape($titreB); $db->escape($rapportA); $db->escape($rapportB); $db->query("INSERT INTO ".$this->table." (destinataire, sujet, contenu, temps) VALUES(".$this->utilA->id_user.", '$titreA', '$rapportA', '$temps')"); //On envoie un rapport au joueur espionné uniquement s'il a un contre-espionnage if ($this->var[3] >= 1) $db->query("INSERT INTO ".$this->table." (destinataire, sujet, contenu, temps) VALUES(".$this->utilB->id_user.", '$titreB', '$rapportB', '$temps')"); $db->deconnexion(); } function sendTransport() { global $LANG; if (!isset($this->var[0]->nom_planete)) { $titre = 'Transport vers '.$this->var[0]->nom_asteroide.' ['.$this->var[0]->galaxie.':'.$this->var[0]->ss.':A]'; $rapportA = 'Vos vaisseaux ont déposé '.$this->var[1][0].' de '.$LANG[$this->utilA->race]["ressources"]["noms"]["metal"].', '.$this->var[1][1].' de '.$LANG[$this->utilA->race]["ressources"]["noms"]["cristal"].' et '.$this->var[1][2].' d\''.$LANG[$this->utilA->race]["ressources"]["noms"]["hydrogene"].' sur '.$this->var[0]->nom_asteroide.'['.$this->var[0]->galaxie.':'.$this->var[0]->ss.':A]

'; $rapportB = 'Les vaisseaux de '.$this->utilA->pseudo.' ont déposé '.$this->var[1][0].' de '.$LANG[$this->utilB->race]["ressources"]["noms"]["metal"].', '.$this->var[1][1].' de '.$LANG[$this->utilB->race]["ressources"]["noms"]["cristal"].' et '.$this->var[1][2].' d\''.$LANG[$this->utilB->race]["ressources"]["noms"]["hydrogene"].' sur '.$this->var[0]->nom_asteroide.'['.$this->var[0]->galaxie.':'.$this->var[0]->ss.':A]

'; } else { $titre = 'Transport vers '.$this->var[0]->nom_planete.' ['.$this->var[0]->galaxie.':'.$this->var[0]->ss.':'.$this->var[0]->position.']'; $rapportA = 'Vos vaisseaux ont déposé '.$this->var[1][0].' de '.$LANG[$this->utilA->race]["ressources"]["noms"]["metal"].', '.$this->var[1][1].' de '.$LANG[$this->utilA->race]["ressources"]["noms"]["cristal"].' et '.$this->var[1][2].' d\''.$LANG[$this->utilA->race]["ressources"]["noms"]["hydrogene"].' sur '.$this->var[0]->nom_planete.'['.$this->var[0]->galaxie.':'.$this->var[0]->ss.':'.$this->var[0]->position.']

'; $rapportB = 'Les vaisseaux de '.$this->utilA->pseudo.' ont déposé '.$this->var[1][0].' de '.$LANG[$this->utilB->race]["ressources"]["noms"]["metal"].', '.$this->var[1][1].' de '.$LANG[$this->utilB->race]["ressources"]["noms"]["cristal"].' et '.$this->var[1][2].' d\''.$LANG[$this->utilB->race]["ressources"]["noms"]["hydrogene"].' sur '.$this->var[0]->nom_planete.'['.$this->var[0]->galaxie.':'.$this->var[0]->ss.':'.$this->var[0]->position.']

'; } $temps = $this->timestamp; $db = new BDD(); $db->escape($titre); $db->escape($rapportA); $db->escape($rapportB); $db->query("INSERT INTO ".$this->table." (destinataire, sujet, contenu, temps) VALUES(".$this->utilA->id_user.", '$titre', '$rapportA', '$temps');"); if ($this->utilA->id_user != $this->utilB->id_user) $db->query("INSERT INTO ".$this->table." (destinataire, sujet, contenu, temps) VALUES(".$this->utilB->id_user.", '$titre', '$rapportB', '$temps');"); $db->deconnexion(); } function sendColonisation() { $titre = 'Colonisation de ['.$this->var[0][0].':'.$this->var[0][1].':'.$this->var[0][2].']'; if (is_numeric($this->var[0][2])) { if ($this->var[1]) $rapport = 'Votre vaisseau a atteint la planète ['.$this->var[0][0].':'.$this->var[0][1].':'.$this->var[0][2].'] et commence la colonisation.'; else $rapport = 'Nous n\'avons pas pu coloniser la planète ['.$this->var[0][0].':'.$this->var[0][1].':'.$this->var[0][2].'] car lorsque nous sommes arrivé sur place, elle était déjà colonisée.'; } else { if ($this->var[1]) $rapport = 'Votre vaisseau a atteint l\'astéroide ['.$this->var[0][0].':'.$this->var[0][1].':'.$this->var[0][2].'] et commence la colonisation.'; else $rapport = 'Nous n\'avons pas pu coloniser la planète ['.$this->var[0][0].':'.$this->var[0][1].':'.$this->var[0][2].'] car lorsque nous sommes arrivé sur place, elle était déjà colonisée.'; } $temps = $this->timestamp; $db = new BDD(); $db->escape($titre); $db->escape($rapport); $db->query("INSERT INTO ".$this->table." (destinataire, sujet, contenu, temps) VALUES(".$this->utilA->id_user.", '$titre', '$rapport', '$temps');"); $db->deconnexion(); } function sendRecyclage() { global $LANG; if (!isset($this->var[0]->nom_planete)) { $titre = 'Recyclage de '.$this->var[0]->nom_asteroide.' ['.$this->var[0]->galaxie.':'.$this->var[0]->ss.':A]'; $rapport = 'Vos vaisseaux récoltent '.$this->var[1][0].' de '.$LANG[$this->utilA->race]["ressources"]["noms"]["metal"].' et '.$this->var[1][1].' de '.$LANG[$this->utilA->race]["ressources"]["noms"]["cristal"].' sur '.$this->var[0]->nom_asteroide.'['.$this->var[0]->galaxie.':'.$this->var[0]->ss.':A]

'; } else { $titre = 'Recyclage de '.$this->var[0]->nom_planete.' ['.$this->var[0]->galaxie.':'.$this->var[0]->ss.':'.$this->var[0]->position.']'; $rapport = 'Vos vaisseaux récoltent '.$this->var[1][0].' de '.$LANG[$this->utilA->race]["ressources"]["noms"]["metal"].' et '.$this->var[1][1].' de '.$LANG[$this->utilA->race]["ressources"]["noms"]["cristal"].' sur '.$this->var[0]->nom_planete.'['.$this->var[0]->galaxie.':'.$this->var[0]->ss.':'.$this->var[0]->position.']

'; } $temps = $this->timestamp; $db = new BDD(); $db->escape($titre); $db->escape($rapport); $db->query("INSERT INTO ".$this->table." (destinataire, sujet, contenu, temps) VALUES(".$this->utilA->id_user.", '$titre', '$rapport', '$temps');"); $db->deconnexion(); } function sendCombat(){ include(_FCORE."../game/vars.php"); include_once(_FCORE."../game/function.php"); require_once(SMARTY_DIR."Smarty.class.php"); $rapportA = new Smarty(); $rapportB = new Smarty(); $rapportA->template_dir = _FCORE.'templates/templates/'; $rapportA->compile_dir = _FCORE.'templates/templates_c/'; $rapportA->config_dir = _FCORE.'templates/configs/'; $rapportA->cache_dir = _FCORE.'templates/cache/'; $rapportB->template_dir = _FCORE.'templates/templates/'; $rapportB->compile_dir = _FCORE.'templates/templates_c/'; $rapportB->config_dir = _FCORE.'templates/configs/'; $rapportB->cache_dir = _FCORE.'templates/cache/'; $this->var[4]['pseudo'] = trouvNom($this->var[4]['id_user']); $this->var[5]['pseudo'] = trouvNom($this->var[5]['id_user']); $rapportA->assign('tour', $this->var[3]); $rapportA->assign('EN', $this->var[4]); $rapportA->assign('flotte', $this->var[5]); $rapportA->assign('vaisseaux1', $this->var[0]); $rapportA->assign('vaisseaux2', $this->var[1]); $rapportA->assign('defenses1', $this->var[2]); $rapportA->assign('vaisseaux3', $this->var[7]); $rapportA->assign('vaisseaux4', $this->var[8]); $rapportA->assign('defenses2', $this->var[9]); $rapportA->assign('termine', $this->var[6][0]); $rapportA->assign('attaquantG', $this->var[6][1]); $rapportA->assign('pillage', $this->var[11]); $rapportA->assign('vaisBC', $nomvais_bc); $rapportA->assign('vaisPV', $nomvais_pv); $rapportA->assign('defBC', $defense_bc); $rapportA->assign('defPV', $defense_pv); $rapportA->assign('nextTour', $this->var[10]); $race = trouvInfo($this->utilA, 'race'); include(_FCORE."../game/noms.php"); $rapportA->assign('ressources', $ressourc); $rapportA->assign('nomvaisAT', $nomvaisa); $race = trouvInfo($this->var[4]['id_user'], 'race'); include(_FCORE."../game/noms.php"); $rapportA->assign('nomvaisEN', $nomvaisa); array_splice($nomterra, 0, 8); $rapportA->assign('nomdefEN', $nomterra); $rapportA = $rapportA->fetch('game/ATrapport_combat.tpl'); $rapportB->assign('tour', $this->var[3]); $rapportB->assign('EN', $this->var[4]); $rapportB->assign('flotte', $this->var[5]); $rapportB->assign('vaisseaux1', $this->var[0]); $rapportB->assign('vaisseaux2', $this->var[1]); $rapportB->assign('defenses1', $this->var[2]); $rapportB->assign('vaisseaux3', $this->var[7]); $rapportB->assign('vaisseaux4', $this->var[8]); $rapportB->assign('defenses2', $this->var[9]); $rapportB->assign('termine', $this->var[6][0]); $rapportB->assign('attaquantG', $this->var[6][1]); $rapportB->assign('matchnul', $this->var[6][2]); $rapportB->assign('pillage', $this->var[11]); $rapportB->assign('vaisBC', $nomvais_bc); $rapportB->assign('vaisPV', $nomvais_pv); $rapportB->assign('defBC', $defense_bc); $rapportB->assign('defPV', $defense_pv); $rapportB->assign('nextTour', $this->var[10]); $race = trouvInfo($this->utilA, 'race'); include(_FCORE."../game/noms.php"); $rapportB->assign('ressources', $ressourc); $rapportB->assign('nomvaisAT', $nomvaisa); $race = trouvInfo($this->var[4]['id_user'], 'race'); include(_FCORE."../game/noms.php"); $rapportB->assign('nomvaisEN', $nomvaisa); array_splice($nomterra, 0, 8); $rapportB->assign('nomdefEN', $nomterra); $rapportB = $rapportB->fetch('game/ENrapport_combat.tpl'); $titreA = 'Combat contre '.$this->var[4]['pseudo']; $titreB = 'Combat contre '.$this->var[5]['pseudo']; $temps = $this->timestamp; $db = new bdd(); $db->connexion(); $db->escape($titreA); $db->escape($titreB); $db->escape($rapportA); $db->escape($rapportB); $db->query("INSERT INTO ".$this->table." (destinataire, sujet, contenu, temps) VALUES(".$this->utilA->id_user.", '$titreA', '$rapportA', '$temps')"); $db->query("INSERT INTO ".$this->table." (destinataire, sujet, contenu, temps) VALUES(".$this->utilB->id_user."', '$titreB', '$rapportB', '$temps')"); $db->deconnexion(); } function show(){ include(_FCORE."../game/vars.php"); include_once(_FCORE."../game/function.php"); require_once(SMARTY_DIR."Smarty.class.php"); $rapportA = new Smarty(); $rapportA->template_dir = _FCORE.'templates/templates/'; $rapportA->compile_dir = _FCORE.'templates/templates_c/'; $rapportA->config_dir = _FCORE.'templates/configs/'; $rapportA->cache_dir = _FCORE.'templates/cache/'; $rapportA->assign('tour', $this->var[3]); $rapportA->assign('EN', $this->var[4]); $rapportA->assign('flotte', $this->var[5]); $rapportA->assign('vaisseaux1', $this->var[0]); $rapportA->assign('vaisseaux2', $this->var[1]); $rapportA->assign('defenses1', $this->var[2]); $rapportA->assign('vaisseaux3', $this->var[7]); $rapportA->assign('vaisseaux4', $this->var[8]); $rapportA->assign('defenses2', $this->var[9]); $rapportA->assign('termine', $this->var[6][0]); $rapportA->assign('attaquantG', $this->var[6][1]); $rapportA->assign('pillage', $this->var[11]); $rapportA->assign('debris', $this->var[12]); $rapportA->assign('infoPLUS', $this->var[14]); //$rapportA->assign('infoPLUS2', $this->var[15]); $rapportA->assign('page', 'simulation'); $rapportA->assign('enligne', $this->var[13][0]); $rapportA->assign('infos', $this->var[13][1]); $rapportA->assign('nbinfos', $this->var[13][2]); $rapportA->assign('count', $this->var[13][3]); $rapportA->assign('version', $this->var[13][4]); $rapportA->assign('tpsdejeu', $this->var[13][5]); $rapportA->assign('vaisBC', $nomvais_bc); $rapportA->assign('vaisPV', $nomvais_pv); $rapportA->assign('defBC', $defense_bc); $rapportA->assign('defPV', $defense_pv); $rapportA->assign('nextTour', $this->var[10]); $race = trouvInfo($this->utilA, 'race'); include(_FCORE."../game/noms.php"); $rapportA->assign('ressources', $ressourc); $rapportA->assign('nomvaisAT', $nomvaisa); $rapportA->assign('nomvaisEN', $nomvaisa); array_splice($nomterra, 0, 8); $rapportA->assign('nomdefEN', $nomterra); $rapportA->assign('race', $race); return $rapportA->fetch('game/SIMrapport_combat.tpl'); return $rapportA; } function sendAlliance() { $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 rendant sur la page Alliance.'; $temps = $this->timestamp; $db = new BDD(); $db->escape($titreA); $db->escape($rapportA); $db->query("INSERT INTO ".$this->table." (destinataire, sujet, contenu, temps) VALUES(".$this->utilA->id_user.", '$titreA', '$rapportA', '$temps')"); $db->deconnexion(); } function sendAlliance2() { $titreA = 'Fondation de votre alliance !'; $rapportA = 'Pour terminer la création de votre alliance, trouvez 4 joueurs de cette galaxie sans alliance pour leur faire signer votre traité de fondation d\'alliance.

Lien de signature : http://'.$_SERVER['HTTP_HOST'].'/?p=alliances&q=signer&i='.$this->var[0].''; $temps = $this->timestamp; $db = new BDD(); $db->escape($titreA); $db->escape($rapportA); $db->query("INSERT INTO ".$this->table." (destinataire, sujet, contenu, temps) VALUES(".$this->utilA->id_user.", '$titreA', '$rapportA', '$temps')"); $db->deconnexion(); } } ?>