mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-06-28 00:24:23 +00:00
fix: hero movements got screwed up while doing DB caching stuff...
#313
This commit is contained in:
@@ -1697,8 +1697,7 @@ class Automation {
|
||||
$alldead=array();
|
||||
$heroAttackDead=$dead11;
|
||||
//kill own defence
|
||||
$q = "SELECT * FROM ".TB_PREFIX."units WHERE vref='".$data['to']."'";
|
||||
$unitlist = $database->query_return($q);
|
||||
$unitlist = $database->getUnit($data['to']);
|
||||
$start = ($targettribe-1)*10+1;
|
||||
$end = ($targettribe*10);
|
||||
|
||||
@@ -1713,7 +1712,7 @@ class Automation {
|
||||
}
|
||||
|
||||
if($unitlist){
|
||||
$owndead[$i]=round($battlepart[2]*$unitlist[0]['u'.$i]);
|
||||
$owndead[$i] = round($battlepart[2] * (isset($unitlist[0]) ? $unitlist[0]['u'.$i] : 0));
|
||||
$unitModifications_units[] = $i;
|
||||
$unitModifications_amounts[] = $owndead[$i];
|
||||
$unitModifications_modes[] = 0;
|
||||
@@ -2136,10 +2135,7 @@ class Automation {
|
||||
}
|
||||
}
|
||||
if ($herosend_att>0){
|
||||
$qh = "SELECT unit FROM ".TB_PREFIX."hero WHERE uid = ".(int) $from['owner']." AND dead = 0";
|
||||
$resulth = mysqli_query($GLOBALS['link'],$qh);
|
||||
$hero_f=mysqli_fetch_array($resulth);
|
||||
$hero_unit=$hero_f['unit'];
|
||||
$hero_unit = $database->getHeroField($from['owner'], 'unit');
|
||||
$speeds[] = $GLOBALS['u'.$hero_unit]['speed'];
|
||||
}
|
||||
|
||||
@@ -3349,7 +3345,7 @@ class Automation {
|
||||
) {
|
||||
//don't reinforce, addunit instead
|
||||
$database->modifyUnit($data['to'],array("hero"),array(1),array(1));
|
||||
$heroid = $database->getHero($DefenderID,1);
|
||||
$heroid = $database->getHeroField($DefenderID, 'heroid');
|
||||
$database->modifyHero("wref",$data['to'],$heroid,0);
|
||||
$HeroTransfer = 1;
|
||||
}
|
||||
|
||||
@@ -5169,14 +5169,14 @@ class MYSQLi_DB implements IDbConnection {
|
||||
// first of all, check if we should be using cache and whether the field
|
||||
// required is already cached
|
||||
if ($use_cache && ($cachedValue = self::returnCachedContent(self::$heroFieldCache, $uid.$field)) && !is_null($cachedValue)) {
|
||||
return $cachedValue;
|
||||
return $cachedValue[$field];
|
||||
}
|
||||
|
||||
$q = "SELECT * FROM ".TB_PREFIX."hero WHERE uid = $uid AND dead = 0";
|
||||
$result = mysqli_query($this->dblink,$q);
|
||||
|
||||
self::$heroFieldCache[$uid.$field] = $this->mysqli_fetch_all($result);
|
||||
return self::$heroFieldCache[$uid.$field];
|
||||
return self::$heroFieldCache[$uid.$field][$field];
|
||||
}
|
||||
|
||||
function modifyHero($column,$value,$heroid,$mode=0) {
|
||||
|
||||
@@ -287,7 +287,7 @@ class Units {
|
||||
}
|
||||
}
|
||||
if( intval($enforce['hero']) > 0){
|
||||
$hero_unit = $database->getHeroField($from['owner'], 'unit')['unit'];
|
||||
$hero_unit = $database->getHeroField($from['owner'], 'unit');
|
||||
$speeds[] = $GLOBALS['u'.$hero_unit]['speed'];
|
||||
}else{
|
||||
$enforce['hero']='0';
|
||||
@@ -654,7 +654,7 @@ class Units {
|
||||
}
|
||||
if ( isset( $post['t11'] ) ) {
|
||||
if ( $post['t11'] != '' && $post['t11'] > 0 ) {
|
||||
$hero_unit = $database->getHeroField($from['owner'], 'unit')['unit'];
|
||||
$hero_unit = $database->getHeroField($from['owner'], 'unit');
|
||||
$speeds[] = $GLOBALS[ 'u' . $hero_unit ]['speed'];
|
||||
} else {
|
||||
$post['t11'] = '0';
|
||||
|
||||
Reference in New Issue
Block a user