task/20210226/various_fix #21

Merged
nemunaire merged 5 commits from task/20210226/various_fix into master 2021-02-27 08:57:26 +00:00
6 changed files with 49 additions and 11 deletions

View File

@ -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:

View File

@ -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();

View File

@ -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';
}

View File

@ -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';

View File

@ -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

View File

@ -37,4 +37,22 @@
</td>
</tr>
</table>
{include file='game/footer.tpl'}
<br />
<h2>Liste des planètes existantes</h2>
<table>
<tr>
<th>Planète</th>
<th>Joueur</th>
<th>Position</th>
<th></th>
</tr>
{foreach from=$planetes item=planete}
<tr>
<td>{$planete.nom_planete}</td>
<td>{$planete.pseudo}</td>
<td>{$planete.galaxie}:{$planete.ss}:{$planete.position}</td>
<td><a href="admin.php?p={$linkpage}&id={$planete.id}"><input type="submit" class="submit" value="GO" /></a></td>
<tr>
{/foreach}
</table>
{include file='game/footer.tpl'}