@@ -49,7 +49,7 @@ |
||
| 49 | 49 | //-------------------------- SETTER ----------------------------------------------------------------------------// |
| 50 | 50 | /** |
| 51 | 51 | * @param $id_base |
| 52 | - * @param $type |
|
| 52 | + * @param string $type |
|
| 53 | 53 | * fonction qui ajoute des points à la base en fonction du type |
| 54 | 54 | * le type peut etre : batiment, attaque, defense, troupe |
| 55 | 55 | */ |
@@ -41,7 +41,9 @@ |
||
| 41 | 41 | |
| 42 | 42 | $query = $dbc->select("points_batiment")->from("configuration")->where("ID_configuration", "=", 1)->get(); |
| 43 | 43 | |
| 44 | - foreach ($query as $obj) return $obj->points_batiment; |
|
| 44 | + foreach ($query as $obj) { |
|
| 45 | + return $obj->points_batiment; |
|
| 46 | + } |
|
| 45 | 47 | } |
| 46 | 48 | //-------------------------- END GETTER ----------------------------------------------------------------------------// |
| 47 | 49 | |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | $dbc = App::getDb(); |
| 58 | 58 | |
| 59 | 59 | if ($type == "batiment") { |
| 60 | - $points = self::getPointsBase($id_base)+self::getPointAjoutBatiment(); |
|
| 60 | + $points = self::getPointsBase($id_base) + self::getPointAjoutBatiment(); |
|
| 61 | 61 | |
| 62 | 62 | } |
| 63 | 63 | |
@@ -119,6 +119,7 @@ |
||
| 119 | 119 | |
| 120 | 120 | /** |
| 121 | 121 | * fonction qui place le trajet en retour |
| 122 | + * @param double $date_retour |
|
| 122 | 123 | */ |
| 123 | 124 | private function setTrajetRetour($date_retour) { |
| 124 | 125 | $dbc = App::getDb(); |
@@ -88,25 +88,21 @@ discard block |
||
| 88 | 88 | //on calcul la date d'arrivée du retour |
| 89 | 89 | if ($this->id_base_dest == Bataille::getIdBase()) { |
| 90 | 90 | $date_retour = Bataille::getDureeTrajet($this->id_base)+$this->date_arrivee; |
| 91 | - } |
|
| 92 | - else { |
|
| 91 | + } else { |
|
| 93 | 92 | $date_retour = Bataille::getDureeTrajet($this->id_base_dest)+$this->date_arrivee; |
| 94 | 93 | } |
| 95 | 94 | |
| 96 | 95 | //si le retour du trajet est également arrivé on finit le transport sinon on le place sur le retour |
| 97 | 96 | if ($date_retour < $today) { |
| 98 | 97 | $this->setTerminerTransport(); |
| 99 | - } |
|
| 100 | - else { |
|
| 98 | + } else { |
|
| 101 | 99 | $this->setTrajetRetour($date_retour); |
| 102 | 100 | $this->duree_restante_trajet = $date_retour-$today; |
| 103 | 101 | $set_array = true; |
| 104 | 102 | } |
| 105 | - } |
|
| 106 | - else if (($this->aller == 0) && (($this->date_arrivee-$today) <= 0)) { |
|
| 103 | + } else if (($this->aller == 0) && (($this->date_arrivee-$today) <= 0)) { |
|
| 107 | 104 | $this->setTerminerTransport(); |
| 108 | - } |
|
| 109 | - else { |
|
| 105 | + } else { |
|
| 110 | 106 | $this->duree_restante_trajet = $this->date_arrivee-$today; |
| 111 | 107 | $set_array = true; |
| 112 | 108 | } |
@@ -119,8 +115,7 @@ discard block |
||
| 119 | 115 | "nom_base_dest" => $this->nom_base, |
| 120 | 116 | "aller" => $this->aller |
| 121 | 117 | ]; |
| 122 | - } |
|
| 123 | - else { |
|
| 118 | + } else { |
|
| 124 | 119 | $marche = [ |
| 125 | 120 | "id_marche_transport" => $this->id_marche_transport, |
| 126 | 121 | "date_arrivee" => $this->duree_restante_trajet, |
@@ -82,15 +82,15 @@ discard block |
||
| 82 | 82 | $today = Bataille::getToday(); |
| 83 | 83 | |
| 84 | 84 | //on test si déja arrivé à destination |
| 85 | - if (($this->aller == 1) && (($this->date_arrivee-$today) <= 0)) { |
|
| 85 | + if (($this->aller == 1) && (($this->date_arrivee - $today) <= 0)) { |
|
| 86 | 86 | $this->setLivrerRessource(); |
| 87 | 87 | |
| 88 | 88 | //on calcul la date d'arrivée du retour |
| 89 | 89 | if ($this->id_base_dest == Bataille::getIdBase()) { |
| 90 | - $date_retour = Bataille::getDureeTrajet($this->id_base, Bataille::getParam("vitesse_marchand"))+$this->date_arrivee; |
|
| 90 | + $date_retour = Bataille::getDureeTrajet($this->id_base, Bataille::getParam("vitesse_marchand")) + $this->date_arrivee; |
|
| 91 | 91 | } |
| 92 | 92 | else { |
| 93 | - $date_retour = Bataille::getDureeTrajet($this->id_base_dest, Bataille::getParam("vitesse_marchand"))+$this->date_arrivee; |
|
| 93 | + $date_retour = Bataille::getDureeTrajet($this->id_base_dest, Bataille::getParam("vitesse_marchand")) + $this->date_arrivee; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | //si le retour du trajet est également arrivé on finit le transport sinon on le place sur le retour |
@@ -99,15 +99,15 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | else { |
| 101 | 101 | $this->setTrajetRetour($date_retour); |
| 102 | - $this->duree_restante_trajet = $date_retour-$today; |
|
| 102 | + $this->duree_restante_trajet = $date_retour - $today; |
|
| 103 | 103 | $set_array = true; |
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | - else if (($this->aller == 0) && (($this->date_arrivee-$today) <= 0)) { |
|
| 106 | + else if (($this->aller == 0) && (($this->date_arrivee - $today) <= 0)) { |
|
| 107 | 107 | $this->setTerminerTransport(); |
| 108 | 108 | } |
| 109 | 109 | else { |
| 110 | - $this->duree_restante_trajet = $this->date_arrivee-$today; |
|
| 110 | + $this->duree_restante_trajet = $this->date_arrivee - $today; |
|
| 111 | 111 | $set_array = true; |
| 112 | 112 | } |
| 113 | 113 | |
@@ -159,11 +159,11 @@ discard block |
||
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | //on a le nombre de marchand dispo dans la base |
| 162 | - $nombre_marchand_dispo = $nombre_max_marchand-$marchand_transport; |
|
| 162 | + $nombre_marchand_dispo = $nombre_max_marchand - $marchand_transport; |
|
| 163 | 163 | |
| 164 | 164 | //on calcul savoir si on en a assez pour transport toutes les ressoures |
| 165 | 165 | //il faut 1 marchand pour 1000 ressource |
| 166 | - $nombre_marchand_trajet = ceil($all_ressource/1000); |
|
| 166 | + $nombre_marchand_trajet = ceil($all_ressource / 1000); |
|
| 167 | 167 | |
| 168 | 168 | //si on a assez de marchand on revoi true sinon false |
| 169 | 169 | if ($nombre_marchand_dispo >= $nombre_marchand_trajet) { |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | //on check si assez marchand dans la base, si pas assez on return false |
| 247 | - $nb_marchand = $this->getAssezMarchand($eau+$electricite+$fer+$fuel+$nourriture); |
|
| 247 | + $nb_marchand = $this->getAssezMarchand($eau + $electricite + $fer + $fuel + $nourriture); |
|
| 248 | 248 | |
| 249 | 249 | if ($nb_marchand === false) { |
| 250 | 250 | FlashMessage::setFlash("Vous n'avez pas assez de marchans disponibles pour effectuer ce trajet"); |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | |
| 254 | 254 | //sinon initialise le transport |
| 255 | 255 | //on recup la date d'arrivee dans la base de destintation |
| 256 | - $date_arrivee = Bataille::getDureeTrajet($id_base_dest, Bataille::getParam("vitesse_marchand"))+Bataille::getToday(); |
|
| 256 | + $date_arrivee = Bataille::getDureeTrajet($id_base_dest, Bataille::getParam("vitesse_marchand")) + Bataille::getToday(); |
|
| 257 | 257 | |
| 258 | 258 | $ressource = [ |
| 259 | 259 | "eau" => $eau, |
@@ -17,8 +17,7 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | if ($id_base === null) { |
| 19 | 19 | $this->id_base = Bataille::getIdBase(); |
| 20 | - } |
|
| 21 | - else { |
|
| 20 | + } else { |
|
| 22 | 21 | $this->id_base = $id_base; |
| 23 | 22 | } |
| 24 | 23 | |
@@ -154,8 +153,7 @@ discard block |
||
| 154 | 153 | $fer = $this->getFer()-$fer; |
| 155 | 154 | $fuel = $this->getFuel()-$fuel; |
| 156 | 155 | $nourriture = $this->getNourriture()-$nourriture; |
| 157 | - } |
|
| 158 | - else { |
|
| 156 | + } else { |
|
| 159 | 157 | $eau = $this->getEau()+$eau; |
| 160 | 158 | $electricite = $this->getElectricite()+$electricite; |
| 161 | 159 | $fer = $this->getFer()+$fer; |
@@ -164,11 +162,21 @@ discard block |
||
| 164 | 162 | |
| 165 | 163 | $stockage_max = Bataille::getBatiment()->getStockageEntrepot(); |
| 166 | 164 | |
| 167 | - if ($eau > $stockage_max) $eau = $stockage_max; |
|
| 168 | - if ($electricite > $stockage_max) $electricite = $stockage_max; |
|
| 169 | - if ($fer > $stockage_max) $fer = $stockage_max; |
|
| 170 | - if ($fuel > $stockage_max) $fuel = $stockage_max; |
|
| 171 | - if ($nourriture > $stockage_max) $nourriture = $stockage_max; |
|
| 165 | + if ($eau > $stockage_max) { |
|
| 166 | + $eau = $stockage_max; |
|
| 167 | + } |
|
| 168 | + if ($electricite > $stockage_max) { |
|
| 169 | + $electricite = $stockage_max; |
|
| 170 | + } |
|
| 171 | + if ($fer > $stockage_max) { |
|
| 172 | + $fer = $stockage_max; |
|
| 173 | + } |
|
| 174 | + if ($fuel > $stockage_max) { |
|
| 175 | + $fuel = $stockage_max; |
|
| 176 | + } |
|
| 177 | + if ($nourriture > $stockage_max) { |
|
| 178 | + $nourriture = $stockage_max; |
|
| 179 | + } |
|
| 172 | 180 | } |
| 173 | 181 | |
| 174 | 182 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $last_co = new \DateTime($last_co); |
| 98 | 98 | $last_co = $last_co->getTimestamp(); |
| 99 | 99 | |
| 100 | - $diff_temps = $today-$last_co; |
|
| 100 | + $diff_temps = $today - $last_co; |
|
| 101 | 101 | |
| 102 | 102 | //si la derniere actualisation ou connexion est supérieur à 30 sec |
| 103 | 103 | if ($diff_temps > 180) { |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | private function setAddRessource($nom_ressource, $ressrouce, $diff_temps) { |
| 118 | 118 | $dbc = App::getDb(); |
| 119 | 119 | |
| 120 | - $ressource = $ressrouce+(round((Bataille::getBatiment()->getProduction($nom_ressource, $this->id_base)/3600)*$diff_temps)); |
|
| 120 | + $ressource = $ressrouce + (round((Bataille::getBatiment()->getProduction($nom_ressource, $this->id_base) / 3600) * $diff_temps)); |
|
| 121 | 121 | $stockage_max = Bataille::getBatiment()->getStockageEntrepot($this->id_base); |
| 122 | 122 | |
| 123 | 123 | if ($ressource > $stockage_max) { |
@@ -148,18 +148,18 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | //soit on enelve ou on ajoute |
| 150 | 150 | if ($signe == "-") { |
| 151 | - $eau = $this->getEau()-$eau; |
|
| 152 | - $electricite = $this->getElectricite()-$electricite; |
|
| 153 | - $fer = $this->getFer()-$fer; |
|
| 154 | - $fuel = $this->getFuel()-$fuel; |
|
| 155 | - $nourriture = $this->getNourriture()-$nourriture; |
|
| 151 | + $eau = $this->getEau() - $eau; |
|
| 152 | + $electricite = $this->getElectricite() - $electricite; |
|
| 153 | + $fer = $this->getFer() - $fer; |
|
| 154 | + $fuel = $this->getFuel() - $fuel; |
|
| 155 | + $nourriture = $this->getNourriture() - $nourriture; |
|
| 156 | 156 | } |
| 157 | 157 | else { |
| 158 | - $eau = $this->getEau()+$eau; |
|
| 159 | - $electricite = $this->getElectricite()+$electricite; |
|
| 160 | - $fer = $this->getFer()+$fer; |
|
| 161 | - $fuel = $this->getFuel()+$fuel; |
|
| 162 | - $nourriture = $this->getNourriture()+$nourriture; |
|
| 158 | + $eau = $this->getEau() + $eau; |
|
| 159 | + $electricite = $this->getElectricite() + $electricite; |
|
| 160 | + $fer = $this->getFer() + $fer; |
|
| 161 | + $fuel = $this->getFuel() + $fuel; |
|
| 162 | + $nourriture = $this->getNourriture() + $nourriture; |
|
| 163 | 163 | |
| 164 | 164 | $stockage_max = Bataille::getBatiment()->getStockageEntrepot(); |
| 165 | 165 | |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | - $marche = new \modules\bataille\app\controller\Marche(); |
|
| 2 | + $marche = new \modules\bataille\app\controller\Marche(); |
|
| 3 | 3 | |
| 4 | 4 | $marche->setCommencerTransport($_POST['eau'], $_POST['electricite'], $_POST['fer'], $_POST['fuel'], $_POST['nourriture'], $_POST['posx'], $_POST['posy']); |
| 5 | 5 | |
@@ -38,8 +38,7 @@ discard block |
||
| 38 | 38 | ->from("_bataille_base") |
| 39 | 39 | ->where("_bataille_base.ID_identite", "=", "identite.ID_identite", "", true) |
| 40 | 40 | ->get(); |
| 41 | - } |
|
| 42 | - else { |
|
| 41 | + } else { |
|
| 43 | 42 | $query = $dbc->select("_bataille_base.nom_base") |
| 44 | 43 | ->select("_bataille_base.points") |
| 45 | 44 | ->select("_bataille_base.posx") |
@@ -114,8 +113,7 @@ discard block |
||
| 114 | 113 | if (Bataille::getNombreJoueur() <= 150) { |
| 115 | 114 | $posx = rand(0, 79); |
| 116 | 115 | $posy = rand(0, 75); |
| 117 | - } |
|
| 118 | - else { |
|
| 116 | + } else { |
|
| 119 | 117 | $posx = rand(0, $this->largeur); |
| 120 | 118 | $posy = rand(0, $this->hauteur); |
| 121 | 119 | } |
@@ -123,8 +121,7 @@ discard block |
||
| 123 | 121 | //on test si il y a une base sur ces positions |
| 124 | 122 | if (Bataille::getBaseExistPosition($posx, $posy)) { |
| 125 | 123 | $this->getPositionNewBase(); |
| 126 | - } |
|
| 127 | - else { |
|
| 124 | + } else { |
|
| 128 | 125 | //on a une position de base inexistante donc on la return |
| 129 | 126 | return ["posx" => $posx, "posy" => $posy]; |
| 130 | 127 | } |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | if (isset($_POST['admin'])) { |
| 6 | 6 | \core\auth\Connexion::setLogin($pseudo, $mdp, WEBROOT."administrator/login", WEBROOT."administrator", 0); |
| 7 | - } |
|
| 8 | - else { |
|
| 7 | + } else { |
|
| 9 | 8 | \core\auth\Connexion::setLogin($pseudo, $mdp, WEBROOT."login", WEBROOT."index.php", 0); |
| 10 | 9 | } |
| 11 | 10 | \ No newline at end of file |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | if (isset($_POST['admin'])) { |
| 6 | 6 | \core\auth\Connexion::setLogin($pseudo, $mdp, WEBROOT."administrator/login", WEBROOT."administrator", 0); |
| 7 | - } |
|
| 8 | - else { |
|
| 7 | + } else { |
|
| 9 | 8 | \core\auth\Connexion::setLogin($pseudo, $mdp, WEBROOT."login", WEBROOT."index.php", 0); |
| 10 | 9 | } |
| 11 | 10 | \ No newline at end of file |
@@ -19,7 +19,9 @@ discard block |
||
| 19 | 19 | $query = $dbc1->select("coef_niveau_unite")->from("configuration")->where("ID_configuration", "=", 1)->get(); |
| 20 | 20 | |
| 21 | 21 | if ((is_array($query)) && (count($query) == 1)) { |
| 22 | - foreach ($query as $obj) $this->coef_unite = $obj->coef_niveau_unite; |
|
| 22 | + foreach ($query as $obj) { |
|
| 23 | + $this->coef_unite = $obj->coef_niveau_unite; |
|
| 24 | + } |
|
| 23 | 25 | } |
| 24 | 26 | } |
| 25 | 27 | //-------------------------- END BUILDER ----------------------------------------------------------------------------// |
@@ -53,7 +55,9 @@ discard block |
||
| 53 | 55 | $coef = $this->coef_unite*$niveau; |
| 54 | 56 | $coef_ameliorer = $this->coef_unite*($niveau+1); |
| 55 | 57 | |
| 56 | - if ($niveau == 1) $coef = 1; |
|
| 58 | + if ($niveau == 1) { |
|
| 59 | + $coef = 1; |
|
| 60 | + } |
|
| 57 | 61 | |
| 58 | 62 | return [ |
| 59 | 63 | "caracteristique" => [ |
@@ -76,8 +80,7 @@ discard block |
||
| 76 | 80 | ], |
| 77 | 81 | "temps_recrutement" => $temps_recrutement |
| 78 | 82 | ]; |
| 79 | - } |
|
| 80 | - else { |
|
| 83 | + } else { |
|
| 81 | 84 | return []; |
| 82 | 85 | } |
| 83 | 86 | } |
@@ -92,7 +95,9 @@ discard block |
||
| 92 | 95 | $query = $dbc1->select("type_unite")->from("configuration")->where("ID_configuration", "=", 1)->get(); |
| 93 | 96 | |
| 94 | 97 | if ((is_array($query)) && (count($query) == 1)) { |
| 95 | - foreach ($query as $obj) return explode(",", $obj->type_unite); |
|
| 98 | + foreach ($query as $obj) { |
|
| 99 | + return explode(",", $obj->type_unite); |
|
| 100 | + } |
|
| 96 | 101 | } |
| 97 | 102 | } |
| 98 | 103 | |
@@ -128,8 +133,7 @@ discard block |
||
| 128 | 133 | foreach ($query as $obj) { |
| 129 | 134 | if ($obj->date_fin-$today <= 0) { |
| 130 | 135 | $this->setTerminerRecrutement($obj->ID_recrutement); |
| 131 | - } |
|
| 132 | - else { |
|
| 136 | + } else { |
|
| 133 | 137 | $recrutement[] = [ |
| 134 | 138 | "nom" => $obj->nom, |
| 135 | 139 | "type" => $obj->type, |
@@ -150,7 +154,9 @@ discard block |
||
| 150 | 154 | */ |
| 151 | 155 | public function getAllUnites($id_base = null) { |
| 152 | 156 | |
| 153 | - if ($id_base == null) $id_base = Bataille::getIdBase(); |
|
| 157 | + if ($id_base == null) { |
|
| 158 | + $id_base = Bataille::getIdBase(); |
|
| 159 | + } |
|
| 154 | 160 | |
| 155 | 161 | $types = $this->getAllType(); |
| 156 | 162 | $count_type = count($types); |
@@ -240,8 +246,7 @@ discard block |
||
| 240 | 246 | if (($eau["class"] || $electricite["class"] || $fer["class"] || $fuel["class"]) == "rouge" ) { |
| 241 | 247 | FlashMessage::setFlash("Pas assez de ressources pour recruter autant d'unités"); |
| 242 | 248 | return false; |
| 243 | - } |
|
| 244 | - else { |
|
| 249 | + } else { |
|
| 245 | 250 | //on retire les ressources |
| 246 | 251 | Bataille::getRessource()->setUpdateRessource($retirer_eau, $retirer_electricite, $retirer_fer, $retirer_fuel, 0, "-"); |
| 247 | 252 | |
@@ -47,25 +47,25 @@ discard block |
||
| 47 | 47 | foreach ($query as $obj) { |
| 48 | 48 | $base_carac = unserialize($obj->caracteristique); |
| 49 | 49 | $ressource = unserialize($obj->pour_recruter); |
| 50 | - $temps_recrutement = DateHeure::Secondeenheure(round($obj->temps_recrutement-($obj->temps_recrutement*Bataille::getBatiment()->getNiveauBatiment("caserne")/100))); |
|
| 50 | + $temps_recrutement = DateHeure::Secondeenheure(round($obj->temps_recrutement - ($obj->temps_recrutement * Bataille::getBatiment()->getNiveauBatiment("caserne") / 100))); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - $coef = $this->coef_unite*$niveau; |
|
| 53 | + $coef = $this->coef_unite * $niveau; |
|
| 54 | 54 | |
| 55 | 55 | if ($niveau == 1) $coef = 1; |
| 56 | 56 | |
| 57 | 57 | return [ |
| 58 | 58 | "caracteristique" => [ |
| 59 | - "attaque" => round($base_carac["attaque"]*$coef), |
|
| 60 | - "defense" => round($base_carac["defense"]*$coef), |
|
| 61 | - "resistance" => round($base_carac["resistance"]*$coef), |
|
| 59 | + "attaque" => round($base_carac["attaque"] * $coef), |
|
| 60 | + "defense" => round($base_carac["defense"] * $coef), |
|
| 61 | + "resistance" => round($base_carac["resistance"] * $coef), |
|
| 62 | 62 | "vitesse" => $base_carac["vitesse"] |
| 63 | 63 | ], |
| 64 | 64 | "cout_recruter" => [ |
| 65 | - "eau" => $ressource["eau"]*$coef, |
|
| 66 | - "electricite" => $ressource["electricite"]*$coef, |
|
| 67 | - "fer" => $ressource["fer"]*$coef, |
|
| 68 | - "fuel" => $ressource["fuel"]*$coef, |
|
| 65 | + "eau" => $ressource["eau"] * $coef, |
|
| 66 | + "electricite" => $ressource["electricite"] * $coef, |
|
| 67 | + "fer" => $ressource["fer"] * $coef, |
|
| 68 | + "fuel" => $ressource["fuel"] * $coef, |
|
| 69 | 69 | ], |
| 70 | 70 | "temps_recrutement" => $temps_recrutement |
| 71 | 71 | ]; |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | $unites = Bataille::getCentreRecherche()->getAllRechercheType($type); |
| 100 | 100 | |
| 101 | 101 | //recupérer les caractéristiques de l'unité en question |
| 102 | - for ($i=0 ; $i<count($unites) ; $i++) { |
|
| 102 | + for ($i = 0; $i < count($unites); $i++) { |
|
| 103 | 103 | $unites[$i] += $this->getCaracteristiqueUnite($unites[$i]["recherche"], $unites[$i]["niveau"], $type); |
| 104 | 104 | $unites[$i] += ["type" => $type]; |
| 105 | 105 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $today = Bataille::getToday(); |
| 120 | 120 | |
| 121 | 121 | foreach ($query as $obj) { |
| 122 | - if ($obj->date_fin-$today <= 0) { |
|
| 122 | + if ($obj->date_fin - $today <= 0) { |
|
| 123 | 123 | $this->setTerminerRecrutement($obj->ID_recrutement); |
| 124 | 124 | } |
| 125 | 125 | else { |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | "nom" => $obj->nom, |
| 128 | 128 | "type" => $obj->type, |
| 129 | 129 | "nombre" => $obj->nombre, |
| 130 | - "date_fin_recrutement" => $obj->date_fin-$today, |
|
| 130 | + "date_fin_recrutement" => $obj->date_fin - $today, |
|
| 131 | 131 | "id_recrutement" => $obj->ID_recrutement |
| 132 | 132 | ]; |
| 133 | 133 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $count_type = count($types); |
| 150 | 150 | $unites = []; |
| 151 | 151 | |
| 152 | - for ($i=0 ; $i<$count_type ; $i++) { |
|
| 152 | + for ($i = 0; $i < $count_type; $i++) { |
|
| 153 | 153 | $type_unite = $this->getAllUniteType($types[$i], $id_base); |
| 154 | 154 | |
| 155 | 155 | $unites = array_merge($unites, $type_unite); |
@@ -215,23 +215,23 @@ discard block |
||
| 215 | 215 | if ((is_array($query)) && (count($query) == 1)) { |
| 216 | 216 | foreach ($query as $obj) { |
| 217 | 217 | $pour_recruter = unserialize($obj->pour_recruter); |
| 218 | - $temps_recrutement = round($obj->temps_recrutement-($obj->temps_recrutement*Bataille::getBatiment()->getNiveauBatiment("caserne")/100)); |
|
| 218 | + $temps_recrutement = round($obj->temps_recrutement - ($obj->temps_recrutement * Bataille::getBatiment()->getNiveauBatiment("caserne") / 100)); |
|
| 219 | 219 | } |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | //on test si on a assez de ressource pour recruter les unites |
| 223 | 223 | //on test si assez de ressources dans la base |
| 224 | - $retirer_eau = $pour_recruter["eau"]*$nombre; |
|
| 225 | - $retirer_electricite = $pour_recruter["electricite"]*$nombre; |
|
| 226 | - $retirer_fer = $pour_recruter["fer"]*$nombre; |
|
| 227 | - $retirer_fuel = $pour_recruter["fuel"]*$nombre; |
|
| 224 | + $retirer_eau = $pour_recruter["eau"] * $nombre; |
|
| 225 | + $retirer_electricite = $pour_recruter["electricite"] * $nombre; |
|
| 226 | + $retirer_fer = $pour_recruter["fer"] * $nombre; |
|
| 227 | + $retirer_fuel = $pour_recruter["fuel"] * $nombre; |
|
| 228 | 228 | $eau = Bataille::getTestAssezRessourceBase("eau", $retirer_eau); |
| 229 | 229 | $electricite = Bataille::getTestAssezRessourceBase("electricite", $retirer_electricite); |
| 230 | 230 | $fer = Bataille::getTestAssezRessourceBase("fer", $retirer_fer); |
| 231 | 231 | $fuel = Bataille::getTestAssezRessourceBase("fuel", $retirer_fuel); |
| 232 | 232 | |
| 233 | 233 | |
| 234 | - if (($eau["class"] || $electricite["class"] || $fer["class"] || $fuel["class"]) == "rouge" ) { |
|
| 234 | + if (($eau["class"] || $electricite["class"] || $fer["class"] || $fuel["class"]) == "rouge") { |
|
| 235 | 235 | FlashMessage::setFlash("Pas assez de ressources pour recruter autant d'unités"); |
| 236 | 236 | return false; |
| 237 | 237 | } |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | //on retire les ressources |
| 240 | 240 | Bataille::getRessource()->setUpdateRessource($retirer_eau, $retirer_electricite, $retirer_fer, $retirer_fuel, 0, "-"); |
| 241 | 241 | |
| 242 | - $date_fin = Bataille::getToday()+($temps_recrutement*$nombre); |
|
| 242 | + $date_fin = Bataille::getToday() + ($temps_recrutement * $nombre); |
|
| 243 | 243 | |
| 244 | 244 | $dbc->insert("nom", $nom) |
| 245 | 245 | ->insert("type", $type) |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | $type = $obj->type; |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | - for ($i=0 ; $i<$nombre ; $i++) { |
|
| 273 | + for ($i = 0; $i < $nombre; $i++) { |
|
| 274 | 274 | $dbc->insert("nom", $nom) |
| 275 | 275 | ->insert("type", $type) |
| 276 | 276 | ->insert("ID_base", Bataille::getIdBase()) |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | if (isset($_POST['admin'])) { |
| 6 | 6 | \core\auth\Connexion::setLogin($pseudo, $mdp, WEBROOT."administrator/login", WEBROOT."administrator", 0); |
| 7 | - } |
|
| 8 | - else { |
|
| 7 | + } else { |
|
| 9 | 8 | \core\auth\Connexion::setLogin($pseudo, $mdp, WEBROOT."login", WEBROOT."index.php", 0); |
| 10 | 9 | } |
| 11 | 10 | \ No newline at end of file |