mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-11 05:41:01 +00:00
optimize climber points update (work really fast now)
This commit is contained in:
@@ -19,11 +19,11 @@ class MYSQL_DB {
|
||||
}
|
||||
|
||||
function register($username, $password, $email, $tribe, $act) {
|
||||
$time = time();
|
||||
$time = time();
|
||||
$timep = time() + PROTECTION;
|
||||
if(strtotime(START_TIME) > time()){
|
||||
$time = strtotime(START_TIME);
|
||||
$timep = (strtotime(START_TIME) + PROTECTION);
|
||||
}
|
||||
$timep = ($time + PROTECTION);
|
||||
$q = "INSERT INTO " . TB_PREFIX . "users (username,password,access,email,timestamp,tribe,act,protect,lastupdate,regtime) VALUES ('$username', '$password', " . USER . ", '$email', $time, $tribe, '$act', $timep, $time, $time)";
|
||||
if(mysql_query($q, $this->connection)) {
|
||||
return mysql_insert_id($this->connection);
|
||||
@@ -1161,6 +1161,27 @@ class MYSQL_DB {
|
||||
mysql_query($q, $this->connection);
|
||||
return mysql_insert_id($this->connection);
|
||||
}
|
||||
|
||||
function procAllyPop($aid) {
|
||||
$ally = $this->getAlliance($aid);
|
||||
$memberlist = $this->getAllMember($ally['id']);
|
||||
$oldrank = 0;
|
||||
foreach($memberlist as $member) {
|
||||
$oldrank += $this->getVSumField($member['id'],"pop");
|
||||
}
|
||||
if($ally['oldrank'] != $oldrank){
|
||||
if($ally['oldrank'] < $oldrank) {
|
||||
$totalpoints = $oldrank - $ally['oldrank'];
|
||||
$this->addclimberrankpopAlly($ally['id'], $totalpoints);
|
||||
$this->updateoldrankAlly($ally['id'], $oldrank);
|
||||
} else
|
||||
if($ally['oldrank'] > $oldrank) {
|
||||
$totalpoints = $ally['oldrank'] - $oldrank;
|
||||
$this->removeclimberrankpopAlly($ally['id'], $totalpoints);
|
||||
$this->updateoldrankAlly($ally['id'], $oldrank);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
Function to insert an alliance new
|
||||
|
||||
Reference in New Issue
Block a user