@@ -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") |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | private function getRessourceConstruireBatiment($nom_batiment_sql, $niveau) { |
383 | 383 | $dbc1 = Bataille::getDb(); |
384 | 384 | |
385 | - $niveau = $niveau+1; |
|
385 | + $niveau = $niveau + 1; |
|
386 | 386 | |
387 | 387 | $query = $dbc1->select("ressource_construire")->from($nom_batiment_sql)->where("ID_".$nom_batiment_sql, "=", $niveau)->get(); |
388 | 388 | |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | */ |
416 | 416 | private function getTestBatimentConstruction($nom_batiment) { |
417 | 417 | if (ChaineCaractere::FindInString($nom_batiment, " en construction") == true) { |
418 | - return [substr($nom_batiment, 0, (0-strlen(" en construction"))), true]; |
|
418 | + return [substr($nom_batiment, 0, (0 - strlen(" en construction"))), true]; |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | return [$nom_batiment, false]; |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | $dbc1 = Bataille::getDb(); |
431 | 431 | |
432 | 432 | //récupération du temps et des ressources pour construire |
433 | - $query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1)->get(); |
|
433 | + $query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1)->get(); |
|
434 | 434 | |
435 | 435 | //si on a quelque chose cela veut dire qu'on est pas encore au lvl max du batiment |
436 | 436 | if ((is_array($query)) && (count($query) > 0)) { |
@@ -443,17 +443,17 @@ discard block |
||
443 | 443 | if ($this->nom_batiment_sql == "entrepot") { |
444 | 444 | $query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $this->niveau_batiment)->get(); |
445 | 445 | |
446 | - if ((is_array($query)) && (count($query) > 0)){ |
|
446 | + if ((is_array($query)) && (count($query) > 0)) { |
|
447 | 447 | foreach ($query as $obj) { |
448 | - $this->info_batiment = "Capacité de l'entrepôt : ". $obj->stockage; |
|
448 | + $this->info_batiment = "Capacité de l'entrepôt : ".$obj->stockage; |
|
449 | 449 | } |
450 | 450 | } |
451 | 451 | |
452 | - $query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $this->niveau_batiment+1)->get(); |
|
452 | + $query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $this->niveau_batiment + 1)->get(); |
|
453 | 453 | |
454 | - if ((is_array($query)) && (count($query) > 0)){ |
|
454 | + if ((is_array($query)) && (count($query) > 0)) { |
|
455 | 455 | foreach ($query as $obj) { |
456 | - $this->info_batiment_next = "Capacité de l'entrepôt au prochain niveau : ". $obj->stockage; |
|
456 | + $this->info_batiment_next = "Capacité de l'entrepôt au prochain niveau : ".$obj->stockage; |
|
457 | 457 | } |
458 | 458 | } |
459 | 459 | } |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | $query = $dbc1->select("ressource_construire") |
516 | 516 | ->select("temps_construction") |
517 | 517 | ->from($this->nom_batiment_sql) |
518 | - ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1) |
|
518 | + ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1) |
|
519 | 519 | ->get(); |
520 | 520 | |
521 | 521 | foreach ($query as $obj) { |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | |
526 | 526 | //on insere la construction dans la table batiment si new batiment |
527 | 527 | if ($un_batiment == 0) { |
528 | - $dbc->insert("niveau", $this->niveau_batiment+1) |
|
528 | + $dbc->insert("niveau", $this->niveau_batiment + 1) |
|
529 | 529 | ->insert("emplacement", $emplacement) |
530 | 530 | ->insert("nom_batiment", $nom_batiment) |
531 | 531 | ->insert("nom_batiment_sql", $this->nom_batiment_sql) |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | $this->id_batiment = $dbc->lastInsertId(); |
538 | 538 | } |
539 | 539 | else { |
540 | - $dbc->update("niveau", $this->niveau_batiment+1) |
|
540 | + $dbc->update("niveau", $this->niveau_batiment + 1) |
|
541 | 541 | ->update("construction", 1) |
542 | 542 | ->from("_bataille_batiment") |
543 | 543 | ->where("ID_batiment", "=", $this->id_batiment, "AND") |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | $today = $today->getTimestamp(); |
553 | 553 | |
554 | 554 | //date de la fin de la construction en seconde |
555 | - $fin_construction = $today+$temps_construction; |
|
555 | + $fin_construction = $today + $temps_construction; |
|
556 | 556 | |
557 | 557 | $dbc->insert("date_fin", $fin_construction) |
558 | 558 | ->insert("emplacement_construction", $emplacement) |