diff --git a/onyx2/include/Class/Donnees/technologies.php b/onyx2/include/Class/Donnees/technologies.php index 1864ca9..f6b9db0 100644 --- a/onyx2/include/Class/Donnees/technologies.php +++ b/onyx2/include/Class/Donnees/technologies.php @@ -1617,6 +1617,9 @@ class dTechnologies implements Donnees array("technologies", 1, 0), array('batiments', 6, 2) ), + array( + array("technologies", 8, 0) + ), array( array("technologies", 8, 1) ), @@ -1668,9 +1671,6 @@ class dTechnologies implements Donnees array( array("technologies", 8, 17) ), - array( - array("technologies", 8, 18) - ), ); break; default: diff --git a/onyx2/include/admin/alliance.php b/onyx2/include/admin/alliance.php index e6e54d2..ceb4cca 100644 --- a/onyx2/include/admin/alliance.php +++ b/onyx2/include/admin/alliance.php @@ -12,7 +12,7 @@ if (!empty($_GET['id']) && !empty($_GET['key']) && $_GET['key'] != 'id') { $pagea = 'print_key'; $id_plan = $_GET['id']; $key = $_GET['key']; - $chapeau->connexion(); + $chapeau = new BDD(); $chapeau->escape($id_plan); $chapeau->escape($key); $reqA = $chapeau->unique_query("SELECT * FROM $table_alliances WHERE id = '$id_plan';"); @@ -27,20 +27,20 @@ if (!empty($_GET['id']) && !empty($_GET['key']) && $_GET['key'] != 'id') { if (isset($_POST['key']) && isset($_POST['mod'])) { $key = $_POST['key']; $mod = $_POST['mod']; - $chapeau->connexion(); + $chapeau = new BDD(); $chapeau->escape($mod); $chapeau->escape($id_plan); $chapeau->query("UPDATE $table_alliances SET $key = '$mod' WHERE id = '$id_plan';"); $chapeau->deconnexion(); } - $chapeau->connexion(); + $chapeau = new BDD(); $req = $chapeau->unique_query("SELECT * FROM $table_alliances WHERE id = '$id_plan';"); $chapeau->deconnexion(); $template->assign('tableau', $req); $template->assign('idPlan', $id_plan); } elseif (!empty($_GET['name'])) { $name = $_GET['name']; - $chapeau->connexion(); + $chapeau = new BDD(); $chapeau->escape($name); $req = $chapeau->unique_query("SELECT * FROM $table_alliances WHERE nom = '$name';"); $chapeau->deconnexion(); diff --git a/onyx2/include/admin/planete.php b/onyx2/include/admin/planete.php index a31fd20..cbac82d 100644 --- a/onyx2/include/admin/planete.php +++ b/onyx2/include/admin/planete.php @@ -65,5 +65,9 @@ if (!empty($_GET['id']) && !empty($_GET['key']) && $_GET['key'] == 'hash_planete header('Location: '.$VAR["menu"]["vplanetes"].'&id='.$req['id']); exit; } else { + $bdd = new BDD(); + $req = $bdd->query("SELECT planete.id, nom_planete, pseudo, galaxie, ss, position FROM planete LEFT JOIN user ON (id_user=user.id) LIMIT 1000;"); + $bdd->deconnexion(); + $template->assign('planetes', $req); $pagea = 'print_choixP'; } diff --git a/onyx2/include/game/flottes/details.php b/onyx2/include/game/flottes/details.php index b1773f2..c7464d3 100644 --- a/onyx2/include/game/flottes/details.php +++ b/onyx2/include/game/flottes/details.php @@ -28,16 +28,18 @@ if (!defined('INDEX')) { if ($flotteN->mission == '6') { erreur('Votre flotte est déjà en train de revenir !', 'red', '?p=flotte&n='.$idN, 1500); } elseif ($flotteN->end_time > $tpsDD) { - $bdd->query("UPDATE $table_flottes SET mission = '6', effectue = '1', end_time = $tpsDD, end_galaxie = start_galaxie, end_ss = start_ss, end_position = start_position WHERE id_user = ".$planete->id_user." AND id = $idN;"); + $bdd = new BDD(); + $bdd->query("UPDATE $table_flottes SET mission = '6', end_time = $tpsDD, end_planete = start_planete WHERE id_user = ".$planete->id_user." AND id = $idN;"); + $bdd->deconnexion(); redirection("?p=flotte&n=".$idN); } else { erreur('Impossible d\'annuler la mission, elle a déjà commencée.', "red", '?p=flotte&n='.$idN, 1500); } } - + $SESS->values['ret_fleet'] = md5('HB.fleet_'.rand().'☺ß☻'); $SESS->put(); - + $template->assign('ret_fleet', $SESS->values['ret_fleet']); $template->assign('flotte', $flotteN); $page = 'flotten'; diff --git a/onyx2/include/game/flottes/envoyer.php b/onyx2/include/game/flottes/envoyer.php index 401f0b7..ac75b7b 100644 --- a/onyx2/include/game/flottes/envoyer.php +++ b/onyx2/include/game/flottes/envoyer.php @@ -4,6 +4,8 @@ if (!defined('INDEX')) { exit; } +require_once("Class/class.donnee.php"); + //Récupération des informations envoyées $idPrep = gpc("cds", "post"); @@ -57,6 +59,18 @@ if ($mission == 2) { erreur('Fonder d\'abord une alliance avant de coloniser un astéroide !', "red", $VAR["menu"]["flotte"]); } } + + // on vérifie que le joueur n'essaye pas de coloniser plus de planète que sa techno expansion lui permet + $bdd->reconnexion(); + $resultat = $bdd->unique_query("SELECT COUNT(id) as nb_planete FROM $table_planete WHERE id_user = ".$planete->id_user.";"); + $bdd->deconnexion(); + $nb_planete = $resultat["nb_planete"]; + $branche = 8; + $idTechnologie = $nb_planete; + $neededTechnologies = Donnee::donneeTechnologie($branche, $idTechnologie, "needed", $planete); + if (((int)$planete->technologies[$branche]& $neededTechnologies) != $neededTechnologies) { + erreur('Vous ne pouvez pas coloniser plus de planète que votre niveau d\'expansion'); + } } //On vérifie que les attaques soient bien activées diff --git a/onyx2/tpl/admin/print_choixP.tpl b/onyx2/tpl/admin/print_choixP.tpl index b3c6605..0089143 100644 --- a/onyx2/tpl/admin/print_choixP.tpl +++ b/onyx2/tpl/admin/print_choixP.tpl @@ -37,4 +37,22 @@ -{include file='game/footer.tpl'} \ No newline at end of file +
+

Liste des planètes existantes

+ + + + + + + + {foreach from=$planetes item=planete} + + + + + + + {/foreach} +
PlanèteJoueurPosition
{$planete.nom_planete}{$planete.pseudo}{$planete.galaxie}:{$planete.ss}:{$planete.position}
+{include file='game/footer.tpl'}