@@ -90,8 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | return $obj->niveau; |
| 92 | 92 | } |
| 93 | - } |
|
| 94 | - else { |
|
| 93 | + } else { |
|
| 95 | 94 | return 0; |
| 96 | 95 | } |
| 97 | 96 | } |
@@ -108,10 +107,18 @@ discard block |
||
| 108 | 107 | $id_base = Bataille::getIdBase(); |
| 109 | 108 | } |
| 110 | 109 | |
| 111 | - if ($ressource == "eau") $nom_batiment = "centrale_eau"; |
|
| 112 | - if ($ressource == "electricite") $nom_batiment = "centrale_electrique"; |
|
| 113 | - if ($ressource == "fuel") $nom_batiment = "station_pompage_fuel"; |
|
| 114 | - if ($ressource == "fer") $nom_batiment = "station_forage"; |
|
| 110 | + if ($ressource == "eau") { |
|
| 111 | + $nom_batiment = "centrale_eau"; |
|
| 112 | + } |
|
| 113 | + if ($ressource == "electricite") { |
|
| 114 | + $nom_batiment = "centrale_electrique"; |
|
| 115 | + } |
|
| 116 | + if ($ressource == "fuel") { |
|
| 117 | + $nom_batiment = "station_pompage_fuel"; |
|
| 118 | + } |
|
| 119 | + if ($ressource == "fer") { |
|
| 120 | + $nom_batiment = "station_forage"; |
|
| 121 | + } |
|
| 115 | 122 | |
| 116 | 123 | $niveau = $this->getNiveauBatiment($nom_batiment, $id_base); |
| 117 | 124 | |
@@ -132,15 +139,13 @@ discard block |
||
| 132 | 139 | foreach ($query as $obj) { |
| 133 | 140 | $prod_addon = $obj->production; |
| 134 | 141 | } |
| 135 | - } |
|
| 136 | - else { |
|
| 142 | + } else { |
|
| 137 | 143 | $prod_addon = 0; |
| 138 | 144 | } |
| 139 | 145 | |
| 140 | 146 | return $prod + $prod_addon; |
| 141 | 147 | } |
| 142 | - } |
|
| 143 | - else { |
|
| 148 | + } else { |
|
| 144 | 149 | return 20; |
| 145 | 150 | } |
| 146 | 151 | } |
@@ -166,8 +171,7 @@ discard block |
||
| 166 | 171 | return $obj->stockage; |
| 167 | 172 | } |
| 168 | 173 | } |
| 169 | - } |
|
| 170 | - else { |
|
| 174 | + } else { |
|
| 171 | 175 | return 1000; |
| 172 | 176 | } |
| 173 | 177 | } |
@@ -203,8 +207,7 @@ discard block |
||
| 203 | 207 | } |
| 204 | 208 | $niveau_batiment_base = $this->niveau_batiment; |
| 205 | 209 | $max_level = $this->getInfoUpgradeBatiment(); |
| 206 | - } |
|
| 207 | - else { |
|
| 210 | + } else { |
|
| 208 | 211 | //on test voir si le bat est au niveau max et si il peut avoir un addon |
| 209 | 212 | if (ChaineCaractere::FindInString($nom_batiment, "addon")) { |
| 210 | 213 | $query = $dbc1->select("nom_table")->from("liste_batiment")->where("nom", "=", $nom_batiment)->get(); |
@@ -218,12 +221,10 @@ discard block |
||
| 218 | 221 | |
| 219 | 222 | $max_level = $this->getInfoUpgradeBatiment(); |
| 220 | 223 | $niveau_batiment_base = 10; |
| 221 | - } |
|
| 222 | - else { |
|
| 224 | + } else { |
|
| 223 | 225 | $max_level = 0; |
| 224 | 226 | } |
| 225 | - } |
|
| 226 | - else { |
|
| 227 | + } else { |
|
| 227 | 228 | $max_level = 0; |
| 228 | 229 | } |
| 229 | 230 | } |
@@ -277,8 +278,7 @@ discard block |
||
| 277 | 278 | |
| 278 | 279 | if ($this->date_fin_construction-$today <= 0) { |
| 279 | 280 | $this->setTerminerConstruction($id_batiment); |
| 280 | - } |
|
| 281 | - else { |
|
| 281 | + } else { |
|
| 282 | 282 | Bataille::setValues([ |
| 283 | 283 | "date_fin_construction" => $this->date_fin_construction-$today, |
| 284 | 284 | "nom_batiment_construction" => $this->nom_batiment_construction |
@@ -341,8 +341,7 @@ discard block |
||
| 341 | 341 | foreach ($query as $obj) { |
| 342 | 342 | if ($obj->pour_construire != null) { |
| 343 | 343 | $pour_construire = unserialize($obj->pour_construire); |
| 344 | - } |
|
| 345 | - else { |
|
| 344 | + } else { |
|
| 346 | 345 | $pour_construire = []; |
| 347 | 346 | } |
| 348 | 347 | |
@@ -365,21 +364,18 @@ discard block |
||
| 365 | 364 | ]; |
| 366 | 365 | } |
| 367 | 366 | } |
| 368 | - } |
|
| 369 | - else if (count($pour_construire) > 1) { |
|
| 367 | + } else if (count($pour_construire) > 1) { |
|
| 370 | 368 | $ok_construction = false; |
| 371 | 369 | //test si tous les batiments sont construits et on le niveau nécéssaire |
| 372 | 370 | for ($j=0 ; $j<count($pour_construire) ; $j++) { |
| 373 | 371 | if (in_array($pour_construire[$j][1], $batiment_construit)) { |
| 374 | 372 | if ($pour_construire[$j][2] <= $this->getNiveauBatiment($pour_construire[$j][1])) { |
| 375 | 373 | $ok_construction = true; |
| 376 | - } |
|
| 377 | - else { |
|
| 374 | + } else { |
|
| 378 | 375 | $ok_construction = false; |
| 379 | 376 | break; |
| 380 | 377 | } |
| 381 | - } |
|
| 382 | - else { |
|
| 378 | + } else { |
|
| 383 | 379 | $ok_construction = false; |
| 384 | 380 | break; |
| 385 | 381 | } |
@@ -396,8 +392,7 @@ discard block |
||
| 396 | 392 | "temps_construction" => $temps_construction |
| 397 | 393 | ]; |
| 398 | 394 | } |
| 399 | - } |
|
| 400 | - else { |
|
| 395 | + } else { |
|
| 401 | 396 | $ressource = $this->getRessourceConstruireBatiment($all_batiment[$i], 0); |
| 402 | 397 | |
| 403 | 398 | $batiment_construire[] = [ |
@@ -507,8 +502,7 @@ discard block |
||
| 507 | 502 | $this->info_batiment_next = $xml->$nom_batiment_sql->phrase_suivant.$obj->$champ; |
| 508 | 503 | } |
| 509 | 504 | } |
| 510 | - } |
|
| 511 | - else { |
|
| 505 | + } else { |
|
| 512 | 506 | $this->info_batiment = ""; |
| 513 | 507 | $this->info_batiment_next = ""; |
| 514 | 508 | } |
@@ -553,8 +547,7 @@ discard block |
||
| 553 | 547 | $ressource = $this->getRessourceConstruireBatiment($nom_batiment_sql, 0); |
| 554 | 548 | $this->nom_batiment_sql = $nom_batiment_sql; |
| 555 | 549 | $this->niveau_batiment = 0; |
| 556 | - } |
|
| 557 | - else { |
|
| 550 | + } else { |
|
| 558 | 551 | //si c'est le lvl 0 de l'addon |
| 559 | 552 | if ($this->niveau_batiment == 0) { |
| 560 | 553 | $un_batiment = 0; |
@@ -565,8 +558,7 @@ discard block |
||
| 565 | 558 | //si pas assez de ressource |
| 566 | 559 | if (in_array("rouge", $ressource[0])) { |
| 567 | 560 | FlashMessage::setFlash("Pas assez de ressources pour construire ce batiment"); |
| 568 | - } |
|
| 569 | - else { |
|
| 561 | + } else { |
|
| 570 | 562 | //recuperation du temps de construction |
| 571 | 563 | $query = $dbc1->select("ressource_construire") |
| 572 | 564 | ->select("temps_construction") |
@@ -591,8 +583,7 @@ discard block |
||
| 591 | 583 | ->set(); |
| 592 | 584 | |
| 593 | 585 | $this->id_batiment = $dbc->lastInsertId(); |
| 594 | - } |
|
| 595 | - else { |
|
| 586 | + } else { |
|
| 596 | 587 | $dbc->update("niveau", $this->niveau_batiment+1) |
| 597 | 588 | ->update("construction", 1) |
| 598 | 589 | ->from("_bataille_batiment") |
@@ -619,8 +610,7 @@ discard block |
||
| 619 | 610 | //on retire les ressources de la base |
| 620 | 611 | Bataille::getRessource()->setUpdateRessource($ressource_construction[2], $ressource_construction[3], $ressource_construction[0], $ressource_construction[1], 0, "-"); |
| 621 | 612 | } |
| 622 | - } |
|
| 623 | - else { |
|
| 613 | + } else { |
|
| 624 | 614 | FlashMessage::setFlash("Un batiment est déjà en construction, vous ne pouvez pas en construire un autre !"); |
| 625 | 615 | } |
| 626 | 616 | } |