mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
I'm not overly happy with passing the templateObject to each typeObject, but it works .. for now. Effectively this should reduce db-lookups as each type should be looked up only twice at max (once for relevant data on the page and maybe again to get related jsGlobals for the template) also removed BaseType::addRewardsToJscript() get it with BaseType::addGlobalsToJscript() and the appropriate addMask * added ListviewHelper::getSetFields() wich is more appropriate in some cases (like reagents for spells should be shown even if they are all the same) * load bricks as needed, removed the if-blocks (maybe add the filename to every TypeClass..?)
50 lines
1.5 KiB
PHP
50 lines
1.5 KiB
PHP
<?php
|
|
|
|
if (!defined('AOWOW_REVISION'))
|
|
die('illegal access');
|
|
|
|
class CharClassList extends BaseType
|
|
{
|
|
public static $type = TYPE_CLASS;
|
|
|
|
protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_classes WHERE [cond] ORDER BY Id ASC';
|
|
protected $matchQuery = 'SELECT COUNT(1) FROM ?_classes WHERE [cond]';
|
|
|
|
public function getListviewData()
|
|
{
|
|
$data = [];
|
|
|
|
while ($this->iterate())
|
|
{
|
|
$data[$this->id] = array(
|
|
'id' => $this->id,
|
|
'name' => $this->getField('name', true),
|
|
'races' => $this->curTpl['raceMask'],
|
|
'roles' => $this->curTpl['roles'],
|
|
'weapon' => $this->curTpl['weaponTypeMask'],
|
|
'armor' => $this->curTpl['armorTypeMask'],
|
|
'power' => $this->curTpl['powerType'],
|
|
);
|
|
|
|
if ($this->curTpl['expansion'] == 2) // todo (low): grr, move to db
|
|
$data[$this->id]['hero'] = 1;
|
|
|
|
if ($this->curTpl['expansion'])
|
|
$data[$this->id]['expansion'] = $this->curTpl['expansion'];
|
|
}
|
|
|
|
return $data;
|
|
}
|
|
|
|
public function addGlobalsToJscript(&$template, $addMask = 0)
|
|
{
|
|
while ($this->iterate())
|
|
$template->extendGlobalData(self::$type, [$this->id => ['name' => $this->getField('name', true)]]);
|
|
}
|
|
|
|
public function addRewardsToJScript(&$ref) { }
|
|
public function renderTooltip() { }
|
|
}
|
|
|
|
?>
|