mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
- implemented factions basics (search, listview and details)
- added forgotten shared brick for tooltips
This commit is contained in:
@@ -6,7 +6,33 @@ if (!defined('AOWOW_REVISION'))
|
||||
|
||||
class FactionList extends BaseType
|
||||
{
|
||||
public static $type = TYPE_FACTION;
|
||||
public static $type = TYPE_FACTION;
|
||||
|
||||
protected $queryBase = 'SELECT f1.*, f1.id AS ARRAY_KEY, f1.parentFactionId AS cat FROM ?_factions f1';
|
||||
protected $queryOpts = array(
|
||||
'f1' => [['f2']],
|
||||
'f2' => ['j' => ['?_factions f2 ON f1.parentFactionId = f2.id', true], 's' => ', IFNULL(f2.parentFactionId, 0) AS cat2']
|
||||
);
|
||||
|
||||
public function __construct($conditions = [])
|
||||
{
|
||||
parent::__construct($conditions);
|
||||
|
||||
if ($this->error)
|
||||
return;
|
||||
|
||||
// post processing
|
||||
foreach ($this->iterate() as &$_curTpl)
|
||||
{
|
||||
// prepare factionTemplates
|
||||
if ($_curTpl['templateIds'])
|
||||
$_curTpl['templateIds'] = explode(' ', $_curTpl['templateIds']);
|
||||
|
||||
// prepare quartermaster
|
||||
if ($_curTpl['qmNpcIds'])
|
||||
$_curTpl['qmNpcIds'] = explode(' ', $_curTpl['qmNpcIds']);
|
||||
}
|
||||
}
|
||||
|
||||
public static function getName($id)
|
||||
{
|
||||
@@ -20,24 +46,37 @@ class FactionList extends BaseType
|
||||
FROM
|
||||
?_factions
|
||||
WHERE
|
||||
factionID = ?d',
|
||||
id = ?d',
|
||||
$id
|
||||
);
|
||||
return Util::localizedString($n, 'name');
|
||||
}
|
||||
|
||||
public function reactsAgainst($faction)
|
||||
public function getListviewData()
|
||||
{
|
||||
// see factionTemplate
|
||||
/*
|
||||
1: friendly
|
||||
0: neutral
|
||||
-1: hostile
|
||||
*/
|
||||
$data = [];
|
||||
|
||||
foreach ($this->iterate() as $__)
|
||||
{
|
||||
$data[$this->id] = array(
|
||||
'category' => $this->curTpl['cat'],
|
||||
'category2' => $this->curTpl['cat2'],
|
||||
'expansion' => $this->curTpl['expansion'],
|
||||
'id' => $this->id,
|
||||
'side' => $this->curTpl['side'],
|
||||
'name' => $this->getField('name', true)
|
||||
);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function addGlobalsToJScript(&$template, $addMask = 0)
|
||||
{
|
||||
foreach ($this->iterate() as $__)
|
||||
$template->extendGlobalData(self::$type, [$this->id => ['name' => $this->getField('name', true)]]);
|
||||
}
|
||||
|
||||
public function getListviewData() { }
|
||||
public function addGlobalsToJScript(&$template, $addMask = 0) { }
|
||||
public function renderTooltip() { }
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user