From 3ba3c0706dd55543b6535bbea49c48d17dffdc8c Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 19 Jun 2012 15:02:38 +0300 Subject: [PATCH] some ranking updates --- GameEngine/Automation.php | 20 +-- GameEngine/Database/db_MYSQL.php | 2 +- GameEngine/Ranking.php | 10 +- GameEngine/config.php | 270 +++++++++++++++++++++++++++++++ 4 files changed, 286 insertions(+), 16 deletions(-) create mode 100644 GameEngine/config.php diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 7ec57f3a..74b82b6c 100644 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -3831,12 +3831,10 @@ $crannyimg = "query_return($users); - if(mysql_num_rows(mysql_query($users)) > 0){ $ranking->procRankArray(); - foreach($array as $session){ - $oldrank = $ranking->searchRank($session['username'], "username"); + if(count($ranking->getRank()) > 0){ $q = "SELECT * FROM ".TB_PREFIX."medal order by week DESC LIMIT 0, 1"; $result = mysql_query($q); if(mysql_num_rows($result)) { @@ -3845,6 +3843,8 @@ $crannyimg = "searchRank($session['username'], "username"); if($week > 1){ if($session['oldrank'] > $oldrank) { $totalpoints = $session['oldrank'] - $oldrank; @@ -3863,15 +3863,16 @@ $crannyimg = "updateoldrank($session['id'], $oldrank); } - $countally = count($database->countAlli()); - if($countally > 0){ - for($i=1;$i<=$countally;$i++){ - $memberlist = $database->getAllMember($i); + } + $alliance = $database->getARanking(); + $ranking->procARankArray(); + if(count($ranking->getRank()) > 0){ + foreach($alliance as $ally){ + $memberlist = $database->getAllMember($ally['id']); $oldrank = 0; foreach($memberlist as $member) { $oldrank += $database->getVSumField($member['id'],"pop"); } - $ally = $database->getAlliance($i); if($ally['oldrank'] < $oldrank) { $totalpoints = $oldrank - $ally['oldrank']; $database->addclimberrankpopAlly($ally['id'], $totalpoints); @@ -3884,7 +3885,6 @@ $crannyimg = "connection); return $this->mysql_fetch_all($result); } diff --git a/GameEngine/Ranking.php b/GameEngine/Ranking.php index eba1f988..193b363f 100644 --- a/GameEngine/Ranking.php +++ b/GameEngine/Ranking.php @@ -198,7 +198,7 @@ )allitag FROM " . TB_PREFIX . "users WHERE " . TB_PREFIX . "users.access < " . (INCLUDE_ADMIN ? "10" : "8") . " - ORDER BY totalpop DESC, totalvillages DESC, username ASC"; + ORDER BY totalpop DESC, totalvillages DESC"; $result = (mysql_query($q)); @@ -253,7 +253,7 @@ )allitag FROM " . TB_PREFIX . "users WHERE " . TB_PREFIX . "users.tribe = $race AND " . TB_PREFIX . "users.access < " . (INCLUDE_ADMIN ? "10" : "8") . " - ORDER BY totalpop DESC, totalvillages DESC, username ASC"; + ORDER BY totalpop DESC, totalvillages DESC"; $result = (mysql_query($q)); @@ -312,7 +312,7 @@ )pop FROM " . TB_PREFIX . "users WHERE " . TB_PREFIX . "users.apall >=0 AND " . TB_PREFIX . "users.access < " . (INCLUDE_ADMIN ? "10" : "8") . " AND " . TB_PREFIX . "users.tribe <= 3 - ORDER BY " . TB_PREFIX . "users.apall DESC, pop DESC, username ASC"; + ORDER BY " . TB_PREFIX . "users.apall DESC, pop DESC"; $result = mysql_query($q) or die(mysql_error()); while($row = mysql_Fetch_assoc($result)) { $datas[] = $row; @@ -355,7 +355,7 @@ )pop FROM " . TB_PREFIX . "users WHERE " . TB_PREFIX . "users.dpall >=0 AND " . TB_PREFIX . "users.access < " . (INCLUDE_ADMIN ? "10" : "8") . " - ORDER BY " . TB_PREFIX . "users.dpall DESC, pop DESC, username ASC"; + ORDER BY " . TB_PREFIX . "users.dpall DESC, pop DESC"; $result = mysql_query($q) or die(mysql_error()); while($row = mysql_Fetch_assoc($result)) { $datas[] = $row; @@ -401,7 +401,7 @@ $this->rankarray = $newholder; } - private function procARankArray() { + public function procARankArray() { global $database, $multisort; $array = $database->getARanking(); $holder = array(); diff --git a/GameEngine/config.php b/GameEngine/config.php new file mode 100644 index 00000000..f9f8a3fa --- /dev/null +++ b/GameEngine/config.php @@ -0,0 +1,270 @@ + \ No newline at end of file