* important fix for servers with promotion column (#36)

* caused player.vocation to be resetted when saving player, for example:
on change name, accept invite to guild, leave guild
* fixed empty success message on leave guild
* (internal) using $player->getVocationName() where possible instead of
older method
* fixed some warning in guild show
This commit is contained in:
slawkens1
2018-01-08 01:00:56 +01:00
parent acf2e2fb4a
commit 4102b44352
8 changed files with 20 additions and 19 deletions

View File

@@ -241,11 +241,6 @@ class OTS_Player extends OTS_Row_DAO
if(!isset($this->data['rank_id']) || $this->data['rank_id'] == NULL)
$this->data['rank_id'] = 0;
if(isset($this->data['promotion'])) {
global $config;
if((int)$this->data['promotion'] > 0)
$this->data['vocation'] += ($this->data['promotion'] * $config['vocations_amount']);
}
// loads skills
if( $this->isLoaded() && $load_skills)
{
@@ -845,6 +840,12 @@ class OTS_Player extends OTS_Row_DAO
throw new E_OTS_NotLoaded();
}
if(isset($this->data['promotion'])) {
global $config;
if((int)$this->data['promotion'] > 0)
return ($this->data['vocation'] + ($this->data['promotion'] * $config['vocations_amount']));
}
return $this->data['vocation'];
}
@@ -2920,7 +2921,12 @@ class OTS_Player extends OTS_Row_DAO
}
global $config;
return $config['vocations'][$this->data['vocation']];
$voc = $this->getVocation();
if(!isset($config['vocations'][$voc])) {
return 'Unknown';
}
return $config['vocations'][$voc];
//return POT::getInstance()->getVocationsList()->getVocationName($this->data['vocation']);
}