mirror of
https://github.com/slawkens/myaac.git
synced 2025-06-16 17:54:30 +02:00
OTS_Toolbox::getVocationName($id, $promotion);
This commit is contained in:
parent
d423ddd07a
commit
e222957893
@ -2953,21 +2953,14 @@ class OTS_Player extends OTS_Row_DAO
|
|||||||
* @return string Player proffesion name.
|
* @return string Player proffesion name.
|
||||||
* @throws E_OTS_NotLoaded If player is not loaded or global vocations list is not loaded.
|
* @throws E_OTS_NotLoaded If player is not loaded or global vocations list is not loaded.
|
||||||
*/
|
*/
|
||||||
public function getVocationName()
|
public function getVocationName(): string
|
||||||
{
|
{
|
||||||
if( !isset($this->data['vocation']) )
|
if( !isset($this->data['vocation']) )
|
||||||
{
|
{
|
||||||
throw new E_OTS_NotLoaded();
|
throw new E_OTS_NotLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
global $config;
|
return OTS_Toolbox::getVocationName($this->data['vocation'], $this->data['promotion'] ?? 0);
|
||||||
$voc = $this->getVocation();
|
|
||||||
if(!isset($config['vocations'][$voc])) {
|
|
||||||
return 'Unknown';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $config['vocations'][$voc];
|
|
||||||
//return POT::getInstance()->getVocationsList()->getVocationName($this->data['vocation']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -110,6 +110,15 @@ class OTS_Toolbox
|
|||||||
$list->setFilter($filter);
|
$list->setFilter($filter);
|
||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getVocationName($id, $promotion = 0): string
|
||||||
|
{
|
||||||
|
if($promotion > 0) {
|
||||||
|
$id = ($id + ($promotion * config('vocations_amount')));
|
||||||
|
}
|
||||||
|
|
||||||
|
return config('vocations')[$id] ?? 'Unknown';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user