mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
* fixed several deprecation notices and warnings from MySQL8, most notably: - SQL_CALC_FOUND_ROWS: stopped using DBSimple::selectPage and query 'SELECT COUNT(*) ...' separately where needed - ON DUPLICATE KEY UPDATE ... VALUES(): use row alias for new values instead of VALUES function - boolean shorthands to long form (&& -> AND, etc)
82 lines
2.4 KiB
PHP
82 lines
2.4 KiB
PHP
<?php
|
|
|
|
if (!defined('AOWOW_REVISION'))
|
|
die('illegal access');
|
|
|
|
|
|
class SkillList extends BaseType
|
|
{
|
|
public static $type = Type::SKILL;
|
|
public static $brickFile = 'skill';
|
|
public static $dataTable = '?_skillline';
|
|
|
|
protected $queryBase = 'SELECT sl.*, sl.id AS ARRAY_KEY FROM ?_skillline sl';
|
|
protected $queryOpts = array(
|
|
'sl' => [['ic']],
|
|
'ic' => ['j' => ['?_icons ic ON ic.id = sl.iconId', true], 's' => ', ic.name AS iconString'],
|
|
);
|
|
|
|
public function __construct(array $conditions = [], array $miscData = [])
|
|
{
|
|
parent::__construct($conditions, $miscData);
|
|
|
|
// post processing
|
|
foreach ($this->iterate() as &$_curTpl)
|
|
{
|
|
$_ = &$_curTpl['specializations']; // shorthand
|
|
if (!$_)
|
|
$_ = [0, 0, 0, 0, 0];
|
|
else
|
|
{
|
|
$_ = explode(' ', $_);
|
|
while (count($_) < 5)
|
|
$_[] = 0;
|
|
}
|
|
|
|
if (!$_curTpl['iconId'])
|
|
$_curTpl['iconString'] = DEFAULT_ICON;
|
|
}
|
|
}
|
|
|
|
public static function getName($id)
|
|
{
|
|
$n = DB::Aowow()->SelectRow('SELECT name_loc0, name_loc2, name_loc3, name_loc4, name_loc6, name_loc8 FROM ?_skillline WHERE id = ?d', $id);
|
|
return Util::localizedString($n, 'name');
|
|
}
|
|
|
|
public function getListviewData()
|
|
{
|
|
$data = [];
|
|
|
|
foreach ($this->iterate() as $__)
|
|
{
|
|
$data[$this->id] = array(
|
|
'category' => $this->curTpl['typeCat'],
|
|
'categorybak' => $this->curTpl['categoryId'],
|
|
'id' => $this->id,
|
|
'name' => $this->getField('name', true),
|
|
'profession' => $this->curTpl['professionMask'],
|
|
'recipeSubclass' => $this->curTpl['recipeSubClass'],
|
|
'specializations' => Util::toJSON($this->curTpl['specializations'], JSON_NUMERIC_CHECK),
|
|
'icon' => $this->curTpl['iconString']
|
|
);
|
|
}
|
|
|
|
return $data;
|
|
}
|
|
|
|
public function getJSGlobals($addMask = 0)
|
|
{
|
|
$data = [];
|
|
|
|
foreach ($this->iterate() as $__)
|
|
$data[self::$type][$this->id] = ['name' => $this->getField('name', true), 'icon' => $this->curTpl['iconString']];
|
|
|
|
return $data;
|
|
}
|
|
|
|
public function renderTooltip() { }
|
|
}
|
|
|
|
?>
|