@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public function getRessourceConstruire() { |
46 | 46 | return $this->ressource_construire; |
47 | 47 | } |
48 | - public function getInfoBatiment(){ |
|
48 | + public function getInfoBatiment() { |
|
49 | 49 | return $this->info_batiment; |
50 | 50 | } |
51 | 51 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | if ((is_array($query)) && (count($query) > 0)) { |
78 | 78 | foreach ($query as $obj) { |
79 | 79 | if ($obj->construction == 1) { |
80 | - return $obj->niveau-1; |
|
80 | + return $obj->niveau - 1; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | return $obj->niveau; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | if ($niveau > 0) { |
146 | 146 | $query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $niveau)->get(); |
147 | 147 | |
148 | - if ((is_array($query)) && (count($query) > 0)){ |
|
148 | + if ((is_array($query)) && (count($query) > 0)) { |
|
149 | 149 | foreach ($query as $obj) { |
150 | 150 | return $obj->stockage; |
151 | 151 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | } |
184 | 184 | |
185 | 185 | if (($construction[1] == true) && ($this->niveau_batiment > 1)) { |
186 | - $this->niveau_batiment = $this->niveau_batiment+1; |
|
186 | + $this->niveau_batiment = $this->niveau_batiment + 1; |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | return $this->getInfoUpgradeBatiment(); |
@@ -258,12 +258,12 @@ discard block |
||
258 | 258 | $id_batiment = $obj->ID_batiment; |
259 | 259 | } |
260 | 260 | |
261 | - if ($this->date_fin_construction-$today <= 0) { |
|
261 | + if ($this->date_fin_construction - $today <= 0) { |
|
262 | 262 | $this->setTerminerConstruction($id_batiment); |
263 | 263 | } |
264 | 264 | else { |
265 | - $this->date_fin_construction = $this->date_fin_construction-$today; |
|
266 | - Bataille::setValues(["date_fin_construction" => $this->date_fin_construction-$today]); |
|
265 | + $this->date_fin_construction = $this->date_fin_construction - $today; |
|
266 | + Bataille::setValues(["date_fin_construction" => $this->date_fin_construction - $today]); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | return 1; |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | //et compare la liste des batiments qu'il faut pour construire le batiment |
311 | 311 | //a ceux qui sont deja construit dans la base |
312 | 312 | //si tous les batments qu'il faut son batis on autorise la construction du batiment |
313 | - for ($i=0 ; $i<$c_all_batiment ; $i++) { |
|
313 | + for ($i = 0; $i < $c_all_batiment; $i++) { |
|
314 | 314 | if (!in_array($all_batiment[$i], $batiment_construit)) { |
315 | 315 | $query = $dbc1->select("pour_construire") |
316 | 316 | ->select("temps_construction") |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | private function getRessourceConstruireBatiment($nom_batiment_sql, $niveau) { |
375 | 375 | $dbc1 = Bataille::getDb(); |
376 | 376 | |
377 | - $niveau = $niveau+1; |
|
377 | + $niveau = $niveau + 1; |
|
378 | 378 | |
379 | 379 | $query = $dbc1->select("ressource_construire")->from($nom_batiment_sql)->where("ID_".$nom_batiment_sql, "=", $niveau)->get(); |
380 | 380 | |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | */ |
408 | 408 | private function getTestBatimentConstruction($nom_batiment) { |
409 | 409 | if (ChaineCaractere::FindInString($nom_batiment, " en construction") == true) { |
410 | - return [substr($nom_batiment, 0, (0-strlen(" en construction"))), true]; |
|
410 | + return [substr($nom_batiment, 0, (0 - strlen(" en construction"))), true]; |
|
411 | 411 | } |
412 | 412 | |
413 | 413 | return [$nom_batiment, false]; |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | $dbc1 = Bataille::getDb(); |
423 | 423 | |
424 | 424 | //récupération du temps et des ressources pour construire |
425 | - $query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1)->get(); |
|
425 | + $query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1)->get(); |
|
426 | 426 | |
427 | 427 | //si on a quelque chose cela veut dire qu'on est pas encore au lvl max du batiment |
428 | 428 | if ((is_array($query)) && (count($query) > 0)) { |
@@ -433,11 +433,11 @@ discard block |
||
433 | 433 | |
434 | 434 | //récupération des éléments particulier à un batiment |
435 | 435 | if ($this->nom_batiment_sql == "entrepot") { |
436 | - $query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $this->niveau_batiment+1)->get(); |
|
436 | + $query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $this->niveau_batiment + 1)->get(); |
|
437 | 437 | |
438 | - if ((is_array($query)) && (count($query) > 0)){ |
|
438 | + if ((is_array($query)) && (count($query) > 0)) { |
|
439 | 439 | foreach ($query as $obj) { |
440 | - $this->info_batiment = "Capacité de l'entrepôt au prochain niveau : ". $obj->stockage; |
|
440 | + $this->info_batiment = "Capacité de l'entrepôt au prochain niveau : ".$obj->stockage; |
|
441 | 441 | } |
442 | 442 | } |
443 | 443 | } |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | $query = $dbc1->select("ressource_construire") |
493 | 493 | ->select("temps_construction") |
494 | 494 | ->from($this->nom_batiment_sql) |
495 | - ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1) |
|
495 | + ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1) |
|
496 | 496 | ->get(); |
497 | 497 | |
498 | 498 | foreach ($query as $obj) { |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | |
503 | 503 | //on insere la construction dans la table batiment si new batiment |
504 | 504 | if ($un_batiment == 0) { |
505 | - $dbc->insert("niveau", $this->niveau_batiment+1) |
|
505 | + $dbc->insert("niveau", $this->niveau_batiment + 1) |
|
506 | 506 | ->insert("emplacement", $emplacement) |
507 | 507 | ->insert("nom_batiment", $nom_batiment) |
508 | 508 | ->insert("nom_batiment_sql", $this->nom_batiment_sql) |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | $this->id_batiment = $dbc->lastInsertId(); |
515 | 515 | } |
516 | 516 | else { |
517 | - $dbc->update("niveau", $this->niveau_batiment+1) |
|
517 | + $dbc->update("niveau", $this->niveau_batiment + 1) |
|
518 | 518 | ->update("construction", 1) |
519 | 519 | ->from("_bataille_batiment") |
520 | 520 | ->where("ID_batiment", "=", $this->id_batiment, "AND") |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | $today = $today->getTimestamp(); |
530 | 530 | |
531 | 531 | //date de la fin de la construction en seconde |
532 | - $fin_construction = $today+$temps_construction; |
|
532 | + $fin_construction = $today + $temps_construction; |
|
533 | 533 | |
534 | 534 | $dbc->insert("date_fin", $fin_construction) |
535 | 535 | ->insert("emplacement_construction", $emplacement) |