@@ -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 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $this->niveau_batiment = $this->niveau_batiment + 1; |
| 189 | 189 | } |
| 190 | 190 | $niveau_batiment_base = $this->niveau_batiment; |
| 191 | - $max_level = $this->getInfoUpgradeBatiment(); |
|
| 191 | + $max_level = $this->getInfoUpgradeBatiment(); |
|
| 192 | 192 | } |
| 193 | 193 | else { |
| 194 | 194 | $query = $dbc1->select("nom_table") |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | - $max_level = $this->getInfoUpgradeBatiment(); |
|
| 205 | + $max_level = $this->getInfoUpgradeBatiment(); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | //permet de savoir si le batiment produit bien des ressoures |
@@ -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") |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | else if (count($pour_construire) > 1) { |
| 347 | 347 | $ok_construction = false; |
| 348 | 348 | //test si tous les batiments sont construits et on le niveau nécéssaire |
| 349 | - for ($j=0 ; $j<count($pour_construire) ; $j++) { |
|
| 349 | + for ($j = 0; $j < count($pour_construire); $j++) { |
|
| 350 | 350 | if (in_array($pour_construire[$j][1], $batiment_construit)) { |
| 351 | 351 | if ($pour_construire[$j][2] <= $this->getNiveauBatiment($pour_construire[$j][1])) { |
| 352 | 352 | $ok_construction = true; |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | private function getRessourceConstruireBatiment($nom_batiment_sql, $niveau) { |
| 399 | 399 | $dbc1 = Bataille::getDb(); |
| 400 | 400 | |
| 401 | - $niveau = $niveau+1; |
|
| 401 | + $niveau = $niveau + 1; |
|
| 402 | 402 | |
| 403 | 403 | $query = $dbc1->select("ressource_construire")->from($nom_batiment_sql)->where("ID_".$nom_batiment_sql, "=", $niveau)->get(); |
| 404 | 404 | |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | */ |
| 432 | 432 | private function getTestBatimentConstruction($nom_batiment) { |
| 433 | 433 | if (ChaineCaractere::FindInString($nom_batiment, " en construction") == true) { |
| 434 | - return [substr($nom_batiment, 0, (0-strlen(" en construction"))), true]; |
|
| 434 | + return [substr($nom_batiment, 0, (0 - strlen(" en construction"))), true]; |
|
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | return [$nom_batiment, false]; |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | $dbc1 = Bataille::getDb(); |
| 446 | 446 | |
| 447 | 447 | //récupération du temps et des ressources pour construire |
| 448 | - $query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1)->get(); |
|
| 448 | + $query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1)->get(); |
|
| 449 | 449 | |
| 450 | 450 | //si on a quelque chose cela veut dire qu'on est pas encore au lvl max du batiment |
| 451 | 451 | if ((is_array($query)) && (count($query) > 0)) { |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment) |
| 467 | 467 | ->get(); |
| 468 | 468 | |
| 469 | - if ((is_array($query)) && (count($query) > 0)){ |
|
| 469 | + if ((is_array($query)) && (count($query) > 0)) { |
|
| 470 | 470 | foreach ($query as $obj) { |
| 471 | 471 | $this->info_batiment = $xml->$nom_batiment_sql->phrase.$obj->$champ.$xml->$nom_batiment_sql->complement; |
| 472 | 472 | } |
@@ -475,10 +475,10 @@ discard block |
||
| 475 | 475 | //récupération de la phrase pour le niveau suivant |
| 476 | 476 | $query = $dbc1->select($xml->$nom_batiment_sql->champ) |
| 477 | 477 | ->from($this->nom_batiment_sql) |
| 478 | - ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1) |
|
| 478 | + ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1) |
|
| 479 | 479 | ->get(); |
| 480 | 480 | |
| 481 | - if ((is_array($query)) && (count($query) > 0)){ |
|
| 481 | + if ((is_array($query)) && (count($query) > 0)) { |
|
| 482 | 482 | foreach ($query as $obj) { |
| 483 | 483 | $this->info_batiment_next = $xml->$nom_batiment_sql->phrase_suivant.$obj->$champ.$xml->$nom_batiment_sql->complement; |
| 484 | 484 | } |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | $query = $dbc1->select("ressource_construire") |
| 548 | 548 | ->select("temps_construction") |
| 549 | 549 | ->from($this->nom_batiment_sql) |
| 550 | - ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1) |
|
| 550 | + ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1) |
|
| 551 | 551 | ->get(); |
| 552 | 552 | |
| 553 | 553 | foreach ($query as $obj) { |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | |
| 558 | 558 | //on insere la construction dans la table batiment si new batiment |
| 559 | 559 | if ($un_batiment == 0) { |
| 560 | - $dbc->insert("niveau", $this->niveau_batiment+1) |
|
| 560 | + $dbc->insert("niveau", $this->niveau_batiment + 1) |
|
| 561 | 561 | ->insert("emplacement", $emplacement) |
| 562 | 562 | ->insert("nom_batiment", $nom_batiment) |
| 563 | 563 | ->insert("nom_batiment_sql", $this->nom_batiment_sql) |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | $this->id_batiment = $dbc->lastInsertId(); |
| 570 | 570 | } |
| 571 | 571 | else { |
| 572 | - $dbc->update("niveau", $this->niveau_batiment+1) |
|
| 572 | + $dbc->update("niveau", $this->niveau_batiment + 1) |
|
| 573 | 573 | ->update("construction", 1) |
| 574 | 574 | ->from("_bataille_batiment") |
| 575 | 575 | ->where("ID_batiment", "=", $this->id_batiment, "AND") |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | $today = Bataille::getToday(); |
| 584 | 584 | |
| 585 | 585 | //date de la fin de la construction en seconde |
| 586 | - $fin_construction = $today+$temps_construction; |
|
| 586 | + $fin_construction = $today + $temps_construction; |
|
| 587 | 587 | |
| 588 | 588 | $dbc->insert("date_fin", $fin_construction) |
| 589 | 589 | ->insert("emplacement_construction", $emplacement) |
@@ -84,8 +84,7 @@ |
||
| 84 | 84 | "posx" => $obj->posx, |
| 85 | 85 | "posy" => $obj->posy, |
| 86 | 86 | ]; |
| 87 | - } |
|
| 88 | - else { |
|
| 87 | + } else { |
|
| 89 | 88 | $batiments[] = [ |
| 90 | 89 | "nom_batiment" => $obj->nom_batiment, |
| 91 | 90 | "nom_batiment_sql" => $obj->nom_batiment_sql, |