aowow/includes/class.itemset.php
Sarjuuk 684b2f2778 - Tooltip class from global.js to basic.js (added nessecary prefix)
- miscTools:
    * implemented random DB-Page
    * others are placeholder (at least no errors are generated)
- Articles / Infobox:
    * dropped aowow_article_items, parse nessecary globals directly from article or infobox
    * articles default back to english if no target articles is absent
    * quickinfo from db is only used if no auto-generated info is available
- CharClass:
    * implemented detail-page
    * added basic articles per class (english only)
- generic lv-page
    * now accepts multiple listviews (as required by miscTools)
    * can display text and title
- Markup.js:
    * exchanged to current version (yet to be looked over, but basic articles are displayed properly for now)
    * removed some hacks that were nessecary for the old Markup / Menu
- Listview
    * made some more code readeable, no major changes
    * calendar-template is now functional (WorldEvents use it)

...squashing bugs left and right
2013-09-01 15:37:40 +02:00

85 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($conditions = [], $applyFilter = false)
{
parent::__construct($conditions, $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() { }
}
?>