mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-09-04 17:37:21 +00:00
@@ -4539,11 +4539,13 @@ class Automation {
|
|||||||
$unitData = $database->getUnit($heroVillageIDs);
|
$unitData = $database->getUnit($heroVillageIDs);
|
||||||
|
|
||||||
// now do the math
|
// now do the math
|
||||||
|
$lastUpdateIDs = [];
|
||||||
|
$timeNow = time();
|
||||||
foreach($harray as $hdata){
|
foreach($harray as $hdata){
|
||||||
$columns = [];
|
$columns = [];
|
||||||
$columnValues = [];
|
$columnValues = [];
|
||||||
$modes = [];
|
$modes = [];
|
||||||
$lastUpdateTime = time();
|
$lastUpdateTime = $timeNow;
|
||||||
$newHealth = -1;
|
$newHealth = -1;
|
||||||
|
|
||||||
if((time()-$hdata['lastupdate'])>=1){
|
if((time()-$hdata['lastupdate'])>=1){
|
||||||
@@ -4629,12 +4631,23 @@ class Automation {
|
|||||||
$modes[] = null;
|
$modes[] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// last update timestamp
|
if ($lastUpdateTime != $timeNow) {
|
||||||
$columns[] = 'lastupdate';
|
// last update timestamp
|
||||||
$columnValues[] = $lastUpdateTime;
|
$columns[] = 'lastupdate';
|
||||||
$modes[] = null;
|
$columnValues[] = $lastUpdateTime;
|
||||||
|
$modes[] = null;
|
||||||
|
} else {
|
||||||
|
// leave same last update values for multiple heroes to the end
|
||||||
|
$lastUpdateIDs[] = $hdata['heroid'];
|
||||||
|
}
|
||||||
|
|
||||||
$database->modifyHero($columns, $columnValues, $hdata['heroid']);
|
if (count($columns)) {
|
||||||
|
$database->modifyHero( $columns, $columnValues, $hdata['heroid'] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($lastUpdateIDs)) {
|
||||||
|
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET lastupdate = $timeNow WHERE heroid IN(".implode(', ', $lastUpdateIDs).")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(file_exists("GameEngine/Prevention/updatehero.txt")) {
|
if(file_exists("GameEngine/Prevention/updatehero.txt")) {
|
||||||
|
|||||||
@@ -5691,19 +5691,6 @@ References: User ID/Message ID, Mode
|
|||||||
return mysqli_query($this->dblink,$q);
|
return mysqli_query($this->dblink,$q);
|
||||||
}
|
}
|
||||||
|
|
||||||
function modifyHeroByOwner($column,$value,$uid,$mode=0) {
|
|
||||||
list($column,$value,$uid,$mode) = $this->escape_input($column,$value,(int) $uid,$mode);
|
|
||||||
|
|
||||||
if(!$mode) {
|
|
||||||
$q = "UPDATE `".TB_PREFIX."hero` SET $column = '$value' WHERE uid = $uid AND dead = 0";
|
|
||||||
} elseif($mode=1) {
|
|
||||||
$q = "UPDATE `".TB_PREFIX."hero` SET $column = $column + ". (int) $value ." WHERE uid = $uid AND dead = 0";
|
|
||||||
} else {
|
|
||||||
$q = "UPDATE `".TB_PREFIX."hero` SET $column = $column - ". (int) $value ." WHERE uid = $uid AND dead = 0";
|
|
||||||
}
|
|
||||||
return mysqli_query($this->dblink,$q);
|
|
||||||
}
|
|
||||||
|
|
||||||
function modifyHeroXp($column,$value,$heroid) {
|
function modifyHeroXp($column,$value,$heroid) {
|
||||||
list($column,$value,$heroid) = $this->escape_input($column,(int) $value,(int) $heroid);
|
list($column,$value,$heroid) = $this->escape_input($column,(int) $value,(int) $heroid);
|
||||||
|
|
||||||
@@ -5811,7 +5798,6 @@ References: User ID/Message ID, Mode
|
|||||||
return mysqli_query($this->dblink,$q);
|
return mysqli_query($this->dblink,$q);
|
||||||
}
|
}
|
||||||
|
|
||||||
// no need to cache this method
|
|
||||||
function getResearching($vid, $use_cache = true) {
|
function getResearching($vid, $use_cache = true) {
|
||||||
$vid = (int) $vid;
|
$vid = (int) $vid;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user