@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | |
162 | 162 | /** |
163 | 163 | * @param null $id_base -> sert si definit a recuperer l'id identite de la abse en question |
164 | - * @return mixed |
|
164 | + * @return string|null |
|
165 | 165 | * recupere la date de la derniere connexion |
166 | 166 | */ |
167 | 167 | public static function getLastConnexion($id_base = null) { |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
191 | - * @param $nom_ressource |
|
191 | + * @param string $nom_ressource |
|
192 | 192 | * @param $ressource |
193 | 193 | * @return array |
194 | 194 | * fonction qui permet de renvyer la couleur rouge si pas assez de ressource pour construire le batiment |
@@ -213,8 +213,8 @@ discard block |
||
213 | 213 | |
214 | 214 | /** |
215 | 215 | * @param $id_base |
216 | - * @param null $vitesse = vitesse de l'unité en question |
|
217 | - * @return number |
|
216 | + * @param integer $vitesse = vitesse de l'unité en question |
|
217 | + * @return integer|null |
|
218 | 218 | * fonction qui renvoi le temps de trajet entre la base du joueur et une autre base en secondes |
219 | 219 | */ |
220 | 220 | public static function getDureeTrajet($id_base, $vitesse = 1) { |
@@ -295,8 +295,8 @@ discard block |
||
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
298 | - * @param $param |
|
299 | - * @return mixed |
|
298 | + * @param string $param |
|
299 | + * @return integer |
|
300 | 300 | * fonction qui sert à récupérer un parametre spécifique pour un batiment |
301 | 301 | * par exemple la vitesse d'un marchand ou le nombred'emplacment de la base |
302 | 302 | */ |
@@ -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 | } |
@@ -124,7 +124,9 @@ discard block |
||
124 | 124 | ->get(); |
125 | 125 | |
126 | 126 | if ((is_array($query)) && (count($query) == 1)) { |
127 | - foreach ($query as $obj) return $obj->ID_base; |
|
127 | + foreach ($query as $obj) { |
|
128 | + return $obj->ID_base; |
|
129 | + } |
|
128 | 130 | } |
129 | 131 | } |
130 | 132 | |
@@ -169,8 +171,7 @@ discard block |
||
169 | 171 | |
170 | 172 | if ($id_base === null) { |
171 | 173 | $query = $dbc->select()->from("_bataille_last_connexion")->where("ID_identite", "=", self::getIdIdentite())->get(); |
172 | - } |
|
173 | - else { |
|
174 | + } else { |
|
174 | 175 | $query = $dbc->select("_bataille_last_connexion.last_connexion")->from("_bataille_base") |
175 | 176 | ->from("_bataille_last_connexion") |
176 | 177 | ->from("identite") |
@@ -272,7 +273,9 @@ discard block |
||
272 | 273 | ->get(); |
273 | 274 | |
274 | 275 | if ((is_array($query)) && (count($query) == 1)) { |
275 | - foreach ($query as $obj) return $obj->ID_base; |
|
276 | + foreach ($query as $obj) { |
|
277 | + return $obj->ID_base; |
|
278 | + } |
|
276 | 279 | } |
277 | 280 | |
278 | 281 | return 0; |
@@ -288,7 +291,9 @@ discard block |
||
288 | 291 | $query = $dbc->select("nombre_joueur")->from("_bataille_nombre_joueur")->where("ID_nombre_joueur", "=", 1)->get(); |
289 | 292 | |
290 | 293 | if ((is_array($query)) && (count($query) == 1)) { |
291 | - foreach ($query as $obj) return $obj->nombre_joueur; |
|
294 | + foreach ($query as $obj) { |
|
295 | + return $obj->nombre_joueur; |
|
296 | + } |
|
292 | 297 | } |
293 | 298 | |
294 | 299 | return 0; |
@@ -306,7 +311,9 @@ discard block |
||
306 | 311 | $query = $dbc->select($param)->from("configuration")->where("ID_configuration", "=", 1)->get(); |
307 | 312 | |
308 | 313 | if ((is_array($query)) && (count($query) == 1)) { |
309 | - foreach ($query as $obj) return $obj->$param; |
|
314 | + foreach ($query as $obj) { |
|
315 | + return $obj->$param; |
|
316 | + } |
|
310 | 317 | } |
311 | 318 | } |
312 | 319 | //-------------------------- END GETTER ----------------------------------------------------------------------------// |
@@ -322,11 +329,12 @@ discard block |
||
322 | 329 | |
323 | 330 | if ($id_base === null) { |
324 | 331 | $id_identite = self::getIdIdentite(); |
325 | - } |
|
326 | - else { |
|
332 | + } else { |
|
327 | 333 | $query = $dbc->select("ID_identite")->from("_bataille_base")->where("ID_base", "=", $id_base)->get(); |
328 | 334 | |
329 | - foreach ($query as $obj) $id_identite = $obj->ID_identite; |
|
335 | + foreach ($query as $obj) { |
|
336 | + $id_identite = $obj->ID_identite; |
|
337 | + } |
|
330 | 338 | } |
331 | 339 | |
332 | 340 | $dbc->update("last_connexion", date("Y-m-d H:i:s")) |
@@ -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, |