@@ -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 | } |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | if (($construction[1] == true) && ($this->niveau_batiment > 1)) { |
236 | 236 | $this->niveau_batiment = $this->niveau_batiment + 1; |
237 | 237 | } |
238 | - $max_level = $this->getInfoUpgradeBatiment(); |
|
238 | + $max_level = $this->getInfoUpgradeBatiment(); |
|
239 | 239 | } |
240 | 240 | else { |
241 | 241 | //on test voir si le bat est au niveau max et si il peut avoir un addon |
@@ -307,12 +307,12 @@ discard block |
||
307 | 307 | $id_batiment = $obj->ID_batiment; |
308 | 308 | } |
309 | 309 | |
310 | - if ($this->date_fin_construction-$today <= 0) { |
|
310 | + if ($this->date_fin_construction - $today <= 0) { |
|
311 | 311 | $this->setTerminerConstruction($id_batiment); |
312 | 312 | } |
313 | 313 | else { |
314 | 314 | Bataille::setValues([ |
315 | - "date_fin_construction" => $this->date_fin_construction-$today, |
|
315 | + "date_fin_construction" => $this->date_fin_construction - $today, |
|
316 | 316 | "nom_batiment_construction" => $this->nom_batiment_construction |
317 | 317 | ]); |
318 | 318 | } |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | //et compare la liste des batiments qu'il faut pour construire le batiment |
362 | 362 | //a ceux qui sont deja construit dans la base |
363 | 363 | //si tous les batments qu'il faut son batis on autorise la construction du batiment |
364 | - for ($i=0 ; $i<$c_all_batiment ; $i++) { |
|
364 | + for ($i = 0; $i < $c_all_batiment; $i++) { |
|
365 | 365 | if (!in_array($all_batiment[$i], $batiment_construit)) { |
366 | 366 | $query = $dbc1->select("pour_construire") |
367 | 367 | ->select("temps_construction") |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | private function getRessourceConstruireBatiment($nom_batiment_sql, $niveau) { |
426 | 426 | $dbc1 = Bataille::getDb(); |
427 | 427 | |
428 | - $niveau = $niveau+1; |
|
428 | + $niveau = $niveau + 1; |
|
429 | 429 | |
430 | 430 | $query = $dbc1->select("ressource_construire")->from($nom_batiment_sql)->where("ID_".$nom_batiment_sql, "=", $niveau)->get(); |
431 | 431 | |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | */ |
459 | 459 | private function getTestBatimentConstruction($nom_batiment) { |
460 | 460 | if (ChaineCaractere::FindInString($nom_batiment, " en construction") == true) { |
461 | - return [substr($nom_batiment, 0, (0-strlen(" en construction"))), true]; |
|
461 | + return [substr($nom_batiment, 0, (0 - strlen(" en construction"))), true]; |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | return [$nom_batiment, false]; |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | $dbc1 = Bataille::getDb(); |
474 | 474 | |
475 | 475 | //récupération du temps et des ressources pour construire |
476 | - $query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1)->get(); |
|
476 | + $query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1)->get(); |
|
477 | 477 | |
478 | 478 | //si on a quelque chose cela veut dire qu'on est pas encore au lvl max du batiment |
479 | 479 | if ((is_array($query)) && (count($query) > 0)) { |
@@ -484,11 +484,11 @@ discard block |
||
484 | 484 | |
485 | 485 | //récupération des éléments particulier à un batiment |
486 | 486 | if ($this->nom_batiment_sql == "entrepot") { |
487 | - $query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $this->niveau_batiment+1)->get(); |
|
487 | + $query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $this->niveau_batiment + 1)->get(); |
|
488 | 488 | |
489 | - if ((is_array($query)) && (count($query) > 0)){ |
|
489 | + if ((is_array($query)) && (count($query) > 0)) { |
|
490 | 490 | foreach ($query as $obj) { |
491 | - $this->info_batiment = "Capacité de l'entrepôt au prochain niveau : ". $obj->stockage; |
|
491 | + $this->info_batiment = "Capacité de l'entrepôt au prochain niveau : ".$obj->stockage; |
|
492 | 492 | } |
493 | 493 | } |
494 | 494 | } |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | $query = $dbc1->select("ressource_construire") |
550 | 550 | ->select("temps_construction") |
551 | 551 | ->from($this->nom_batiment_sql) |
552 | - ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1) |
|
552 | + ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1) |
|
553 | 553 | ->get(); |
554 | 554 | |
555 | 555 | foreach ($query as $obj) { |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | |
560 | 560 | //on insere la construction dans la table batiment si new batiment |
561 | 561 | if ($un_batiment == 0) { |
562 | - $dbc->insert("niveau", $this->niveau_batiment+1) |
|
562 | + $dbc->insert("niveau", $this->niveau_batiment + 1) |
|
563 | 563 | ->insert("emplacement", $emplacement) |
564 | 564 | ->insert("nom_batiment", $nom_batiment) |
565 | 565 | ->insert("nom_batiment_sql", $this->nom_batiment_sql) |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | $this->id_batiment = $dbc->lastInsertId(); |
572 | 572 | } |
573 | 573 | else { |
574 | - $dbc->update("niveau", $this->niveau_batiment+1) |
|
574 | + $dbc->update("niveau", $this->niveau_batiment + 1) |
|
575 | 575 | ->update("construction", 1) |
576 | 576 | ->from("_bataille_batiment") |
577 | 577 | ->where("ID_batiment", "=", $this->id_batiment, "AND") |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | $today = $today->getTimestamp(); |
587 | 587 | |
588 | 588 | //date de la fin de la construction en seconde |
589 | - $fin_construction = $today+$temps_construction; |
|
589 | + $fin_construction = $today + $temps_construction; |
|
590 | 590 | |
591 | 591 | $dbc->insert("date_fin", $fin_construction) |
592 | 592 | ->insert("emplacement_construction", $emplacement) |