@@ -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,8 +364,7 @@ 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++) { |
@@ -374,8 +372,7 @@ discard block |
||
| 374 | 372 | if ($pour_construire[$j][2] <= $this->getNiveauBatiment($pour_construire[$j][1])) { |
| 375 | 373 | $ok_construction = true; |
| 376 | 374 | } |
| 377 | - } |
|
| 378 | - else { |
|
| 375 | + } else { |
|
| 379 | 376 | $ok_construction = false; |
| 380 | 377 | break; |
| 381 | 378 | } |
@@ -392,8 +389,7 @@ discard block |
||
| 392 | 389 | "temps_construction" => $temps_construction |
| 393 | 390 | ]; |
| 394 | 391 | } |
| 395 | - } |
|
| 396 | - else { |
|
| 392 | + } else { |
|
| 397 | 393 | $ressource = $this->getRessourceConstruireBatiment($all_batiment[$i], 0); |
| 398 | 394 | |
| 399 | 395 | $batiment_construire[] = [ |
@@ -503,8 +499,7 @@ discard block |
||
| 503 | 499 | $this->info_batiment_next = $xml->$nom_batiment_sql->phrase_suivant.$obj->$champ; |
| 504 | 500 | } |
| 505 | 501 | } |
| 506 | - } |
|
| 507 | - else { |
|
| 502 | + } else { |
|
| 508 | 503 | $this->info_batiment = ""; |
| 509 | 504 | $this->info_batiment_next = ""; |
| 510 | 505 | } |
@@ -549,8 +544,7 @@ discard block |
||
| 549 | 544 | $ressource = $this->getRessourceConstruireBatiment($nom_batiment_sql, 0); |
| 550 | 545 | $this->nom_batiment_sql = $nom_batiment_sql; |
| 551 | 546 | $this->niveau_batiment = 0; |
| 552 | - } |
|
| 553 | - else { |
|
| 547 | + } else { |
|
| 554 | 548 | //si c'est le lvl 0 de l'addon |
| 555 | 549 | if ($this->niveau_batiment == 0) { |
| 556 | 550 | $un_batiment = 0; |
@@ -561,8 +555,7 @@ discard block |
||
| 561 | 555 | //si pas assez de ressource |
| 562 | 556 | if (in_array("rouge", $ressource[0])) { |
| 563 | 557 | FlashMessage::setFlash("Pas assez de ressources pour construire ce batiment"); |
| 564 | - } |
|
| 565 | - else { |
|
| 558 | + } else { |
|
| 566 | 559 | //recuperation du temps de construction |
| 567 | 560 | $query = $dbc1->select("ressource_construire") |
| 568 | 561 | ->select("temps_construction") |
@@ -587,8 +580,7 @@ discard block |
||
| 587 | 580 | ->set(); |
| 588 | 581 | |
| 589 | 582 | $this->id_batiment = $dbc->lastInsertId(); |
| 590 | - } |
|
| 591 | - else { |
|
| 583 | + } else { |
|
| 592 | 584 | $dbc->update("niveau", $this->niveau_batiment+1) |
| 593 | 585 | ->update("construction", 1) |
| 594 | 586 | ->from("_bataille_batiment") |
@@ -615,8 +607,7 @@ discard block |
||
| 615 | 607 | //on retire les ressources de la base |
| 616 | 608 | Bataille::getRessource()->setUpdateRessource($ressource_construction[2], $ressource_construction[3], $ressource_construction[0], $ressource_construction[1], 0, "-"); |
| 617 | 609 | } |
| 618 | - } |
|
| 619 | - else { |
|
| 610 | + } else { |
|
| 620 | 611 | FlashMessage::setFlash("Un batiment est déjà en construction, vous ne pouvez pas en construire un autre !"); |
| 621 | 612 | } |
| 622 | 613 | } |