@@ -76,10 +76,10 @@ discard block |
||
76 | 76 | public function getMessage() { |
77 | 77 | return $this->message; |
78 | 78 | } |
79 | - public function getDateMessage(){ |
|
79 | + public function getDateMessage() { |
|
80 | 80 | return $this->date_message; |
81 | 81 | } |
82 | - public function getUrl(){ |
|
82 | + public function getUrl() { |
|
83 | 83 | return $this->url; |
84 | 84 | } |
85 | 85 | public function getIdExpediteur() { |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | public function getPseudoReceveur() { |
95 | 95 | return $this->pseudo_receveur; |
96 | 96 | } |
97 | - public function getValues(){ |
|
97 | + public function getValues() { |
|
98 | 98 | return ["messagerie" => $this->values]; |
99 | 99 | } |
100 | 100 | |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | $destinataires = explode(",", $destinataire); |
292 | 292 | $c = count($destinataires); |
293 | 293 | |
294 | - for ($i=0 ; $i<$c ; $i++) { |
|
294 | + for ($i = 0; $i < $c; $i++) { |
|
295 | 295 | if ($this->getIdIdentiteExist($destinataires[$i]) !== false) { |
296 | 296 | $destinataires[] = $this->getIdIdentiteExist($destinataires[$i]); |
297 | 297 | } |
@@ -87,19 +87,19 @@ |
||
87 | 87 | * renvoi le ou les batiments nécéssaires pour la construction du batiment spécifié |
88 | 88 | */ |
89 | 89 | private function getPourConstruire($pour_construire) { |
90 | - for ($i=0 ; $i<count($pour_construire) ; $i++) { |
|
90 | + for ($i = 0; $i < count($pour_construire); $i++) { |
|
91 | 91 | //si plusieur batiment pour construire le batiment en question |
92 | 92 | $count = count($pour_construire[$i]); |
93 | 93 | if ($count > 1) { |
94 | - for ($j=0 ; $j<$count ; $j++) { |
|
95 | - $batiment[] = [ |
|
94 | + for ($j = 0; $j < $count; $j++) { |
|
95 | + $batiment[] = [ |
|
96 | 96 | "nom_batiment" => $pour_construire[$i][$j][0], |
97 | 97 | "niveau_batiment" => $pour_construire[$i][$j][2] |
98 | 98 | ]; |
99 | 99 | } |
100 | 100 | } |
101 | 101 | else { |
102 | - $batiment[] = [ |
|
102 | + $batiment[] = [ |
|
103 | 103 | "nom_batiment" => $pour_construire[$i][0][0], |
104 | 104 | "niveau_batiment" => $pour_construire[$i][0][2] |
105 | 105 | ]; |
@@ -57,7 +57,7 @@ |
||
57 | 57 | $dbc = App::getDb(); |
58 | 58 | |
59 | 59 | if ($type == "batiment") { |
60 | - $points = self::getPointsBase($id_base)+self::getPointAjoutBatiment(); |
|
60 | + $points = self::getPointsBase($id_base) + self::getPointAjoutBatiment(); |
|
61 | 61 | |
62 | 62 | } |
63 | 63 |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | - $marche = new \modules\bataille\app\controller\Marche(); |
|
2 | + $marche = new \modules\bataille\app\controller\Marche(); |
|
3 | 3 | |
4 | 4 | $marche->setCommencerTransport($_POST['eau'], $_POST['electricite'], $_POST['fer'], $_POST['fuel'], $_POST['nourriture'], $_POST['posx'], $_POST['posy']); |
5 | 5 |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $last_co = new \DateTime($last_co); |
98 | 98 | $last_co = $last_co->getTimestamp(); |
99 | 99 | |
100 | - $diff_temps = $today-$last_co; |
|
100 | + $diff_temps = $today - $last_co; |
|
101 | 101 | |
102 | 102 | //si la derniere actualisation ou connexion est supérieur à 30 sec |
103 | 103 | if ($diff_temps > 180) { |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | private function setAddRessource($nom_ressource, $ressrouce, $diff_temps) { |
118 | 118 | $dbc = App::getDb(); |
119 | 119 | |
120 | - $ressource = $ressrouce+(round((Bataille::getBatiment()->getProduction($nom_ressource, $this->id_base)/3600)*$diff_temps)); |
|
120 | + $ressource = $ressrouce + (round((Bataille::getBatiment()->getProduction($nom_ressource, $this->id_base) / 3600) * $diff_temps)); |
|
121 | 121 | $stockage_max = Bataille::getBatiment()->getStockageEntrepot($this->id_base); |
122 | 122 | |
123 | 123 | if ($ressource > $stockage_max) { |
@@ -148,18 +148,18 @@ discard block |
||
148 | 148 | |
149 | 149 | //soit on enelve ou on ajoute |
150 | 150 | if ($signe == "-") { |
151 | - $eau = $this->getEau()-$eau; |
|
152 | - $electricite = $this->getElectricite()-$electricite; |
|
153 | - $fer = $this->getFer()-$fer; |
|
154 | - $fuel = $this->getFuel()-$fuel; |
|
155 | - $nourriture = $this->getNourriture()-$nourriture; |
|
151 | + $eau = $this->getEau() - $eau; |
|
152 | + $electricite = $this->getElectricite() - $electricite; |
|
153 | + $fer = $this->getFer() - $fer; |
|
154 | + $fuel = $this->getFuel() - $fuel; |
|
155 | + $nourriture = $this->getNourriture() - $nourriture; |
|
156 | 156 | } |
157 | 157 | else { |
158 | - $eau = $this->getEau()+$eau; |
|
159 | - $electricite = $this->getElectricite()+$electricite; |
|
160 | - $fer = $this->getFer()+$fer; |
|
161 | - $fuel = $this->getFuel()+$fuel; |
|
162 | - $nourriture = $this->getNourriture()+$nourriture; |
|
158 | + $eau = $this->getEau() + $eau; |
|
159 | + $electricite = $this->getElectricite() + $electricite; |
|
160 | + $fer = $this->getFer() + $fer; |
|
161 | + $fuel = $this->getFuel() + $fuel; |
|
162 | + $nourriture = $this->getNourriture() + $nourriture; |
|
163 | 163 | |
164 | 164 | $stockage_max = Bataille::getBatiment()->getStockageEntrepot(); |
165 | 165 |
@@ -82,15 +82,15 @@ discard block |
||
82 | 82 | $today = Bataille::getToday(); |
83 | 83 | |
84 | 84 | //on test si déja arrivé à destination |
85 | - if (($this->aller == 1) && (($this->date_arrivee-$today) <= 0)) { |
|
85 | + if (($this->aller == 1) && (($this->date_arrivee - $today) <= 0)) { |
|
86 | 86 | $this->setLivrerRessource(); |
87 | 87 | |
88 | 88 | //on calcul la date d'arrivée du retour |
89 | 89 | if ($this->id_base_dest == Bataille::getIdBase()) { |
90 | - $date_retour = Bataille::getDureeTrajet($this->id_base, Bataille::getParam("vitesse_marchand"))+$this->date_arrivee; |
|
90 | + $date_retour = Bataille::getDureeTrajet($this->id_base, Bataille::getParam("vitesse_marchand")) + $this->date_arrivee; |
|
91 | 91 | } |
92 | 92 | else { |
93 | - $date_retour = Bataille::getDureeTrajet($this->id_base_dest, Bataille::getParam("vitesse_marchand"))+$this->date_arrivee; |
|
93 | + $date_retour = Bataille::getDureeTrajet($this->id_base_dest, Bataille::getParam("vitesse_marchand")) + $this->date_arrivee; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | //si le retour du trajet est également arrivé on finit le transport sinon on le place sur le retour |
@@ -99,15 +99,15 @@ discard block |
||
99 | 99 | } |
100 | 100 | else { |
101 | 101 | $this->setTrajetRetour($date_retour); |
102 | - $this->duree_restante_trajet = $date_retour-$today; |
|
102 | + $this->duree_restante_trajet = $date_retour - $today; |
|
103 | 103 | $set_array = true; |
104 | 104 | } |
105 | 105 | } |
106 | - else if (($this->aller == 0) && (($this->date_arrivee-$today) <= 0)) { |
|
106 | + else if (($this->aller == 0) && (($this->date_arrivee - $today) <= 0)) { |
|
107 | 107 | $this->setTerminerTransport(); |
108 | 108 | } |
109 | 109 | else { |
110 | - $this->duree_restante_trajet = $this->date_arrivee-$today; |
|
110 | + $this->duree_restante_trajet = $this->date_arrivee - $today; |
|
111 | 111 | $set_array = true; |
112 | 112 | } |
113 | 113 | |
@@ -159,11 +159,11 @@ discard block |
||
159 | 159 | } |
160 | 160 | |
161 | 161 | //on a le nombre de marchand dispo dans la base |
162 | - $nombre_marchand_dispo = $nombre_max_marchand-$marchand_transport; |
|
162 | + $nombre_marchand_dispo = $nombre_max_marchand - $marchand_transport; |
|
163 | 163 | |
164 | 164 | //on calcul savoir si on en a assez pour transport toutes les ressoures |
165 | 165 | //il faut 1 marchand pour 1000 ressource |
166 | - $nombre_marchand_trajet = ceil($all_ressource/1000); |
|
166 | + $nombre_marchand_trajet = ceil($all_ressource / 1000); |
|
167 | 167 | |
168 | 168 | //si on a assez de marchand on revoi true sinon false |
169 | 169 | if ($nombre_marchand_dispo >= $nombre_marchand_trajet) { |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | } |
245 | 245 | |
246 | 246 | //on check si assez marchand dans la base, si pas assez on return false |
247 | - $nb_marchand = $this->getAssezMarchand($eau+$electricite+$fer+$fuel+$nourriture); |
|
247 | + $nb_marchand = $this->getAssezMarchand($eau + $electricite + $fer + $fuel + $nourriture); |
|
248 | 248 | |
249 | 249 | if ($nb_marchand === false) { |
250 | 250 | FlashMessage::setFlash("Vous n'avez pas assez de marchans disponibles pour effectuer ce trajet"); |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | |
254 | 254 | //sinon initialise le transport |
255 | 255 | //on recup la date d'arrivee dans la base de destintation |
256 | - $date_arrivee = Bataille::getDureeTrajet($id_base_dest, Bataille::getParam("vitesse_marchand"))+Bataille::getToday(); |
|
256 | + $date_arrivee = Bataille::getDureeTrajet($id_base_dest, Bataille::getParam("vitesse_marchand")) + Bataille::getToday(); |
|
257 | 257 | |
258 | 258 | $ressource = [ |
259 | 259 | "eau" => $eau, |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | public static function getTestAssezRessourceBase($nom_ressource, $ressource) { |
198 | 198 | $f = "get".ucfirst($nom_ressource); |
199 | 199 | |
200 | - if ($ressource > Bataille::getRessource()->$f()) { |
|
200 | + if ($ressource > Bataille::getRessource()->$f()) { |
|
201 | 201 | /*echo("$nom_ressource $ressource ".Bataille::getRessource()->getEau()." ---");*/ |
202 | 202 | return [ |
203 | 203 | "ressource" => $ressource, |
@@ -224,10 +224,10 @@ discard block |
||
224 | 224 | |
225 | 225 | //calcul des distances séparant les deux bases en x et y |
226 | 226 | //cette dstance sera multipliée par 15 sur x et y puis ajoutée pour avoir le temps du trajte en seconde |
227 | - $calc_x = abs($base_joueur['posx']-$base_autre['posx']); |
|
228 | - $calc_y = abs($base_joueur['posy']-$base_autre['posy']); |
|
227 | + $calc_x = abs($base_joueur['posx'] - $base_autre['posx']); |
|
228 | + $calc_y = abs($base_joueur['posy'] - $base_autre['posy']); |
|
229 | 229 | |
230 | - $temps_voyage = (($calc_x*70)+($calc_y*70))/$vitesse; |
|
230 | + $temps_voyage = (($calc_x * 70) + ($calc_y * 70)) / $vitesse; |
|
231 | 231 | |
232 | 232 | return $temps_voyage; |
233 | 233 | } |
@@ -109,13 +109,13 @@ discard block |
||
109 | 109 | * @return floatfonction qui renvoi le temps qu'il faut pour effectuer une recherche |
110 | 110 | */ |
111 | 111 | private function getTempsRecherche($temps, $niveau = 0) { |
112 | - $pourcent = ($temps*Bataille::getBatiment()->getNiveauBatiment("centre_recherche")/100); |
|
112 | + $pourcent = ($temps * Bataille::getBatiment()->getNiveauBatiment("centre_recherche") / 100); |
|
113 | 113 | |
114 | 114 | if ($niveau == 0) { |
115 | - return round($temps-$pourcent);; |
|
115 | + return round($temps - $pourcent); ; |
|
116 | 116 | } |
117 | 117 | |
118 | - return round(($temps * ($this->coef_centre * $niveau))-$pourcent); |
|
118 | + return round(($temps * ($this->coef_centre * $niveau)) - $pourcent); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -160,14 +160,14 @@ discard block |
||
160 | 160 | $this->recherche = $obj->recherche; |
161 | 161 | $this->type = $obj->type; |
162 | 162 | |
163 | - if ($obj->date_fin-$today <= 0) { |
|
163 | + if ($obj->date_fin - $today <= 0) { |
|
164 | 164 | $this->setTerminerRecherche($obj->ID_recherche); |
165 | 165 | } |
166 | 166 | else { |
167 | 167 | $recherche = [ |
168 | 168 | "recherche" => $obj->recherche, |
169 | 169 | "type" => $obj->type, |
170 | - "date_fin_recherche" => $obj->date_fin-$today, |
|
170 | + "date_fin_recherche" => $obj->date_fin - $today, |
|
171 | 171 | "id_recherche" => $obj->ID_recherche |
172 | 172 | ]; |
173 | 173 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | $fuel = Bataille::getTestAssezRessourceBase("fuel", $cout["fuel"]); |
227 | 227 | |
228 | 228 | |
229 | - if (($eau["class"] || $electricite["class"] || $fer["class"] || $fuel["class"]) == "rouge" ) { |
|
229 | + if (($eau["class"] || $electricite["class"] || $fer["class"] || $fuel["class"]) == "rouge") { |
|
230 | 230 | FlashMessage::setFlash("Pas assez de ressources pour effectuer cette recherche"); |
231 | 231 | return false; |
232 | 232 | } |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | //on retire les ressources |
235 | 235 | Bataille::getRessource()->setUpdateRessource($cout["eau"], $cout["electricite"], $cout["fer"], $cout["fuel"], 0, "-"); |
236 | 236 | |
237 | - $date_fin = Bataille::getToday()+$temps_recherche; |
|
237 | + $date_fin = Bataille::getToday() + $temps_recherche; |
|
238 | 238 | |
239 | 239 | $dbc->insert("recherche", $recherche) |
240 | 240 | ->insert("type", $type) |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | ->set(); |
261 | 261 | } |
262 | 262 | else { |
263 | - $dbc->update("niveau", $niveau_recherche+1) |
|
263 | + $dbc->update("niveau", $niveau_recherche + 1) |
|
264 | 264 | ->from("_bataille_centre_recherche") |
265 | 265 | ->where("recherche", "=", $this->recherche, "AND") |
266 | 266 | ->where("type", "=", $this->type, "AND") |
@@ -47,25 +47,25 @@ discard block |
||
47 | 47 | foreach ($query as $obj) { |
48 | 48 | $base_carac = unserialize($obj->caracteristique); |
49 | 49 | $ressource = unserialize($obj->pour_recruter); |
50 | - $temps_recrutement = DateHeure::Secondeenheure(round($obj->temps_recrutement-($obj->temps_recrutement*Bataille::getBatiment()->getNiveauBatiment("caserne")/100))); |
|
50 | + $temps_recrutement = DateHeure::Secondeenheure(round($obj->temps_recrutement - ($obj->temps_recrutement * Bataille::getBatiment()->getNiveauBatiment("caserne") / 100))); |
|
51 | 51 | } |
52 | 52 | |
53 | - $coef = $this->coef_unite*$niveau; |
|
53 | + $coef = $this->coef_unite * $niveau; |
|
54 | 54 | |
55 | 55 | if ($niveau == 1) $coef = 1; |
56 | 56 | |
57 | 57 | return [ |
58 | 58 | "caracteristique" => [ |
59 | - "attaque" => round($base_carac["attaque"]*$coef), |
|
60 | - "defense" => round($base_carac["defense"]*$coef), |
|
61 | - "resistance" => round($base_carac["resistance"]*$coef), |
|
59 | + "attaque" => round($base_carac["attaque"] * $coef), |
|
60 | + "defense" => round($base_carac["defense"] * $coef), |
|
61 | + "resistance" => round($base_carac["resistance"] * $coef), |
|
62 | 62 | "vitesse" => $base_carac["vitesse"] |
63 | 63 | ], |
64 | 64 | "cout_recruter" => [ |
65 | - "eau" => $ressource["eau"]*$coef, |
|
66 | - "electricite" => $ressource["electricite"]*$coef, |
|
67 | - "fer" => $ressource["fer"]*$coef, |
|
68 | - "fuel" => $ressource["fuel"]*$coef, |
|
65 | + "eau" => $ressource["eau"] * $coef, |
|
66 | + "electricite" => $ressource["electricite"] * $coef, |
|
67 | + "fer" => $ressource["fer"] * $coef, |
|
68 | + "fuel" => $ressource["fuel"] * $coef, |
|
69 | 69 | ], |
70 | 70 | "temps_recrutement" => $temps_recrutement |
71 | 71 | ]; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $unites = Bataille::getCentreRecherche()->getAllRechercheType($type); |
100 | 100 | |
101 | 101 | //recupérer les caractéristiques de l'unité en question |
102 | - for ($i=0 ; $i<count($unites) ; $i++) { |
|
102 | + for ($i = 0; $i < count($unites); $i++) { |
|
103 | 103 | $unites[$i] += $this->getCaracteristiqueUnite($unites[$i]["recherche"], $unites[$i]["niveau"], $type); |
104 | 104 | $unites[$i] += ["type" => $type]; |
105 | 105 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $today = Bataille::getToday(); |
120 | 120 | |
121 | 121 | foreach ($query as $obj) { |
122 | - if ($obj->date_fin-$today <= 0) { |
|
122 | + if ($obj->date_fin - $today <= 0) { |
|
123 | 123 | $this->setTerminerRecrutement($obj->ID_recrutement); |
124 | 124 | } |
125 | 125 | else { |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | "nom" => $obj->nom, |
128 | 128 | "type" => $obj->type, |
129 | 129 | "nombre" => $obj->nombre, |
130 | - "date_fin_recrutement" => $obj->date_fin-$today, |
|
130 | + "date_fin_recrutement" => $obj->date_fin - $today, |
|
131 | 131 | "id_recrutement" => $obj->ID_recrutement |
132 | 132 | ]; |
133 | 133 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $count_type = count($types); |
150 | 150 | $unites = []; |
151 | 151 | |
152 | - for ($i=0 ; $i<$count_type ; $i++) { |
|
152 | + for ($i = 0; $i < $count_type; $i++) { |
|
153 | 153 | $type_unite = $this->getAllUniteType($types[$i], $id_base); |
154 | 154 | |
155 | 155 | $unites = array_merge($unites, $type_unite); |
@@ -215,23 +215,23 @@ discard block |
||
215 | 215 | if ((is_array($query)) && (count($query) == 1)) { |
216 | 216 | foreach ($query as $obj) { |
217 | 217 | $pour_recruter = unserialize($obj->pour_recruter); |
218 | - $temps_recrutement = round($obj->temps_recrutement-($obj->temps_recrutement*Bataille::getBatiment()->getNiveauBatiment("caserne")/100)); |
|
218 | + $temps_recrutement = round($obj->temps_recrutement - ($obj->temps_recrutement * Bataille::getBatiment()->getNiveauBatiment("caserne") / 100)); |
|
219 | 219 | } |
220 | 220 | } |
221 | 221 | |
222 | 222 | //on test si on a assez de ressource pour recruter les unites |
223 | 223 | //on test si assez de ressources dans la base |
224 | - $retirer_eau = $pour_recruter["eau"]*$nombre; |
|
225 | - $retirer_electricite = $pour_recruter["electricite"]*$nombre; |
|
226 | - $retirer_fer = $pour_recruter["fer"]*$nombre; |
|
227 | - $retirer_fuel = $pour_recruter["fuel"]*$nombre; |
|
224 | + $retirer_eau = $pour_recruter["eau"] * $nombre; |
|
225 | + $retirer_electricite = $pour_recruter["electricite"] * $nombre; |
|
226 | + $retirer_fer = $pour_recruter["fer"] * $nombre; |
|
227 | + $retirer_fuel = $pour_recruter["fuel"] * $nombre; |
|
228 | 228 | $eau = Bataille::getTestAssezRessourceBase("eau", $retirer_eau); |
229 | 229 | $electricite = Bataille::getTestAssezRessourceBase("electricite", $retirer_electricite); |
230 | 230 | $fer = Bataille::getTestAssezRessourceBase("fer", $retirer_fer); |
231 | 231 | $fuel = Bataille::getTestAssezRessourceBase("fuel", $retirer_fuel); |
232 | 232 | |
233 | 233 | |
234 | - if (($eau["class"] || $electricite["class"] || $fer["class"] || $fuel["class"]) == "rouge" ) { |
|
234 | + if (($eau["class"] || $electricite["class"] || $fer["class"] || $fuel["class"]) == "rouge") { |
|
235 | 235 | FlashMessage::setFlash("Pas assez de ressources pour recruter autant d'unités"); |
236 | 236 | return false; |
237 | 237 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | //on retire les ressources |
240 | 240 | Bataille::getRessource()->setUpdateRessource($retirer_eau, $retirer_electricite, $retirer_fer, $retirer_fuel, 0, "-"); |
241 | 241 | |
242 | - $date_fin = Bataille::getToday()+($temps_recrutement*$nombre); |
|
242 | + $date_fin = Bataille::getToday() + ($temps_recrutement * $nombre); |
|
243 | 243 | |
244 | 244 | $dbc->insert("nom", $nom) |
245 | 245 | ->insert("type", $type) |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | $type = $obj->type; |
271 | 271 | } |
272 | 272 | |
273 | - for ($i=0 ; $i<$nombre ; $i++) { |
|
273 | + for ($i = 0; $i < $nombre; $i++) { |
|
274 | 274 | $dbc->insert("nom", $nom) |
275 | 275 | ->insert("type", $type) |
276 | 276 | ->insert("ID_base", Bataille::getIdBase()) |