mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-20 10:11:00 +00:00
little optimize for climbers function
This commit is contained in:
+17
-17
@@ -148,7 +148,7 @@ class Automation {
|
|||||||
$this->procClimbers();
|
$this->procClimbers();
|
||||||
$this->ClearUser();
|
$this->ClearUser();
|
||||||
$this->ClearInactive();
|
$this->ClearInactive();
|
||||||
$this->oasisResoucesProduce();
|
$this->oasisResourcesProduce();
|
||||||
$this->pruneResource();
|
$this->pruneResource();
|
||||||
$this->pruneOResource();
|
$this->pruneOResource();
|
||||||
$this->checkWWAttacks();
|
$this->checkWWAttacks();
|
||||||
@@ -3900,7 +3900,7 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function oasisResoucesProduce() {
|
private function oasisResourcesProduce() {
|
||||||
global $database;
|
global $database;
|
||||||
$time = time();
|
$time = time();
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."odata WHERE wood < 800 OR clay < 800 OR iron < 800 OR crop < 800";
|
$q = "SELECT * FROM ".TB_PREFIX."odata WHERE wood < 800 OR clay < 800 OR iron < 800 OR crop < 800";
|
||||||
@@ -4192,7 +4192,7 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
|
|||||||
global $database, $ranking;
|
global $database, $ranking;
|
||||||
$users = "SELECT * FROM " . TB_PREFIX . "users WHERE access < " . (INCLUDE_ADMIN ? "10" : "8") . "";
|
$users = "SELECT * FROM " . TB_PREFIX . "users WHERE access < " . (INCLUDE_ADMIN ? "10" : "8") . "";
|
||||||
$array = $database->query_return($users);
|
$array = $database->query_return($users);
|
||||||
$ranking->procRankArray();
|
$climbers = $ranking->procRankArray();
|
||||||
if(mysql_num_rows(mysql_query($users)) > 0){
|
if(mysql_num_rows(mysql_query($users)) > 0){
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."medal order by week DESC LIMIT 0, 1";
|
$q = "SELECT * FROM ".TB_PREFIX."medal order by week DESC LIMIT 0, 1";
|
||||||
$result = mysql_query($q);
|
$result = mysql_query($q);
|
||||||
@@ -4202,26 +4202,26 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
|
|||||||
} else {
|
} else {
|
||||||
$week='1';
|
$week='1';
|
||||||
}
|
}
|
||||||
foreach($array as $session){
|
while($row = mysql_fetch_array($climbers)){
|
||||||
$oldrank = $ranking->getUserRank($session['id']);
|
$oldrank = $ranking->getUserRank($row['id']);
|
||||||
if($session['oldrank'] == 0){
|
if($row['oldrank'] == 0){
|
||||||
$database->updateoldrank($session['id'], $oldrank);
|
$database->updateoldrank($row['id'], $oldrank);
|
||||||
}else{
|
}else{
|
||||||
if($week > 1){
|
if($week > 1){
|
||||||
if($session['oldrank'] > $oldrank) {
|
if($row['oldrank'] > $oldrank) {
|
||||||
$totalpoints = $session['oldrank'] - $oldrank;
|
$totalpoints = $row['oldrank'] - $oldrank;
|
||||||
$database->addclimberrankpop($session['id'], $totalpoints);
|
$database->addclimberrankpop($row['id'], $totalpoints);
|
||||||
$database->updateoldrank($session['id'], $oldrank);
|
$database->updateoldrank($row['id'], $oldrank);
|
||||||
} else
|
} else
|
||||||
if($session['oldrank'] < $oldrank) {
|
if($row['oldrank'] < $oldrank) {
|
||||||
$totalpoints = $oldrank - $session['oldrank'];
|
$totalpoints = $oldrank - $row['oldrank'];
|
||||||
$database->removeclimberrankpop($session['id'], $totalpoints);
|
$database->removeclimberrankpop($row['id'], $totalpoints);
|
||||||
$database->updateoldrank($session['id'], $oldrank);
|
$database->updateoldrank($row['id'], $oldrank);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$totalpoints = mysql_num_rows(mysql_query($users)) - $oldrank;
|
$totalpoints = mysql_num_rows(mysql_query($users)) - $oldrank;
|
||||||
$database->setclimberrankpop($session['id'], $totalpoints+1);
|
$database->setclimberrankpop($row['id'], $totalpoints+1);
|
||||||
$database->updateoldrank($session['id'], $oldrank);
|
$database->updateoldrank($row['id'], $oldrank);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user