Files
aowow/includes/class.itemset.php
Sarjuuk 3d66eacb90 implemented Itemset detail page
- while the code and strings are there, no rules have been set concerning availability

User:
 - HTTP_ACCEPT_LANGUAGE may not be set.

Compare:
 - removed some relic code, that, once uppon a time, was used to link virtual item sets with real item sets or something..

Titles:
 - fixed a few forgotten changes

Lang:
 - hide DND-entries for locks

BaseType:
 - improved getField to automaticaly cast numerics to float
 - improved __construct to check for numeric instead of int
2013-06-23 22:11:39 +02:00

88 lines
2.8 KiB
PHP

<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
class ItemsetList extends BaseType
{
use ListviewHelper;
private $classes = []; // used to build g_classes
public $pieceToSet = []; // used to build g_items and search
protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_itemset WHERE [filter] [cond] ORDER BY maxlevel DESC';
protected $matchQuery = 'SELECT COUNT(1) FROM ?_itemset WHERE [filter] [cond]';
public function __construct($data, $applyFilter = false)
{
parent::__construct($data, $applyFilter);
// post processing
while ($this->iterate())
{
$this->templates[$this->id]['classes'] = [];
$this->templates[$this->id]['pieces'] = [];
for ($i = 1; $i < 12; $i++)
{
if ($this->curTpl['classMask'] & (1 << ($i - 1)))
{
$this->classes[] = $i;
$this->templates[$this->id]['classes'][] = $i;
}
}
for ($i = 1; $i < 10; $i++)
{
if ($piece = $this->curTpl['item'.$i])
{
$this->templates[$this->id]['pieces'][] = $piece;
$this->pieceToSet[$piece] = $this->id;
}
}
}
$this->reset();
$this->classes = array_unique($this->classes);
}
public function getListviewData()
{
$data = [];
while ($this->iterate())
{
$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(&$refs)
{
if ($this->classes)
(new CharClassList(array(['id', $this->classes])))->addGlobalsToJscript($refs);
if ($this->pieceToSet)
(new ItemList(array(['i.entry', array_keys($this->pieceToSet)], 0)))->addGlobalsToJscript($refs);
}
public function addRewardsToJScript(&$ref) { }
public function renderTooltip() { }
}
?>