mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Implement Titles
and while doing so... - decrypted listview.templates - achievemnts, quests, titles - removed ancient hacks for Opera from JS wich prevented capturing of some Key/Mouse-Events in Opera Pease note, that the CharTitles.dbc alone doesn't provide enough data to generate these pages. The script to generate ?_titles and ?_sourceStrings will be provided soon [TM]
This commit is contained in:
75
includes/class.title.php
Normal file
75
includes/class.title.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
if (!defined('AOWOW_REVISION'))
|
||||
die('illegal access');
|
||||
|
||||
class Title extends BaseType
|
||||
{
|
||||
public $name = [];
|
||||
public $source = [];
|
||||
|
||||
protected $setupQuery = "SELECT * FROM ?_titles WHERE `Id` = ?";
|
||||
|
||||
public function __construct($data)
|
||||
{
|
||||
parent::__construct($data);
|
||||
|
||||
// post processing
|
||||
$this->name[GENDER_MALE] = Util::localizedString($this->template, 'male');
|
||||
if ($this->template['female_loc0'] || $this->template['female_loc'.User::$localeId])
|
||||
$this->name[GENDER_FEMALE] = Util::localizedString($this->template, 'female');
|
||||
|
||||
// preparse sources
|
||||
if (!empty($this->template['source']))
|
||||
{
|
||||
$sources = explode(' ', $this->template['source']);
|
||||
foreach ($sources as $src)
|
||||
{
|
||||
$src = explode(':', $src);
|
||||
$this->source[$src[0]][] = $src[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getListviewData()
|
||||
{
|
||||
$data = array(
|
||||
'id' => $this->Id,
|
||||
'name' => $this->name[GENDER_MALE],
|
||||
'side' => $this->template['side'],
|
||||
'gender' => $this->template['gender'],
|
||||
'expansion' => $this->template['expansion'],
|
||||
'category' => $this->template['category'],
|
||||
'source' => $this->source
|
||||
);
|
||||
|
||||
if (isset($this->name[GENDER_FEMALE]))
|
||||
$data['namefemale'] = $this->name[GENDER_FEMALE];
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function addSelfToJScript(&$gTitles)
|
||||
{
|
||||
$gTitles[$this->Id] = ['name' => Util::jsEscape($this->name[GENDER_MALE])];
|
||||
|
||||
if (isset($this->name[GENDER_FEMALE]))
|
||||
$gTitles[$this->Id]['namefemale'] = Util::jsEscape($this->name[GENDER_FEMALE]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getHtmlizedName($gender = GENDER_MALE)
|
||||
{
|
||||
return str_replace('%s', '<span class="q0"><Name></span>', $this->name[$gender]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
class TitleList extends BaseTypeList
|
||||
{
|
||||
protected $setupQuery = 'SELECT *, Id AS ARRAY_KEY FROM ?_titles WHERE [cond] ORDER BY Id ASC';
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user