@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | public function getRessourceConstruire() { |
48 | 48 | return $this->ressource_construire; |
49 | 49 | } |
50 | - public function getInfoBatiment(){ |
|
50 | + public function getInfoBatiment() { |
|
51 | 51 | return $this->info_batiment; |
52 | 52 | } |
53 | - public function getInfoBatimentNext(){ |
|
53 | + public function getInfoBatimentNext() { |
|
54 | 54 | return $this->info_batiment_next; |
55 | 55 | } |
56 | 56 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | if ((is_array($query)) && (count($query) > 0)) { |
87 | 87 | foreach ($query as $obj) { |
88 | 88 | if ($obj->construction == 1) { |
89 | - return $obj->niveau-1; |
|
89 | + return $obj->niveau - 1; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | return $obj->niveau; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | if ($niveau > 0) { |
149 | 149 | $query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $niveau)->get(); |
150 | 150 | |
151 | - if ((is_array($query)) && (count($query) > 0)){ |
|
151 | + if ((is_array($query)) && (count($query) > 0)) { |
|
152 | 152 | foreach ($query as $obj) { |
153 | 153 | return $obj->stockage; |
154 | 154 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $this->niveau_batiment = $this->niveau_batiment + 1; |
188 | 188 | } |
189 | 189 | |
190 | - $max_level = $this->getInfoUpgradeBatiment(); |
|
190 | + $max_level = $this->getInfoUpgradeBatiment(); |
|
191 | 191 | } |
192 | 192 | else { |
193 | 193 | $query = $dbc1->select("nom_table") |
@@ -252,12 +252,12 @@ discard block |
||
252 | 252 | $id_batiment = $obj->ID_batiment; |
253 | 253 | } |
254 | 254 | |
255 | - if ($this->date_fin_construction-$today <= 0) { |
|
255 | + if ($this->date_fin_construction - $today <= 0) { |
|
256 | 256 | $this->setTerminerConstruction($id_batiment); |
257 | 257 | } |
258 | 258 | else { |
259 | 259 | Bataille::setValues([ |
260 | - "date_fin_construction" => $this->date_fin_construction-$today, |
|
260 | + "date_fin_construction" => $this->date_fin_construction - $today, |
|
261 | 261 | "nom_batiment_construction" => $this->nom_batiment_construction |
262 | 262 | ]); |
263 | 263 | } |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | //et compare la liste des batiments qu'il faut pour construire le batiment |
307 | 307 | //a ceux qui sont deja construit dans la base |
308 | 308 | //si tous les batments qu'il faut son batis on autorise la construction du batiment |
309 | - for ($i=0 ; $i<$c_all_batiment ; $i++) { |
|
309 | + for ($i = 0; $i < $c_all_batiment; $i++) { |
|
310 | 310 | if (!in_array($all_batiment[$i], $batiment_construit)) { |
311 | 311 | $query = $dbc1->select("pour_construire") |
312 | 312 | ->select("temps_construction") |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | $pour_construire = []; |
324 | 324 | } |
325 | 325 | |
326 | - $temps_construction = gmdate("H:i:s", round($obj->temps_construction-($obj->temps_construction*Bataille::getBatiment()->getNiveauBatiment("centre_commandement")/100))); |
|
326 | + $temps_construction = gmdate("H:i:s", round($obj->temps_construction - ($obj->temps_construction * Bataille::getBatiment()->getNiveauBatiment("centre_commandement") / 100))); |
|
327 | 327 | $taille_batiment = $this->getTailleBatiment($all_batiment[$i]); |
328 | 328 | } |
329 | 329 | } |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | else if (count($pour_construire) > 1) { |
349 | 349 | $ok_construction = false; |
350 | 350 | //test si tous les batiments sont construits et on le niveau nécéssaire |
351 | - for ($j=0 ; $j<count($pour_construire) ; $j++) { |
|
351 | + for ($j = 0; $j < count($pour_construire); $j++) { |
|
352 | 352 | if (in_array($pour_construire[$j][1], $batiment_construit)) { |
353 | 353 | if ($pour_construire[$j][2] <= $this->getNiveauBatiment($pour_construire[$j][1])) { |
354 | 354 | $ok_construction = true; |
@@ -415,8 +415,8 @@ discard block |
||
415 | 415 | $case_depart = explode(",", $case_depart); |
416 | 416 | $posx = $case_depart[0]; |
417 | 417 | $posy = $case_depart[1]; |
418 | - $finx = $width_batiment+$posx; |
|
419 | - $finy = $height_batiment+$posy; |
|
418 | + $finx = $width_batiment + $posx; |
|
419 | + $finy = $height_batiment + $posy; |
|
420 | 420 | |
421 | 421 | //récupération de tous les batiments |
422 | 422 | $query = $dbc->select("posx") |
@@ -432,11 +432,11 @@ discard block |
||
432 | 432 | $posx_batiment = $obj->posx; |
433 | 433 | $posy_batiment = $obj->posy; |
434 | 434 | |
435 | - $finx_batiment = $taille_batiment[0]+$posx_batiment; |
|
436 | - $finy_batiment = $taille_batiment[1]+$posy_batiment; |
|
435 | + $finx_batiment = $taille_batiment[0] + $posx_batiment; |
|
436 | + $finy_batiment = $taille_batiment[1] + $posy_batiment; |
|
437 | 437 | |
438 | - for ($i=$posy ; $i<$finy ; $i++) { |
|
439 | - for ($j=$posx ; $j<$finx ; $j++) { |
|
438 | + for ($i = $posy; $i < $finy; $i++) { |
|
439 | + for ($j = $posx; $j < $finx; $j++) { |
|
440 | 440 | if ((($posx++ >= $posx_batiment) && ($posx++ <= $finx_batiment)) && (($posy++ >= $posy_batiment) && ($posy++ <= $finy_batiment))) { |
441 | 441 | FlashMessage::setFlash("Un batiment est déjà présent à cet emplacement, merci d'en choisir un autre"); |
442 | 442 | return false; |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | private function getRessourceConstruireBatiment($nom_batiment_sql, $niveau) { |
489 | 489 | $dbc1 = Bataille::getDb(); |
490 | 490 | |
491 | - $niveau = $niveau+1; |
|
491 | + $niveau = $niveau + 1; |
|
492 | 492 | |
493 | 493 | $query = $dbc1->select("ressource_construire")->from($nom_batiment_sql)->where("ID_".$nom_batiment_sql, "=", $niveau)->get(); |
494 | 494 | |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | */ |
522 | 522 | private function getTestBatimentConstruction($nom_batiment) { |
523 | 523 | if (ChaineCaractere::FindInString($nom_batiment, " en construction") == true) { |
524 | - return [substr($nom_batiment, 0, (0-strlen(" en construction"))), true]; |
|
524 | + return [substr($nom_batiment, 0, (0 - strlen(" en construction"))), true]; |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | return [$nom_batiment, false]; |
@@ -535,13 +535,13 @@ discard block |
||
535 | 535 | $dbc1 = Bataille::getDb(); |
536 | 536 | |
537 | 537 | //récupération du temps et des ressources pour construire |
538 | - $query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1)->get(); |
|
538 | + $query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1)->get(); |
|
539 | 539 | |
540 | 540 | //si on a quelque chose cela veut dire qu'on est pas encore au lvl max du batiment |
541 | 541 | if ((is_array($query)) && (count($query) > 0)) { |
542 | 542 | foreach ($query as $obj) { |
543 | 543 | $this->ressource_construire = $this->getRessourceConstruireBatiment($this->nom_batiment_sql, $this->niveau_batiment); |
544 | - $this->temps_construction = DateHeure::Secondeenheure(round($obj->temps_construction-($obj->temps_construction*Bataille::getBatiment()->getNiveauBatiment("centre_commandement")/100))); |
|
544 | + $this->temps_construction = DateHeure::Secondeenheure(round($obj->temps_construction - ($obj->temps_construction * Bataille::getBatiment()->getNiveauBatiment("centre_commandement") / 100))); |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | //récupération des éléments particulier à un batiment |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment) |
557 | 557 | ->get(); |
558 | 558 | |
559 | - if ((is_array($query)) && (count($query) > 0)){ |
|
559 | + if ((is_array($query)) && (count($query) > 0)) { |
|
560 | 560 | foreach ($query as $obj) { |
561 | 561 | $this->info_batiment = $xml->$nom_batiment_sql->phrase.$obj->$champ.$xml->$nom_batiment_sql->complement; |
562 | 562 | } |
@@ -565,10 +565,10 @@ discard block |
||
565 | 565 | //récupération de la phrase pour le niveau suivant |
566 | 566 | $query = $dbc1->select($xml->$nom_batiment_sql->champ) |
567 | 567 | ->from($this->nom_batiment_sql) |
568 | - ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1) |
|
568 | + ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1) |
|
569 | 569 | ->get(); |
570 | 570 | |
571 | - if ((is_array($query)) && (count($query) > 0)){ |
|
571 | + if ((is_array($query)) && (count($query) > 0)) { |
|
572 | 572 | foreach ($query as $obj) { |
573 | 573 | $this->info_batiment_next = $xml->$nom_batiment_sql->phrase_suivant.$obj->$champ.$xml->$nom_batiment_sql->complement; |
574 | 574 | } |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | } |
621 | 621 | |
622 | 622 | //si pas assez de ressource |
623 | - if (($ressource["eau"]["class"] || $ressource["electricite"]["class"] ||$ressource["fer"]["class"] ||$ressource["fuel"]["class"]) == "rouge") { |
|
623 | + if (($ressource["eau"]["class"] || $ressource["electricite"]["class"] || $ressource["fer"]["class"] || $ressource["fuel"]["class"]) == "rouge") { |
|
624 | 624 | FlashMessage::setFlash("Pas assez de ressources pour construire ce batiment"); |
625 | 625 | return false; |
626 | 626 | } |
@@ -629,17 +629,17 @@ discard block |
||
629 | 629 | $query = $dbc1->select("ressource_construire") |
630 | 630 | ->select("temps_construction") |
631 | 631 | ->from($this->nom_batiment_sql) |
632 | - ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1) |
|
632 | + ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1) |
|
633 | 633 | ->get(); |
634 | 634 | |
635 | 635 | foreach ($query as $obj) { |
636 | - $temps_construction = round($obj->temps_construction-($obj->temps_construction*Bataille::getBatiment()->getNiveauBatiment("centre_commandement")/100)); |
|
636 | + $temps_construction = round($obj->temps_construction - ($obj->temps_construction * Bataille::getBatiment()->getNiveauBatiment("centre_commandement") / 100)); |
|
637 | 637 | $ressource_construction = explode(", ", $obj->ressource_construire); |
638 | 638 | } |
639 | 639 | |
640 | 640 | //on insere la construction dans la table batiment si new batiment |
641 | 641 | if ($un_batiment == 0) { |
642 | - $dbc->insert("niveau", $this->niveau_batiment+1) |
|
642 | + $dbc->insert("niveau", $this->niveau_batiment + 1) |
|
643 | 643 | ->insert("nom_batiment", $nom_batiment) |
644 | 644 | ->insert("nom_batiment_sql", $this->nom_batiment_sql) |
645 | 645 | ->insert("posx", intval($posx)) |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | $this->id_batiment = $dbc->lastInsertId(); |
653 | 653 | } |
654 | 654 | else { |
655 | - $dbc->update("niveau", $this->niveau_batiment+1) |
|
655 | + $dbc->update("niveau", $this->niveau_batiment + 1) |
|
656 | 656 | ->update("construction", 1) |
657 | 657 | ->from("_bataille_batiment") |
658 | 658 | ->where("ID_batiment", "=", $this->id_batiment, "AND") |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | $today = Bataille::getToday(); |
667 | 667 | |
668 | 668 | //date de la fin de la construction en seconde |
669 | - $fin_construction = $today+$temps_construction; |
|
669 | + $fin_construction = $today + $temps_construction; |
|
670 | 670 | |
671 | 671 | $dbc->insert("date_fin", $fin_construction) |
672 | 672 | ->insert("ID_base", Bataille::getIdBase()) |