forked from halo-battle/game
Version 1.8
This commit is contained in:
parent
aea537909a
commit
5f81f76b17
184 changed files with 78335 additions and 736 deletions
|
|
@ -1,7 +1,124 @@
|
|||
<?php
|
||||
if(!defined('INDEX')) define('INDEX', 1);
|
||||
//Script by Keiran
|
||||
print 'Début de la génération du classement ; il est : '.date('d/m/Y H:i:s');
|
||||
|
||||
set_time_limit(0);
|
||||
ignore_user_abort(true);
|
||||
|
||||
$onyx = @file_get_contents('./../.onyx') or die("Configuration introuvable.");
|
||||
define("_FCORE",'../'.trim($onyx));
|
||||
|
||||
require_once(_FCORE."kernel.php");
|
||||
require_once(_FCORE."hb_game/tables.php");
|
||||
require_once(_FCORE."hb_game/vars.php");
|
||||
|
||||
$bdd = new bdd();
|
||||
/*
|
||||
//Classement Joueurs
|
||||
$bdd->connexion();
|
||||
$bdd->query("TRUNCATE TABLE $table_classement;");
|
||||
$users = $bdd->query("SELECT * FROM $table_user;");
|
||||
$bdd->deconnexion();
|
||||
|
||||
$cnt = $bdd->num_rows;
|
||||
for($i = 0; $i < $cnt; $i++){
|
||||
$id_user = $users[$i]['id'];
|
||||
$queryUser = $users[$i];
|
||||
$pointsbat = 0;
|
||||
$pointsterr = 0;
|
||||
$pointsvais = 0;
|
||||
|
||||
$bdd->connexion();
|
||||
$planetes = $bdd->query("SELECT * FROM $table_planete WHERE id_user = $id_user;");
|
||||
$bdd->deconnexion();
|
||||
|
||||
$cntp = $bdd->num_rows;
|
||||
for($j = 0; $j < $cntp; $j++){
|
||||
$queryPlanete = $planetes[$j];
|
||||
|
||||
$nbbat = count($batimentVAR);
|
||||
for($k = 0; $k < $nbbat; $k++){
|
||||
if ($queryPlanete[$batimentVAR[$k]] == 0) continue;
|
||||
else {
|
||||
$n = $queryPlanete[$batimentVAR[$k]];
|
||||
eval($batimentCALC[$k][0]);
|
||||
eval($batimentCALC[$k][1]);
|
||||
eval($batimentCALC[$k][2]);
|
||||
$pointsbat += $a + $b + $c;
|
||||
}
|
||||
}
|
||||
|
||||
$nbterr = count($nomterrnVAR);
|
||||
for($k = 0; $k < $nbterr; $k++){
|
||||
if ($queryPlanete[$nomterrnVAR[$k]] == 0) continue;
|
||||
else {
|
||||
$n = $queryPlanete[$nomterrnVAR[$k]];
|
||||
$pointsterr += $nomterrnCALC[$k][0] + $nomterrnCALC[$k][1] + $nomterrnCALC[$k][2];
|
||||
}
|
||||
}
|
||||
|
||||
$nbvais = count($nomvaisnVAR);
|
||||
for($k = 0; $k < $nbvais; $k++){
|
||||
if ($queryPlanete[$nomvaisnVAR[$k]] == 0) continue;
|
||||
else {
|
||||
$n = $queryPlanete[$nomvaisnVAR[$k]];
|
||||
$pointsvais += $nomvaisnCALC[$k][0] + $nomvaisnCALC[$k][1] + $nomvaisnCALC[$k][2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$nbtech = count($technoloVAR);
|
||||
$pointstech = 0;
|
||||
for($k = 0; $k < $nbtech; $k++){
|
||||
if ($queryUser[$technoloVAR[$k]] == 0) continue;
|
||||
else {
|
||||
$n = $queryUser[$technoloVAR[$k]];
|
||||
eval($technoloCALC[$k][0]);
|
||||
eval($technoloCALC[$k][1]);
|
||||
eval($technoloCALC[$k][2]);
|
||||
$pointstech += $a + $b + $c;
|
||||
}
|
||||
}
|
||||
|
||||
$pointstech /= 1000;
|
||||
$pointsvais /= 1000;
|
||||
$pointsterr /= 1000;
|
||||
$pointsbat /= 1000;
|
||||
$points = $pointsbat + $pointsterr + $pointsvais + $pointstech;
|
||||
$bdd->connexion();
|
||||
$bdd->query("UPDATE $table_user SET points = $points, batiments = $pointsbat, recherches = $pointstech, flotte = $pointsvais, terrestre = $pointsterr WHERE id = $id_user;");
|
||||
if ($queryUser['auth_level'] < 2 && $queryUser['mv'] < 2) $bdd->query("INSERT INTO $table_classement (id_user, points, flottes, terrestres, recherches, batiments) VALUES ($id_user, $points, $pointsvais, $pointsterr, $pointstech, $pointsbat);");
|
||||
$bdd->deconnexion();
|
||||
}
|
||||
|
||||
$bdd->connexion();
|
||||
$classement = $bdd->query("SELECT U.id, U.auth_level FROM $table_classement C INNER JOIN $table_user U ON C.id_user = U.id ORDER BY C.points DESC;");
|
||||
$cnt = $bdd->num_rows;
|
||||
$p = 0;
|
||||
for($i = 0; $i < $cnt; $i++){
|
||||
if ($classement[$i]['auth_level'] < 2) {
|
||||
$p++;
|
||||
$bdd->query("UPDATE $table_user SET place_points = $p WHERE id = ".$classement[$i]['id']);
|
||||
}
|
||||
else $bdd->query("UPDATE $table_user SET place_points = 0 WHERE id = ".$classement[$i]['id']);
|
||||
}
|
||||
$bdd->deconnexion();
|
||||
*/
|
||||
print '<br />Fin de la génération du classement joueur ; il est : '.date('d/m/Y H:i:s');
|
||||
|
||||
//Classement Alliances
|
||||
$bdd->connexion();
|
||||
$bdd->query("TRUNCATE TABLE $table_classement_alliances;");
|
||||
$alliances = $bdd->query("SELECT U.id_alliance, SUM(U.id) AS nombre, SUM(U.points)/SUM(U.id) AS points, SUM(U.batiments)/SUM(U.id) AS batiments, SUM(U.recherches)/SUM(U.id) AS recherches, SUM(U.flotte)/SUM(U.id) AS flotte, SUM(U.terrestre)/SUM(U.id) AS terrestre FROM $table_user U GROUP BY U.id_alliance;");
|
||||
$cnt = $bdd->num_rows;
|
||||
for($i = 0; $i < $cnt; $i++){
|
||||
if ($alliances[$i]['id_alliance'] != 0) $bdd->query("INSERT INTO $table_classement_alliances (id_alliance, nbr_membres, points, batiments, recherches, flottes, terrestres) VALUES (".$alliances[$i]['id_alliance'].", ".$alliances[$i]['nombre'].", ".$alliances[$i]['points'].", ".$alliances[$i]['batiments'].", ".$alliances[$i]['recherches'].", ".$alliances[$i]['flotte'].", ".$alliances[$i]['terrestre'].");");
|
||||
}
|
||||
$bdd->deconnexion();
|
||||
|
||||
print '<br />Fin de la génération du classement ; il est : '.date('d/m/Y H:i:s');
|
||||
exit;
|
||||
//Script by Keiran
|
||||
print 'Il est : '.date('d/m/Y H:i:s');
|
||||
|
||||
set_time_limit(0);
|
||||
|
|
@ -127,7 +244,7 @@ while($recup_id = mysql_fetch_array($sql_1)) {
|
|||
$POINTS_BATIMENTS = $POINTS_BATIMENTS / 1000;
|
||||
|
||||
// points flottes terrestres recherches batiments
|
||||
if ($recup_id['auth_level'] < 3 && $recup_id['mv'] < 2) mysql_query("INSERT INTO `classement` VALUES (NULL, '$PSEUDO_USER', '$race', '$PT_RESSOURCES', '$POINTS_VAISSEAUX', '0', '$POINTS_TECHNO', '$POINTS_BATIMENTS')") or die (mysql_error());
|
||||
if ($recup_id['auth_level'] < 2 && $recup_id['mv'] < 2) mysql_query("INSERT INTO `classement` VALUES (NULL, '$PSEUDO_USER', '$race', '$PT_RESSOURCES', '$POINTS_VAISSEAUX', '0', '$POINTS_TECHNO', '$POINTS_BATIMENTS')") or die (mysql_error());
|
||||
mysql_query("UPDATE `user` SET `flotte` = '" . $POINTS_VAISSEAUX . "', `recherches` = '" . $POINTS_TECHNO . "', `batiments` = '" . $POINTS_BATIMENTS . "', `points` = '" . $PT_RESSOURCES . "' WHERE `pseudo` = '" . $PSEUDO_USER . "'") or die (mysql_error());
|
||||
|
||||
$metal = 0;
|
||||
|
|
@ -150,7 +267,7 @@ while($resultat = mysql_fetch_array($sql_2)) {
|
|||
$nomuser = $resultat['pseudo'];
|
||||
$reqd = mysql_query("SELECT `auth_level` FROM `user` WHERE `pseudo` = '$nomuser'");
|
||||
$resultatd = mysql_fetch_array($reqd);
|
||||
if ($resultatd['auth_level'] < 3) {
|
||||
if ($resultatd['auth_level'] < 2) {
|
||||
$i++;
|
||||
mysql_query("UPDATE `user` SET `place_points` = '$i' WHERE `pseudo` = '$nomuser'");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue