@@ -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 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $this->niveau_batiment = 0; |
203 | 203 | } |
204 | 204 | |
205 | - $max_level = $this->getInfoUpgradeBatiment(); |
|
205 | + $max_level = $this->getInfoUpgradeBatiment(); |
|
206 | 206 | |
207 | 207 | //permet de savoir si le batiment produit bien des ressoures |
208 | 208 | $batiment_production = []; |
@@ -250,12 +250,12 @@ discard block |
||
250 | 250 | $id_batiment = $obj->ID_batiment; |
251 | 251 | } |
252 | 252 | |
253 | - if ($this->date_fin_construction-$today <= 0) { |
|
253 | + if ($this->date_fin_construction - $today <= 0) { |
|
254 | 254 | $this->setTerminerConstruction($id_batiment); |
255 | 255 | } |
256 | 256 | else { |
257 | 257 | Bataille::setValues([ |
258 | - "date_fin_construction" => $this->date_fin_construction-$today, |
|
258 | + "date_fin_construction" => $this->date_fin_construction - $today, |
|
259 | 259 | "nom_batiment_construction" => $this->nom_batiment_construction |
260 | 260 | ]); |
261 | 261 | } |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | //et compare la liste des batiments qu'il faut pour construire le batiment |
305 | 305 | //a ceux qui sont deja construit dans la base |
306 | 306 | //si tous les batments qu'il faut son batis on autorise la construction du batiment |
307 | - for ($i=0 ; $i<$c_all_batiment ; $i++) { |
|
307 | + for ($i = 0; $i < $c_all_batiment; $i++) { |
|
308 | 308 | if (!in_array($all_batiment[$i], $batiment_construit)) { |
309 | 309 | $query = $dbc1->select("pour_construire") |
310 | 310 | ->select("temps_construction") |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | else if (count($pour_construire) > 1) { |
345 | 345 | $ok_construction = false; |
346 | 346 | //test si tous les batiments sont construits et on le niveau nécéssaire |
347 | - for ($j=0 ; $j<count($pour_construire) ; $j++) { |
|
347 | + for ($j = 0; $j < count($pour_construire); $j++) { |
|
348 | 348 | if (in_array($pour_construire[$j][1], $batiment_construit)) { |
349 | 349 | if ($pour_construire[$j][2] <= $this->getNiveauBatiment($pour_construire[$j][1])) { |
350 | 350 | $ok_construction = true; |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | private function getRessourceConstruireBatiment($nom_batiment_sql, $niveau) { |
397 | 397 | $dbc1 = Bataille::getDb(); |
398 | 398 | |
399 | - $niveau = $niveau+1; |
|
399 | + $niveau = $niveau + 1; |
|
400 | 400 | |
401 | 401 | $query = $dbc1->select("ressource_construire")->from($nom_batiment_sql)->where("ID_".$nom_batiment_sql, "=", $niveau)->get(); |
402 | 402 | |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | */ |
430 | 430 | private function getTestBatimentConstruction($nom_batiment) { |
431 | 431 | if (ChaineCaractere::FindInString($nom_batiment, " en construction") == true) { |
432 | - return [substr($nom_batiment, 0, (0-strlen(" en construction"))), true]; |
|
432 | + return [substr($nom_batiment, 0, (0 - strlen(" en construction"))), true]; |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | return [$nom_batiment, false]; |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | $dbc1 = Bataille::getDb(); |
444 | 444 | |
445 | 445 | //récupération du temps et des ressources pour construire |
446 | - $query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1)->get(); |
|
446 | + $query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1)->get(); |
|
447 | 447 | |
448 | 448 | //si on a quelque chose cela veut dire qu'on est pas encore au lvl max du batiment |
449 | 449 | if ((is_array($query)) && (count($query) > 0)) { |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment) |
465 | 465 | ->get(); |
466 | 466 | |
467 | - if ((is_array($query)) && (count($query) > 0)){ |
|
467 | + if ((is_array($query)) && (count($query) > 0)) { |
|
468 | 468 | foreach ($query as $obj) { |
469 | 469 | $this->info_batiment = $xml->$nom_batiment_sql->phrase.$obj->$champ.$xml->$nom_batiment_sql->complement; |
470 | 470 | } |
@@ -473,10 +473,10 @@ discard block |
||
473 | 473 | //récupération de la phrase pour le niveau suivant |
474 | 474 | $query = $dbc1->select($xml->$nom_batiment_sql->champ) |
475 | 475 | ->from($this->nom_batiment_sql) |
476 | - ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1) |
|
476 | + ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1) |
|
477 | 477 | ->get(); |
478 | 478 | |
479 | - if ((is_array($query)) && (count($query) > 0)){ |
|
479 | + if ((is_array($query)) && (count($query) > 0)) { |
|
480 | 480 | foreach ($query as $obj) { |
481 | 481 | $this->info_batiment_next = $xml->$nom_batiment_sql->phrase_suivant.$obj->$champ.$xml->$nom_batiment_sql->complement; |
482 | 482 | } |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | $query = $dbc1->select("ressource_construire") |
546 | 546 | ->select("temps_construction") |
547 | 547 | ->from($this->nom_batiment_sql) |
548 | - ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1) |
|
548 | + ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1) |
|
549 | 549 | ->get(); |
550 | 550 | |
551 | 551 | foreach ($query as $obj) { |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | |
556 | 556 | //on insere la construction dans la table batiment si new batiment |
557 | 557 | if ($un_batiment == 0) { |
558 | - $dbc->insert("niveau", $this->niveau_batiment+1) |
|
558 | + $dbc->insert("niveau", $this->niveau_batiment + 1) |
|
559 | 559 | ->insert("emplacement", $emplacement) |
560 | 560 | ->insert("nom_batiment", $nom_batiment) |
561 | 561 | ->insert("nom_batiment_sql", $this->nom_batiment_sql) |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | $this->id_batiment = $dbc->lastInsertId(); |
568 | 568 | } |
569 | 569 | else { |
570 | - $dbc->update("niveau", $this->niveau_batiment+1) |
|
570 | + $dbc->update("niveau", $this->niveau_batiment + 1) |
|
571 | 571 | ->update("construction", 1) |
572 | 572 | ->from("_bataille_batiment") |
573 | 573 | ->where("ID_batiment", "=", $this->id_batiment, "AND") |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | $today = Bataille::getToday(); |
582 | 582 | |
583 | 583 | //date de la fin de la construction en seconde |
584 | - $fin_construction = $today+$temps_construction; |
|
584 | + $fin_construction = $today + $temps_construction; |
|
585 | 585 | |
586 | 586 | $dbc->insert("date_fin", $fin_construction) |
587 | 587 | ->insert("emplacement_construction", $emplacement) |