@@ -82,8 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | return $obj->niveau; |
| 84 | 84 | } |
| 85 | - } |
|
| 86 | - else { |
|
| 85 | + } else { |
|
| 87 | 86 | return 0; |
| 88 | 87 | } |
| 89 | 88 | } |
@@ -96,10 +95,18 @@ discard block |
||
| 96 | 95 | public function getProduction($ressource) { |
| 97 | 96 | $dbc1 = Bataille::getDb(); |
| 98 | 97 | |
| 99 | - if ($ressource == "eau") $nom_batiment = "centrale_eau"; |
|
| 100 | - if ($ressource == "electricite") $nom_batiment = "centrale_electrique"; |
|
| 101 | - if ($ressource == "fuel") $nom_batiment = "station_pompage_fuel"; |
|
| 102 | - if ($ressource == "fer") $nom_batiment = "station_forage"; |
|
| 98 | + if ($ressource == "eau") { |
|
| 99 | + $nom_batiment = "centrale_eau"; |
|
| 100 | + } |
|
| 101 | + if ($ressource == "electricite") { |
|
| 102 | + $nom_batiment = "centrale_electrique"; |
|
| 103 | + } |
|
| 104 | + if ($ressource == "fuel") { |
|
| 105 | + $nom_batiment = "station_pompage_fuel"; |
|
| 106 | + } |
|
| 107 | + if ($ressource == "fer") { |
|
| 108 | + $nom_batiment = "station_forage"; |
|
| 109 | + } |
|
| 103 | 110 | |
| 104 | 111 | $niveau = $this->getNiveauBatiment($nom_batiment); |
| 105 | 112 | |
@@ -120,15 +127,13 @@ discard block |
||
| 120 | 127 | foreach ($query as $obj) { |
| 121 | 128 | $prod_addon = $obj->production; |
| 122 | 129 | } |
| 123 | - } |
|
| 124 | - else { |
|
| 130 | + } else { |
|
| 125 | 131 | $prod_addon = 0; |
| 126 | 132 | } |
| 127 | 133 | |
| 128 | 134 | return $prod + $prod_addon; |
| 129 | 135 | } |
| 130 | - } |
|
| 131 | - else { |
|
| 136 | + } else { |
|
| 132 | 137 | return 20; |
| 133 | 138 | } |
| 134 | 139 | } |
@@ -150,8 +155,7 @@ discard block |
||
| 150 | 155 | return $obj->stockage; |
| 151 | 156 | } |
| 152 | 157 | } |
| 153 | - } |
|
| 154 | - else { |
|
| 158 | + } else { |
|
| 155 | 159 | return 1000; |
| 156 | 160 | } |
| 157 | 161 | } |
@@ -236,8 +240,7 @@ discard block |
||
| 236 | 240 | $this->niveau_batiment = $this->niveau_batiment + 1; |
| 237 | 241 | } |
| 238 | 242 | $max_level = $this->getInfoUpgradeBatiment(); |
| 239 | - } |
|
| 240 | - else { |
|
| 243 | + } else { |
|
| 241 | 244 | //on test voir si le bat est au niveau max et si il peut avoir un addon |
| 242 | 245 | if (ChaineCaractere::FindInString($nom_batiment, "addon")) { |
| 243 | 246 | $query = $dbc1->select("nom_table")->from("liste_batiment")->where("nom", "=", $nom_batiment)->get(); |
@@ -250,12 +253,10 @@ discard block |
||
| 250 | 253 | $this->niveau_batiment = 0; |
| 251 | 254 | |
| 252 | 255 | $max_level = $this->getInfoUpgradeBatiment(); |
| 253 | - } |
|
| 254 | - else { |
|
| 256 | + } else { |
|
| 255 | 257 | $max_level = 0; |
| 256 | 258 | } |
| 257 | - } |
|
| 258 | - else { |
|
| 259 | + } else { |
|
| 259 | 260 | $max_level = 0; |
| 260 | 261 | } |
| 261 | 262 | } |
@@ -309,8 +310,7 @@ discard block |
||
| 309 | 310 | |
| 310 | 311 | if ($this->date_fin_construction-$today <= 0) { |
| 311 | 312 | $this->setTerminerConstruction($id_batiment); |
| 312 | - } |
|
| 313 | - else { |
|
| 313 | + } else { |
|
| 314 | 314 | Bataille::setValues([ |
| 315 | 315 | "date_fin_construction" => $this->date_fin_construction-$today, |
| 316 | 316 | "nom_batiment_construction" => $this->nom_batiment_construction |
@@ -373,8 +373,7 @@ discard block |
||
| 373 | 373 | foreach ($query as $obj) { |
| 374 | 374 | if ($obj->pour_construire != null) { |
| 375 | 375 | $pour_construire = unserialize($obj->pour_construire); |
| 376 | - } |
|
| 377 | - else { |
|
| 376 | + } else { |
|
| 378 | 377 | $pour_construire = []; |
| 379 | 378 | } |
| 380 | 379 | |
@@ -397,11 +396,9 @@ discard block |
||
| 397 | 396 | ]; |
| 398 | 397 | } |
| 399 | 398 | } |
| 400 | - } |
|
| 401 | - else if (count($pour_construire) > 1) { |
|
| 399 | + } else if (count($pour_construire) > 1) { |
|
| 402 | 400 | //TODO si besoin de plus d'un seul batiment pour etre construit |
| 403 | - } |
|
| 404 | - else { |
|
| 401 | + } else { |
|
| 405 | 402 | $ressource = $this->getRessourceConstruireBatiment($all_batiment[$i], 0); |
| 406 | 403 | |
| 407 | 404 | $batiment_construire[] = [ |
@@ -531,8 +528,7 @@ discard block |
||
| 531 | 528 | $ressource = $this->getRessourceConstruireBatiment($nom_batiment_sql, 0); |
| 532 | 529 | $this->nom_batiment_sql = $nom_batiment_sql; |
| 533 | 530 | $this->niveau_batiment = 0; |
| 534 | - } |
|
| 535 | - else { |
|
| 531 | + } else { |
|
| 536 | 532 | //si c'est le lvl 0 de l'addon |
| 537 | 533 | if ($this->niveau_batiment == 0) { |
| 538 | 534 | $un_batiment = 0; |
@@ -543,8 +539,7 @@ discard block |
||
| 543 | 539 | //si pas assez de ressource |
| 544 | 540 | if (in_array("rouge", $ressource[0])) { |
| 545 | 541 | FlashMessage::setFlash("Pas assez de ressources pour construire ce batiment"); |
| 546 | - } |
|
| 547 | - else { |
|
| 542 | + } else { |
|
| 548 | 543 | //recuperation du temps de construction |
| 549 | 544 | $query = $dbc1->select("ressource_construire") |
| 550 | 545 | ->select("temps_construction") |
@@ -569,8 +564,7 @@ discard block |
||
| 569 | 564 | ->set(); |
| 570 | 565 | |
| 571 | 566 | $this->id_batiment = $dbc->lastInsertId(); |
| 572 | - } |
|
| 573 | - else { |
|
| 567 | + } else { |
|
| 574 | 568 | $dbc->update("niveau", $this->niveau_batiment+1) |
| 575 | 569 | ->update("construction", 1) |
| 576 | 570 | ->from("_bataille_batiment") |
@@ -598,8 +592,7 @@ discard block |
||
| 598 | 592 | //on retire les ressources de la base |
| 599 | 593 | Bataille::getRessource()->setRetirerRessource($ressource_construction[2], $ressource_construction[3], $ressource_construction[0], $ressource_construction[1]); |
| 600 | 594 | } |
| 601 | - } |
|
| 602 | - else { |
|
| 595 | + } else { |
|
| 603 | 596 | FlashMessage::setFlash("Un batiment est déjà en construction, vous ne pouvez pas en construire un autre !"); |
| 604 | 597 | } |
| 605 | 598 | } |