Compare commits
2 Commits
master
...
feature/pa
Author | SHA1 | Date | |
---|---|---|---|
|
61de35ed4f | ||
9c353cc6e5 |
@ -64,7 +64,6 @@ steps:
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- cron
|
||||
- push
|
||||
- tag
|
||||
|
||||
|
@ -1,20 +1,16 @@
|
||||
<?php
|
||||
define("INDEX", 1);
|
||||
define("DEBUG", false);
|
||||
$chrono_start = microtime();
|
||||
require_once(trim(file_get_contents('./.onyx')));
|
||||
require_once("common.php"); //Chargement de tout le nécessaire pour le jeu
|
||||
require_once("function.php");
|
||||
require_once("Class/JSON.php");
|
||||
require_once("Class/flotte.php");
|
||||
require_once("Class/planete.php");
|
||||
$onyx = @file_get_contents('./.onyx') or die("Configuration introuvable.");
|
||||
define("_FCORE", trim($onyx));
|
||||
require(_FCORE."../game/Class/JSON.php");
|
||||
require_once(_FCORE."common.php");
|
||||
|
||||
if (isset($SESS) && isset($SESS->values['connected']) && $SESS->values['connected'] && !empty($SESS->values['id']) && !empty($SESS->values['idPlan'])) {
|
||||
$idPrep = gpc("cds_temp", "post");
|
||||
if (isset($sess) && isset($sess->values['connected']) && $sess->values['connected'] && !empty($sess->values['id']) && !empty($sess->level) && !empty($sess->values['idPlan'])) {
|
||||
$json = new Services_JSON();
|
||||
$nbtrajet = 2;
|
||||
|
||||
if (empty($VAR['flottes']) && $SESS->level <= 1) {
|
||||
if (empty($config['flottes']) && $sess->level <= 1) {
|
||||
$datas = array(
|
||||
'root' => array(
|
||||
'destination' => '<input class="dest" type="text" id="amas" name="amas" maxlength="2" value="'.gpc('galaxie', 'post').'" />:<input class="dest" type="text" id="ss" name="ss" maxlength="2" value="'.gpc('ss', 'post').'" />:<input class="dest" type="text" id="plan" name="pos" maxlength="2" value="'.gpc('pos', 'post').'" />',
|
||||
@ -32,7 +28,8 @@ if (isset($SESS) && isset($SESS->values['connected']) && $SESS->values['connecte
|
||||
$destin = gpc('fav_dest', 'post');
|
||||
|
||||
$chapeau = new bdd();
|
||||
$idPlan = $SESS->values['idPlan'];
|
||||
$chapeau->connexion();
|
||||
$idPlan = $sess->values['idPlan'];
|
||||
$queryPlanete = $chapeau->unique_query("SELECT * FROM $table_planete WHERE id = '$idPlan'");
|
||||
if (!empty($destin)) {
|
||||
$chapeau->escape($destin);
|
||||
@ -48,11 +45,18 @@ if (isset($SESS) && isset($SESS->values['connected']) && $SESS->values['connecte
|
||||
$start_ss = $queryPlanete['ss'];
|
||||
$start_position = $queryPlanete['position'];
|
||||
|
||||
if (empty($SESS->values["prepFlottes"][$idPrep]['time']) ||
|
||||
$SESS->values["prepFlottes"][$idPrep]['time'] + 1200 < time() ||
|
||||
empty($SESS->values["prepFlottes"][$idPrep]['nbVaisseaux']) ||
|
||||
empty($SESS->values["prepFlottes"][$idPrep]['vitesse']) &&
|
||||
isset($SESS->values['auth_level'])) {
|
||||
$met = gpc('met', 'post');
|
||||
$cri = gpc('cri', 'post');
|
||||
$hyd = gpc('hyd', 'post');
|
||||
if (!empty($sess->values['flcontenu']) && $met+$cri+$hyd >= 0 && $met >= 0 && $cri >= 0 && $hyd >= 0) {
|
||||
$places = $sess->values['flcontenu'] - ($met+$cri+$hyd);
|
||||
} else {
|
||||
$places = 'inconnu';
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (empty($sess->values['fltime']) || $sess->values['fltime'] + 600 < time() || empty($sess->values['flnbvais']) || empty($sess->values['flvitesse']) && isset($sess->values['auth_level'])) {
|
||||
$datas = array(
|
||||
'root' => array(
|
||||
'destination' => $destinRapid,
|
||||
@ -60,7 +64,7 @@ if (isset($SESS) && isset($SESS->values['connected']) && $SESS->values['connecte
|
||||
'deblok' => '<b>Une erreur est survenue lors de la création de la flotte. Veuillez recommencer</b>',
|
||||
'conso' => '-',
|
||||
'tactique' => '',
|
||||
'places' => '',
|
||||
'places' => separerNombres($places)
|
||||
)
|
||||
);
|
||||
} elseif (empty($_POST['nom']) || preg_replace('@[^a-zA-Z0-9_ ]@i', '', $_POST['nom']) != $_POST['nom']) {
|
||||
@ -71,10 +75,10 @@ if (isset($SESS) && isset($SESS->values['connected']) && $SESS->values['connecte
|
||||
'deblok' => '<b>Nom de la flotte incorrect !</b>',
|
||||
'conso' => '-',
|
||||
'tactique' => '',
|
||||
'places' => '',
|
||||
'places' => separerNombres($places)
|
||||
)
|
||||
);
|
||||
} elseif ($_POST['galaxie'] > $VAR['nb_amas'] || $_POST['ss'] > $VAR['nb_systeme'] || $_POST['pos'] > $VAR['nb_planete'] || $_POST['galaxie'] < 0 || $_POST['ss'] < 1 || $_POST['pos'] < 1 || ($_POST['galaxie'] < 1 && $SESS->values['auth_level'] < 6)) {
|
||||
} elseif ($_POST['galaxie'] > MAX_AMAS || $_POST['ss'] > MAX_SYSTEME || $_POST['pos'] > MAX_PLANETE || $_POST['galaxie'] < 0 || $_POST['ss'] < 1 || $_POST['pos'] < 1 || ($_POST['galaxie'] < 1 && $sess->values['auth_level'] < 6)) {
|
||||
$datas = array(
|
||||
'root' => array(
|
||||
'destination' => $destinRapid,
|
||||
@ -82,38 +86,23 @@ if (isset($SESS) && isset($SESS->values['connected']) && $SESS->values['connecte
|
||||
'deblok' => '<b>Corrigez la destination !</b>',
|
||||
'conso' => '-',
|
||||
'tactique' => '',
|
||||
'places' => '',
|
||||
'places' => separerNombres($places)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$_POST['vitesse'] /= 100;
|
||||
|
||||
$planete = new planete($idPlan);
|
||||
$flotte = new flotte();
|
||||
$temps = $flotte->calc_deplacement($planete, $_POST['galaxie'], $_POST['ss'], $_POST['pos'], $_POST['vitesse'], $SESS->values["prepFlottes"][$idPrep]['vaisseaux'], 1000);
|
||||
$temps = vais_tempsDeplacement($start_galaxie, $start_ss, $start_position, $_POST['galaxie'], $_POST['ss'], $_POST['pos'], $sess->values['flvitesse'], $_POST['vitesse'], $sess->values['flpreparation'], $sess->values['flchauffe']);
|
||||
if ($temps <= 0) {
|
||||
$temps = 454;
|
||||
}
|
||||
$conso = $flotte->calc_deplacement($planete, $_POST['galaxie'], $_POST['ss'], $_POST['pos'], $_POST['vitesse'], $SESS->values["prepFlottes"][$idPrep]['vaisseaux'], 1000, false, true);
|
||||
// $conso renvoi le temps ET la conso dans un array
|
||||
$conso = intval($conso[1]);
|
||||
|
||||
$met = intval(gpc('met', 'post'));
|
||||
$cri = intval(gpc('cri', 'post'));
|
||||
$hyd = intval(gpc('hyd', 'post'));
|
||||
$places = $flotte->calcStockage($SESS->values["prepFlottes"][$idPrep]['vaisseaux'], $planete);
|
||||
$places -= ceil($conso * $nbtrajet);
|
||||
if (($met+$cri+$hyd) > 0) {
|
||||
$places -= ($met+$cri+$hyd);
|
||||
}
|
||||
$conso = vais_conso($temps, $sess->values['flnbvais'])*$_POST['vitesse']/45;
|
||||
$places -= ceil($conso*$nbtrajet);
|
||||
$tactique = '';
|
||||
// si la mission est une mission d'attaque
|
||||
if ($_POST['mission'] == '3') {
|
||||
if ($_POST['mission'] == '1') {
|
||||
$tactique = '<label for="selecttactique">Tactique d\'attaque :</label><select id="selecttactique" name="tactique">';
|
||||
//On récupère le niveau actuel de la technologie Commandement militaire
|
||||
$id_user = $SESS->values['id'];
|
||||
global $table_user;
|
||||
$table = $table_user;
|
||||
$id_user = $sess->values['id'];
|
||||
$table = $config['db_prefix'].'user';
|
||||
$queryUser = $chapeau->unique_query("SELECT * FROM $table WHERE id = '$id_user'");
|
||||
$lvltechno = $queryUser['tactique'];
|
||||
$tactiquedef = $queryUser['combatAT_tactique'];
|
||||
@ -124,9 +113,9 @@ if (isset($SESS) && isset($SESS->values['connected']) && $SESS->values['connecte
|
||||
'destination' => $destinRapid,
|
||||
'temps' => affTemp(floor($temps)),
|
||||
'deblok' => '<b>Vous ne pouvez pas attaquer sans un minimum de connaissances militaires !</b>',
|
||||
'conso' => ceil($conso*$nbtrajet),
|
||||
'conso' => separerNombres(ceil($conso*$nbtrajet)),
|
||||
'tactique' => '',
|
||||
'places' => $places
|
||||
'places' => separerNombres($places)
|
||||
)
|
||||
);
|
||||
header("X-JSON: ".$json->encode($datas));
|
||||
@ -142,16 +131,17 @@ if (isset($SESS) && isset($SESS->values['connected']) && $SESS->values['connecte
|
||||
}
|
||||
$tactique .= '</select><br />';
|
||||
}
|
||||
$SESS->values['flcds'] = $idPrep;
|
||||
$SESS->put();
|
||||
$cds = sha1('flotte'.$conso.'ß10'.time().'|HB;'.rand(10, 99).$temps);
|
||||
$sess->values['flcds'] = $cds;
|
||||
$sess->put();
|
||||
$datas = array(
|
||||
'root' => array(
|
||||
'destination' => $destinRapid,
|
||||
'temps' => affTemp(floor($temps)),
|
||||
'deblok' => '<input type="hidden" name="cds" value="'.$idPrep.'" /><input type="submit" value="GO" class="submit" />',
|
||||
'conso' => ceil($conso*2),
|
||||
'deblok' => '<input type="hidden" name="cds" value="'.$cds.'" /><input type="submit" value="GO" class="submit" />',
|
||||
'conso' => separerNombres(ceil($conso*2)),
|
||||
'tactique' => $tactique,
|
||||
'places' => $places
|
||||
'places' => separerNombres($places)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 72 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 72 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 83 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 82 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 69 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 95 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 79 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 68 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 82 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 87 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 82 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 68 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 84 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 71 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 72 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 77 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 87 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 55 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 22 KiB |