mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
- rewrote BaseType::iterate() to be a generator and yield references (requires php 5.5) - reduced usage of bandaid BaseType::reset() - removed Util::getIdFieldName() which was even more of a bandaid - discovered DBSimple::selectPage() and consequently removed $matchQuery as they are now obsoloete Util: - added trainerTemplate lists for future use with trainers and trained spells misc. forgotten and/or broken stuff here and there
86 lines
2.7 KiB
PHP
86 lines
2.7 KiB
PHP
<?php
|
|
|
|
if (!defined('AOWOW_REVISION'))
|
|
die('illegal access');
|
|
|
|
class ItemsetList extends BaseType
|
|
{
|
|
use ListviewHelper;
|
|
|
|
public static $type = TYPE_ITEMSET;
|
|
|
|
public $pieceToSet = []; // used to build g_items and search
|
|
private $classes = []; // used to build g_classes
|
|
|
|
protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_itemset WHERE [filter] [cond] ORDER BY maxlevel DESC';
|
|
|
|
public function __construct($data, $applyFilter = false)
|
|
{
|
|
parent::__construct($data, $applyFilter);
|
|
|
|
// post processing
|
|
foreach ($this->iterate() as &$_curTpl)
|
|
{
|
|
$_curTpl['classes'] = [];
|
|
$_curTpl['pieces'] = [];
|
|
for ($i = 1; $i < 12; $i++)
|
|
{
|
|
if ($_curTpl['classMask'] & (1 << ($i - 1)))
|
|
{
|
|
$this->classes[] = $i;
|
|
$_curTpl['classes'][] = $i;
|
|
}
|
|
}
|
|
|
|
for ($i = 1; $i < 10; $i++)
|
|
{
|
|
if ($piece = $_curTpl['item'.$i])
|
|
{
|
|
$_curTpl['pieces'][] = $piece;
|
|
$this->pieceToSet[$piece] = $this->id;
|
|
}
|
|
}
|
|
}
|
|
$this->classes = array_unique($this->classes);
|
|
}
|
|
|
|
public function getListviewData()
|
|
{
|
|
$data = [];
|
|
|
|
foreach ($this->iterate() as $__)
|
|
{
|
|
$data[$this->id] = array(
|
|
'id' => $this->id,
|
|
'idbak' => $this->curTpl['refSetId'],
|
|
'name' => $this->getField('name', true),
|
|
'quality' => 7 - $this->curTpl['quality'],
|
|
'minlevel' => $this->curTpl['minLevel'],
|
|
'maxlevel' => $this->curTpl['maxLevel'],
|
|
'note' => $this->curTpl['contentGroup'],
|
|
'type' => $this->curTpl['type'],
|
|
'heroic' => $this->curTpl['heroic'] == 1, // we want to be bool
|
|
'reqclass' => $this->curTpl['classMask'],
|
|
'classes' => $this->curTpl['classes'],
|
|
'pieces' => $this->curTpl['pieces'],
|
|
'heroic' => $this->curTpl['heroic']
|
|
);
|
|
}
|
|
|
|
return $data;
|
|
}
|
|
|
|
public function addGlobalsToJscript(&$template, $addMask = GLOBALINFO_ANY)
|
|
{
|
|
if ($this->classes && ($addMask & GLOBALINFO_RELATED))
|
|
$template->extendGlobalIds(TYPE_CLASS, $this->classes);
|
|
|
|
if ($this->pieceToSet && ($addMask & GLOBALINFO_SELF))
|
|
$template->extendGlobalIds(TYPE_ITEM, array_keys($this->pieceToSet));
|
|
}
|
|
|
|
public function renderTooltip() { }
|
|
}
|
|
|
|
?>
|