@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | public function getRessourceConstruire() { |
47 | 47 | return $this->ressource_construire; |
48 | 48 | } |
49 | - public function getInfoBatiment(){ |
|
49 | + public function getInfoBatiment() { |
|
50 | 50 | return $this->info_batiment; |
51 | 51 | } |
52 | - public function getInfoBatimentNext(){ |
|
52 | + public function getInfoBatimentNext() { |
|
53 | 53 | return $this->info_batiment_next; |
54 | 54 | } |
55 | 55 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | if ((is_array($query)) && (count($query) > 0)) { |
82 | 82 | foreach ($query as $obj) { |
83 | 83 | if ($obj->construction == 1) { |
84 | - return $obj->niveau-1; |
|
84 | + return $obj->niveau - 1; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | return $obj->niveau; |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | if ($niveau > 0) { |
150 | 150 | $query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $niveau)->get(); |
151 | 151 | |
152 | - if ((is_array($query)) && (count($query) > 0)){ |
|
152 | + if ((is_array($query)) && (count($query) > 0)) { |
|
153 | 153 | foreach ($query as $obj) { |
154 | 154 | return $obj->stockage; |
155 | 155 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | $this->niveau_batiment = $this->niveau_batiment + 1; |
191 | 191 | } |
192 | 192 | $niveau_batiment_base = $this->niveau_batiment; |
193 | - $max_level = $this->getInfoUpgradeBatiment(); |
|
193 | + $max_level = $this->getInfoUpgradeBatiment(); |
|
194 | 194 | } |
195 | 195 | else { |
196 | 196 | //on test voir si le bat est au niveau max et si il peut avoir un addon |
@@ -264,12 +264,12 @@ discard block |
||
264 | 264 | $id_batiment = $obj->ID_batiment; |
265 | 265 | } |
266 | 266 | |
267 | - if ($this->date_fin_construction-$today <= 0) { |
|
267 | + if ($this->date_fin_construction - $today <= 0) { |
|
268 | 268 | $this->setTerminerConstruction($id_batiment); |
269 | 269 | } |
270 | 270 | else { |
271 | 271 | Bataille::setValues([ |
272 | - "date_fin_construction" => $this->date_fin_construction-$today, |
|
272 | + "date_fin_construction" => $this->date_fin_construction - $today, |
|
273 | 273 | "nom_batiment_construction" => $this->nom_batiment_construction |
274 | 274 | ]); |
275 | 275 | } |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | //et compare la liste des batiments qu'il faut pour construire le batiment |
319 | 319 | //a ceux qui sont deja construit dans la base |
320 | 320 | //si tous les batments qu'il faut son batis on autorise la construction du batiment |
321 | - for ($i=0 ; $i<$c_all_batiment ; $i++) { |
|
321 | + for ($i = 0; $i < $c_all_batiment; $i++) { |
|
322 | 322 | if (!in_array($all_batiment[$i], $batiment_construit)) { |
323 | 323 | $query = $dbc1->select("pour_construire") |
324 | 324 | ->select("temps_construction") |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | else if (count($pour_construire) > 1) { |
359 | 359 | $ok_construction = false; |
360 | 360 | //test si tous les batiments sont construits et on le niveau nécéssaire |
361 | - for ($j=0 ; $j<count($pour_construire) ; $j++) { |
|
361 | + for ($j = 0; $j < count($pour_construire); $j++) { |
|
362 | 362 | if (in_array($pour_construire[$j][1], $batiment_construit)) { |
363 | 363 | if ($pour_construire[$j][2] <= $this->getNiveauBatiment($pour_construire[$j][1])) { |
364 | 364 | $ok_construction = true; |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | private function getRessourceConstruireBatiment($nom_batiment_sql, $niveau) { |
403 | 403 | $dbc1 = Bataille::getDb(); |
404 | 404 | |
405 | - $niveau = $niveau+1; |
|
405 | + $niveau = $niveau + 1; |
|
406 | 406 | |
407 | 407 | $query = $dbc1->select("ressource_construire")->from($nom_batiment_sql)->where("ID_".$nom_batiment_sql, "=", $niveau)->get(); |
408 | 408 | |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | */ |
436 | 436 | private function getTestBatimentConstruction($nom_batiment) { |
437 | 437 | if (ChaineCaractere::FindInString($nom_batiment, " en construction") == true) { |
438 | - return [substr($nom_batiment, 0, (0-strlen(" en construction"))), true]; |
|
438 | + return [substr($nom_batiment, 0, (0 - strlen(" en construction"))), true]; |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | return [$nom_batiment, false]; |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | $dbc1 = Bataille::getDb(); |
451 | 451 | |
452 | 452 | //récupération du temps et des ressources pour construire |
453 | - $query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1)->get(); |
|
453 | + $query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1)->get(); |
|
454 | 454 | |
455 | 455 | //si on a quelque chose cela veut dire qu'on est pas encore au lvl max du batiment |
456 | 456 | if ((is_array($query)) && (count($query) > 0)) { |
@@ -463,17 +463,17 @@ discard block |
||
463 | 463 | if ($this->nom_batiment_sql == "entrepot") { |
464 | 464 | $query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $this->niveau_batiment)->get(); |
465 | 465 | |
466 | - if ((is_array($query)) && (count($query) > 0)){ |
|
466 | + if ((is_array($query)) && (count($query) > 0)) { |
|
467 | 467 | foreach ($query as $obj) { |
468 | - $this->info_batiment = "Capacité de l'entrepôt : ". $obj->stockage; |
|
468 | + $this->info_batiment = "Capacité de l'entrepôt : ".$obj->stockage; |
|
469 | 469 | } |
470 | 470 | } |
471 | 471 | |
472 | - $query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $this->niveau_batiment+1)->get(); |
|
472 | + $query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $this->niveau_batiment + 1)->get(); |
|
473 | 473 | |
474 | - if ((is_array($query)) && (count($query) > 0)){ |
|
474 | + if ((is_array($query)) && (count($query) > 0)) { |
|
475 | 475 | foreach ($query as $obj) { |
476 | - $this->info_batiment_next = "Capacité de l'entrepôt au prochain niveau : ". $obj->stockage; |
|
476 | + $this->info_batiment_next = "Capacité de l'entrepôt au prochain niveau : ".$obj->stockage; |
|
477 | 477 | } |
478 | 478 | } |
479 | 479 | } |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | $query = $dbc1->select("ressource_construire") |
536 | 536 | ->select("temps_construction") |
537 | 537 | ->from($this->nom_batiment_sql) |
538 | - ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1) |
|
538 | + ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1) |
|
539 | 539 | ->get(); |
540 | 540 | |
541 | 541 | foreach ($query as $obj) { |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | |
546 | 546 | //on insere la construction dans la table batiment si new batiment |
547 | 547 | if ($un_batiment == 0) { |
548 | - $dbc->insert("niveau", $this->niveau_batiment+1) |
|
548 | + $dbc->insert("niveau", $this->niveau_batiment + 1) |
|
549 | 549 | ->insert("emplacement", $emplacement) |
550 | 550 | ->insert("nom_batiment", $nom_batiment) |
551 | 551 | ->insert("nom_batiment_sql", $this->nom_batiment_sql) |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | $this->id_batiment = $dbc->lastInsertId(); |
558 | 558 | } |
559 | 559 | else { |
560 | - $dbc->update("niveau", $this->niveau_batiment+1) |
|
560 | + $dbc->update("niveau", $this->niveau_batiment + 1) |
|
561 | 561 | ->update("construction", 1) |
562 | 562 | ->from("_bataille_batiment") |
563 | 563 | ->where("ID_batiment", "=", $this->id_batiment, "AND") |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | $today = $today->getTimestamp(); |
573 | 573 | |
574 | 574 | //date de la fin de la construction en seconde |
575 | - $fin_construction = $today+$temps_construction; |
|
575 | + $fin_construction = $today + $temps_construction; |
|
576 | 576 | |
577 | 577 | $dbc->insert("date_fin", $fin_construction) |
578 | 578 | ->insert("emplacement_construction", $emplacement) |