@@ -91,8 +91,7 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | return $obj->niveau; |
| 93 | 93 | } |
| 94 | - } |
|
| 95 | - else { |
|
| 94 | + } else { |
|
| 96 | 95 | return 0; |
| 97 | 96 | } |
| 98 | 97 | } |
@@ -109,10 +108,18 @@ discard block |
||
| 109 | 108 | $id_base = Bataille::getIdBase(); |
| 110 | 109 | } |
| 111 | 110 | |
| 112 | - if ($ressource == "eau") $nom_batiment = "centrale_eau"; |
|
| 113 | - if ($ressource == "electricite") $nom_batiment = "centrale_electrique"; |
|
| 114 | - if ($ressource == "fuel") $nom_batiment = "station_pompage_fuel"; |
|
| 115 | - if ($ressource == "fer") $nom_batiment = "station_forage"; |
|
| 111 | + if ($ressource == "eau") { |
|
| 112 | + $nom_batiment = "centrale_eau"; |
|
| 113 | + } |
|
| 114 | + if ($ressource == "electricite") { |
|
| 115 | + $nom_batiment = "centrale_electrique"; |
|
| 116 | + } |
|
| 117 | + if ($ressource == "fuel") { |
|
| 118 | + $nom_batiment = "station_pompage_fuel"; |
|
| 119 | + } |
|
| 120 | + if ($ressource == "fer") { |
|
| 121 | + $nom_batiment = "station_forage"; |
|
| 122 | + } |
|
| 116 | 123 | |
| 117 | 124 | $niveau = $this->getNiveauBatiment($nom_batiment, $id_base); |
| 118 | 125 | |
@@ -126,8 +133,7 @@ discard block |
||
| 126 | 133 | |
| 127 | 134 | return $prod; |
| 128 | 135 | } |
| 129 | - } |
|
| 130 | - else { |
|
| 136 | + } else { |
|
| 131 | 137 | return 20; |
| 132 | 138 | } |
| 133 | 139 | } |
@@ -153,8 +159,7 @@ discard block |
||
| 153 | 159 | return $obj->stockage; |
| 154 | 160 | } |
| 155 | 161 | } |
| 156 | - } |
|
| 157 | - else { |
|
| 162 | + } else { |
|
| 158 | 163 | return 1000; |
| 159 | 164 | } |
| 160 | 165 | } |
@@ -190,8 +195,7 @@ discard block |
||
| 190 | 195 | } |
| 191 | 196 | $niveau_batiment_base = $this->niveau_batiment; |
| 192 | 197 | $max_level = $this->getInfoUpgradeBatiment(); |
| 193 | - } |
|
| 194 | - else { |
|
| 198 | + } else { |
|
| 195 | 199 | $max_level = 0; |
| 196 | 200 | } |
| 197 | 201 | |
@@ -244,8 +248,7 @@ discard block |
||
| 244 | 248 | |
| 245 | 249 | if ($this->date_fin_construction-$today <= 0) { |
| 246 | 250 | $this->setTerminerConstruction($id_batiment); |
| 247 | - } |
|
| 248 | - else { |
|
| 251 | + } else { |
|
| 249 | 252 | Bataille::setValues([ |
| 250 | 253 | "date_fin_construction" => $this->date_fin_construction-$today, |
| 251 | 254 | "nom_batiment_construction" => $this->nom_batiment_construction |
@@ -308,8 +311,7 @@ discard block |
||
| 308 | 311 | foreach ($query as $obj) { |
| 309 | 312 | if ($obj->pour_construire != null) { |
| 310 | 313 | $pour_construire = unserialize($obj->pour_construire); |
| 311 | - } |
|
| 312 | - else { |
|
| 314 | + } else { |
|
| 313 | 315 | $pour_construire = []; |
| 314 | 316 | } |
| 315 | 317 | |
@@ -332,21 +334,18 @@ discard block |
||
| 332 | 334 | ]; |
| 333 | 335 | } |
| 334 | 336 | } |
| 335 | - } |
|
| 336 | - else if (count($pour_construire) > 1) { |
|
| 337 | + } else if (count($pour_construire) > 1) { |
|
| 337 | 338 | $ok_construction = false; |
| 338 | 339 | //test si tous les batiments sont construits et on le niveau nécéssaire |
| 339 | 340 | for ($j=0 ; $j<count($pour_construire) ; $j++) { |
| 340 | 341 | if (in_array($pour_construire[$j][1], $batiment_construit)) { |
| 341 | 342 | if ($pour_construire[$j][2] <= $this->getNiveauBatiment($pour_construire[$j][1])) { |
| 342 | 343 | $ok_construction = true; |
| 343 | - } |
|
| 344 | - else { |
|
| 344 | + } else { |
|
| 345 | 345 | $ok_construction = false; |
| 346 | 346 | break; |
| 347 | 347 | } |
| 348 | - } |
|
| 349 | - else { |
|
| 348 | + } else { |
|
| 350 | 349 | $ok_construction = false; |
| 351 | 350 | break; |
| 352 | 351 | } |
@@ -363,8 +362,7 @@ discard block |
||
| 363 | 362 | "temps_construction" => $temps_construction |
| 364 | 363 | ]; |
| 365 | 364 | } |
| 366 | - } |
|
| 367 | - else { |
|
| 365 | + } else { |
|
| 368 | 366 | $ressource = $this->getRessourceConstruireBatiment($all_batiment[$i], 0); |
| 369 | 367 | |
| 370 | 368 | $batiment_construire[] = [ |
@@ -473,8 +471,7 @@ discard block |
||
| 473 | 471 | $this->info_batiment_next = $xml->$nom_batiment_sql->phrase_suivant.$obj->$champ; |
| 474 | 472 | } |
| 475 | 473 | } |
| 476 | - } |
|
| 477 | - else { |
|
| 474 | + } else { |
|
| 478 | 475 | $this->info_batiment = ""; |
| 479 | 476 | $this->info_batiment_next = ""; |
| 480 | 477 | } |
@@ -519,8 +516,7 @@ discard block |
||
| 519 | 516 | $ressource = $this->getRessourceConstruireBatiment($nom_batiment_sql, 0); |
| 520 | 517 | $this->nom_batiment_sql = $nom_batiment_sql; |
| 521 | 518 | $this->niveau_batiment = 0; |
| 522 | - } |
|
| 523 | - else { |
|
| 519 | + } else { |
|
| 524 | 520 | //si c'est le lvl 0 de l'addon |
| 525 | 521 | if ($this->niveau_batiment == 0) { |
| 526 | 522 | $un_batiment = 0; |
@@ -531,8 +527,7 @@ discard block |
||
| 531 | 527 | //si pas assez de ressource |
| 532 | 528 | if (in_array("rouge", $ressource[0])) { |
| 533 | 529 | FlashMessage::setFlash("Pas assez de ressources pour construire ce batiment"); |
| 534 | - } |
|
| 535 | - else { |
|
| 530 | + } else { |
|
| 536 | 531 | //recuperation du temps de construction |
| 537 | 532 | $query = $dbc1->select("ressource_construire") |
| 538 | 533 | ->select("temps_construction") |
@@ -557,8 +552,7 @@ discard block |
||
| 557 | 552 | ->set(); |
| 558 | 553 | |
| 559 | 554 | $this->id_batiment = $dbc->lastInsertId(); |
| 560 | - } |
|
| 561 | - else { |
|
| 555 | + } else { |
|
| 562 | 556 | $dbc->update("niveau", $this->niveau_batiment+1) |
| 563 | 557 | ->update("construction", 1) |
| 564 | 558 | ->from("_bataille_batiment") |
@@ -585,8 +579,7 @@ discard block |
||
| 585 | 579 | //on retire les ressources de la base |
| 586 | 580 | Bataille::getRessource()->setUpdateRessource($ressource_construction[2], $ressource_construction[3], $ressource_construction[0], $ressource_construction[1], 0, "-"); |
| 587 | 581 | } |
| 588 | - } |
|
| 589 | - else { |
|
| 582 | + } else { |
|
| 590 | 583 | FlashMessage::setFlash("Un batiment est déjà en construction, vous ne pouvez pas en construire un autre !"); |
| 591 | 584 | } |
| 592 | 585 | } |