mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Template/Update (Part 24)
* convert dbtype 'race'
This commit is contained in:
@@ -6,76 +6,92 @@ if (!defined('AOWOW_REVISION'))
|
|||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
|
|
||||||
// menuId 13: Race g_initPath()
|
class RaceBaseResponse extends TemplateResponse implements ICache
|
||||||
// tabId 0: Database g_initHeader()
|
|
||||||
class RacePage extends GenericPage
|
|
||||||
{
|
{
|
||||||
use TrDetailPage;
|
use TrDetailPage, TrCache;
|
||||||
|
|
||||||
protected $type = Type::CHR_RACE;
|
private const MOUNT_VENDORS = array( // race => [starter, argent tournament]
|
||||||
protected $typeId = 0;
|
|
||||||
protected $tpl = 'detail-page-generic';
|
|
||||||
protected $path = [0, 13];
|
|
||||||
protected $tabId = 0;
|
|
||||||
protected $mode = CACHE_TYPE_PAGE;
|
|
||||||
protected $scripts = [[SC_JS_FILE, 'js/swfobject.js']];
|
|
||||||
|
|
||||||
public function __construct($pageCall, $id)
|
|
||||||
{
|
|
||||||
parent::__construct($pageCall, $id);
|
|
||||||
|
|
||||||
$this->typeId = intVal($id);
|
|
||||||
|
|
||||||
$this->subject = new CharRaceList(array(['id', $this->typeId]));
|
|
||||||
if ($this->subject->error)
|
|
||||||
$this->notFound(Lang::game('race'), Lang::race('notFound'));
|
|
||||||
|
|
||||||
$this->name = $this->subject->getField('name', true);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function generatePath()
|
|
||||||
{
|
|
||||||
$this->path[] = $this->typeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function generateTitle()
|
|
||||||
{
|
|
||||||
array_unshift($this->title, $this->subject->getField('name', true), Util::ucFirst(Lang::game('class')));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function generateContent()
|
|
||||||
{
|
|
||||||
$infobox = [];
|
|
||||||
$ra = ChrRace::from($this->typeId);
|
|
||||||
$mountVendors = array( // race => [starter, argent tournament]
|
|
||||||
null, [384, 33307], [3362, 33553], [1261, 33310],
|
null, [384, 33307], [3362, 33553], [1261, 33310],
|
||||||
[4730, 33653], [4731, 33555], [3685, 33556], [7955, 33650],
|
[4730, 33653], [4731, 33555], [3685, 33556], [7955, 33650],
|
||||||
[7952, 33554], null, [16264, 33557], [17584, 33657]
|
[7952, 33554], null, [16264, 33557], [17584, 33657]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
protected int $cacheType = CACHE_TYPE_PAGE;
|
||||||
|
|
||||||
|
protected string $template = 'detail-page-generic';
|
||||||
|
protected string $pageName = 'race';
|
||||||
|
protected ?int $activeTab = parent::TAB_DATABASE;
|
||||||
|
protected array $breadcrumb = [0, 13];
|
||||||
|
|
||||||
|
protected array $scripts = [[SC_JS_FILE, 'js/swfobject.js']];
|
||||||
|
|
||||||
|
public int $type = Type::CHR_RACE;
|
||||||
|
public int $typeId = 0;
|
||||||
|
public ?string $expansion = null;
|
||||||
|
|
||||||
|
private CharRaceList $subject;
|
||||||
|
|
||||||
|
public function __construct(string $id)
|
||||||
|
{
|
||||||
|
parent::__construct($id);
|
||||||
|
|
||||||
|
$this->typeId = intVal($id);
|
||||||
|
$this->contribute = Type::getClassAttrib($this->type, 'contribute') ?? CONTRIBUTE_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function generate() : void
|
||||||
|
{
|
||||||
|
$this->subject = new CharRaceList(array(['id', $this->typeId]));
|
||||||
|
if ($this->subject->error)
|
||||||
|
$this->generateNotFound(Lang::game('race'), Lang::race('notFound'));
|
||||||
|
|
||||||
|
$this->h1 = $this->subject->getField('name', true);
|
||||||
|
|
||||||
|
$this->gPageInfo += array(
|
||||||
|
'type' => $this->type,
|
||||||
|
'typeId' => $this->typeId,
|
||||||
|
'name' => $this->h1
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/*************/
|
||||||
|
/* Menu Path */
|
||||||
|
/*************/
|
||||||
|
|
||||||
|
$this->breadcrumb[] = $this->typeId;
|
||||||
|
|
||||||
|
|
||||||
|
/**************/
|
||||||
|
/* Page Title */
|
||||||
|
/**************/
|
||||||
|
|
||||||
|
array_unshift($this->title, $this->h1, Util::ucFirst(Lang::game('race')));
|
||||||
|
|
||||||
|
|
||||||
/***********/
|
/***********/
|
||||||
/* Infobox */
|
/* Infobox */
|
||||||
/***********/
|
/***********/
|
||||||
|
|
||||||
|
$ra = ChrRace::from($this->typeId);
|
||||||
|
|
||||||
$infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
|
$infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
|
||||||
|
|
||||||
// side
|
// side
|
||||||
if ($_ = $this->subject->getField('side'))
|
if ($_ = $this->subject->getField('side'))
|
||||||
$infobox[] = Lang::main('side').Lang::main('colon').'[span class=icon-'.($_ == SIDE_HORDE ? 'horde' : 'alliance').']'.Lang::game('si', $_).'[/span]';
|
$infobox[] = Lang::main('side').'[span class=icon-'.($_ == SIDE_HORDE ? 'horde' : 'alliance').']'.Lang::game('si', $_).'[/span]';
|
||||||
|
|
||||||
// faction
|
// faction
|
||||||
if ($_ = $this->subject->getField('factionId'))
|
if ($_ = $this->subject->getField('factionId'))
|
||||||
{
|
{
|
||||||
$fac = new FactionList(array(['f.id', $_]));
|
$this->extendGlobalIds(Type::FACTION, $_);
|
||||||
$this->extendGlobalData($fac->getJSGlobals());
|
$infobox[] = Util::ucFirst(Lang::game('faction')).Lang::main('colon').'[faction='.$_.']';
|
||||||
$infobox[] = Util::ucFirst(Lang::game('faction')).Lang::main('colon').'[faction='.$fac->id.']';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// leader
|
// leader
|
||||||
if ($_ = $this->subject->getField('leader'))
|
if ($_ = $this->subject->getField('leader'))
|
||||||
{
|
{
|
||||||
$this->extendGlobalIds(Type::NPC, $_);
|
$this->extendGlobalIds(Type::NPC, $_);
|
||||||
$infobox[] = Lang::race('racialLeader').Lang::main('colon').'[npc='.$_.']';
|
$infobox[] = Lang::race('racialLeader').'[npc='.$_.']';
|
||||||
}
|
}
|
||||||
|
|
||||||
// start area
|
// start area
|
||||||
@@ -85,12 +101,14 @@ class RacePage extends GenericPage
|
|||||||
$infobox[] = Lang::race('startZone').Lang::main('colon').'[zone='.$_.']';
|
$infobox[] = Lang::race('startZone').Lang::main('colon').'[zone='.$_.']';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($infobox)
|
||||||
|
$this->infobox = new InfoboxMarkup($infobox, ['allow' => Markup::CLASS_STAFF, 'dbpage' => true], 'infobox-contents0');
|
||||||
|
|
||||||
|
|
||||||
/****************/
|
/****************/
|
||||||
/* Main Content */
|
/* Main Content */
|
||||||
/****************/
|
/****************/
|
||||||
|
|
||||||
$this->infobox = '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]';
|
|
||||||
$this->expansion = Util::$expansionString[$this->subject->getField('expansion')];
|
$this->expansion = Util::$expansionString[$this->subject->getField('expansion')];
|
||||||
$this->headIcons = ['race_'.$ra->json().'_male', 'race_'.$ra->json().'_female'];
|
$this->headIcons = ['race_'.$ra->json().'_male', 'race_'.$ra->json().'_female'];
|
||||||
$this->redButtons = array(
|
$this->redButtons = array(
|
||||||
@@ -103,12 +121,14 @@ class RacePage extends GenericPage
|
|||||||
/* Extra Tabs */
|
/* Extra Tabs */
|
||||||
/**************/
|
/**************/
|
||||||
|
|
||||||
|
$this->lvTabs = new Tabs(['parent' => "\$\$WH.ge('tabs-generic')"], 'tabsRelated', true);
|
||||||
|
|
||||||
// Classes
|
// Classes
|
||||||
$classes = new CharClassList(array(['racemask', $ra->toMask(), '&']));
|
$classes = new CharClassList(array(['racemask', $ra->toMask(), '&']));
|
||||||
if (!$classes->error)
|
if (!$classes->error)
|
||||||
{
|
{
|
||||||
$this->extendGlobalData($classes->getJSGlobals());
|
$this->extendGlobalData($classes->getJSGlobals());
|
||||||
$this->lvTabs[] = [CharClassList::$brickFile, ['data' => array_values($classes->getListviewData())]];
|
$this->lvTabs->addListviewTab(new Listview(['data' => $classes->getListviewData()], CharClassList::$brickFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tongues
|
// Tongues
|
||||||
@@ -121,12 +141,12 @@ class RacePage extends GenericPage
|
|||||||
if (!$tongues->error)
|
if (!$tongues->error)
|
||||||
{
|
{
|
||||||
$this->extendGlobalData($tongues->getJSGlobals());
|
$this->extendGlobalData($tongues->getJSGlobals());
|
||||||
$this->lvTabs[] = [SpellList::$brickFile, array(
|
$this->lvTabs->addListviewTab(new Listview(array(
|
||||||
'data' => array_values($tongues->getListviewData()),
|
'data' => $tongues->getListviewData(),
|
||||||
'id' => 'languages',
|
'id' => 'languages',
|
||||||
'name' => '$LANG.tab_languages',
|
'name' => '$LANG.tab_languages',
|
||||||
'hiddenCols' => ['reagents']
|
'hiddenCols' => ['reagents']
|
||||||
)];
|
), SpellList::$brickFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Racials
|
// Racials
|
||||||
@@ -140,16 +160,15 @@ class RacePage extends GenericPage
|
|||||||
{
|
{
|
||||||
$this->extendGlobalData($racials->getJSGlobals());
|
$this->extendGlobalData($racials->getJSGlobals());
|
||||||
$tabData = array(
|
$tabData = array(
|
||||||
'data' => array_values($racials->getListviewData()),
|
'data' => $racials->getListviewData(),
|
||||||
'id' => 'racial-traits',
|
'id' => 'racial-traits',
|
||||||
'name' => '$LANG.tab_racialtraits',
|
'name' => '$LANG.tab_racialtraits',
|
||||||
'hiddenCols' => ['reagents']
|
'hiddenCols' => ['reagents']
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($racials->hasDiffFields('reqClassMask'))
|
if ($racials->hasDiffFields('reqClassMask'))
|
||||||
$tabData['visibleCols'] = ['classes'];
|
$tabData['visibleCols'] = ['classes'];
|
||||||
|
|
||||||
$this->lvTabs[] = [SpellList::$brickFile, $tabData];
|
$this->lvTabs->addListviewTab(new Listview($tabData, SpellList::$brickFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Quests
|
// Quests
|
||||||
@@ -163,13 +182,15 @@ class RacePage extends GenericPage
|
|||||||
if (!$quests->error)
|
if (!$quests->error)
|
||||||
{
|
{
|
||||||
$this->extendGlobalData($quests->getJSGlobals());
|
$this->extendGlobalData($quests->getJSGlobals());
|
||||||
$this->lvTabs[] = [QuestList::$brickFile, ['data' => array_values($quests->getListviewData())]];
|
$this->lvTabs->addListviewTab(new Listview(['data' => $quests->getListviewData()], QuestList::$brickFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mounts
|
// Mounts
|
||||||
// ok, this sucks, but i rather hardcode the trainer, than fetch items by namepart
|
// ok, this sucks, but i rather hardcode the trainer, than fetch items by namepart
|
||||||
$items = isset($mountVendors[$this->typeId]) ? DB::World()->selectCol('SELECT `item` FROM npc_vendor WHERE `entry` IN (?a)', $mountVendors[$this->typeId]) : 0;
|
if (isset(self::MOUNT_VENDORS[$this->typeId]))
|
||||||
|
{
|
||||||
|
if ($items = DB::World()->selectCol('SELECT `item` FROM npc_vendor WHERE `entry` IN (?a)', self::MOUNT_VENDORS[$this->typeId]))
|
||||||
|
{
|
||||||
$conditions = array(
|
$conditions = array(
|
||||||
['i.id', $items],
|
['i.id', $items],
|
||||||
['i.class', ITEM_CLASS_MISC],
|
['i.class', ITEM_CLASS_MISC],
|
||||||
@@ -180,12 +201,14 @@ class RacePage extends GenericPage
|
|||||||
if (!$mounts->error)
|
if (!$mounts->error)
|
||||||
{
|
{
|
||||||
$this->extendGlobalData($mounts->getJSGlobals());
|
$this->extendGlobalData($mounts->getJSGlobals());
|
||||||
$this->lvTabs[] = [ItemList::$brickFile, array(
|
$this->lvTabs->addListviewTab(new Listview(array(
|
||||||
'data' => array_values($mounts->getListviewData()),
|
'data' => $mounts->getListviewData(),
|
||||||
'id' => 'mounts',
|
'id' => 'mounts',
|
||||||
'name' => '$LANG.tab_mounts',
|
'name' => '$LANG.tab_mounts',
|
||||||
'hiddenCols' => ['slot', 'type']
|
'hiddenCols' => ['slot', 'type']
|
||||||
)];
|
), ItemList::$brickFile));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sounds
|
// Sounds
|
||||||
@@ -199,10 +222,10 @@ class RacePage extends GenericPage
|
|||||||
foreach ($data as $id => &$d)
|
foreach ($data as $id => &$d)
|
||||||
$d['gender'] = $vo[$id];
|
$d['gender'] = $vo[$id];
|
||||||
|
|
||||||
$this->lvTabs[] = [SoundList::$brickFile, array(
|
$this->lvTabs->addListviewTab(new Listview(array(
|
||||||
'data' => array_values($data),
|
'data' => $data,
|
||||||
'extraCols' => ['$Listview.templates.title.columns[1]']
|
'extraCols' => ['$Listview.templates.title.columns[1]']
|
||||||
)];
|
), SoundList::$brickFile));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,8 +235,10 @@ class RacePage extends GenericPage
|
|||||||
if ($tab = $cnd->toListviewTab('condition-for', '$LANG.tab_condition_for'))
|
if ($tab = $cnd->toListviewTab('condition-for', '$LANG.tab_condition_for'))
|
||||||
{
|
{
|
||||||
$this->extendGlobalData($cnd->getJsGlobals());
|
$this->extendGlobalData($cnd->getJsGlobals());
|
||||||
$this->lvTabs[] = $tab;
|
$this->lvTabs->addDataTab(...$tab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parent::generate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
52
endpoints/races/races.php
Normal file
52
endpoints/races/races.php
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Aowow;
|
||||||
|
|
||||||
|
if (!defined('AOWOW_REVISION'))
|
||||||
|
die('illegal access');
|
||||||
|
|
||||||
|
|
||||||
|
class RacesBaseResponse extends TemplateResponse implements ICache
|
||||||
|
{
|
||||||
|
use TrListPage, TrCache;
|
||||||
|
|
||||||
|
protected int $type = Type::CHR_RACE;
|
||||||
|
protected int $cacheType = CACHE_TYPE_PAGE;
|
||||||
|
|
||||||
|
protected string $template = 'list-page-generic';
|
||||||
|
protected string $pageName = 'races';
|
||||||
|
protected ?int $activeTab = parent::TAB_DATABASE;
|
||||||
|
protected array $breadcrumb = [0, 13];
|
||||||
|
|
||||||
|
public function __construct(string $pageParam)
|
||||||
|
{
|
||||||
|
$this->getCategoryFromUrl($pageParam);
|
||||||
|
|
||||||
|
parent::__construct($pageParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function generate() : void
|
||||||
|
{
|
||||||
|
$this->h1 = Util::ucFirst(Lang::game('races'));
|
||||||
|
|
||||||
|
|
||||||
|
array_unshift($this->title, $this->h1);
|
||||||
|
|
||||||
|
|
||||||
|
$this->redButtons[BUTTON_WOWHEAD] = true;
|
||||||
|
|
||||||
|
$conditions = [];
|
||||||
|
if (!User::isInGroup(U_GROUP_EMPLOYEE))
|
||||||
|
$conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
|
||||||
|
|
||||||
|
$this->lvTabs = new Tabs(['parent' => "\$\$WH.ge('tabs-generic')"]);
|
||||||
|
|
||||||
|
$races = new CharRaceList($conditions);
|
||||||
|
if (!$races->error)
|
||||||
|
$this->lvTabs->addListviewTab(new Listview(['data' => $races->getListviewData()], CharRaceList::$brickFile));
|
||||||
|
|
||||||
|
parent::generate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -1175,7 +1175,7 @@ $lang = array(
|
|||||||
),
|
),
|
||||||
'race' => array(
|
'race' => array(
|
||||||
'notFound' => "Dieses Volk existiert nicht.",
|
'notFound' => "Dieses Volk existiert nicht.",
|
||||||
'racialLeader' => "Volksanführer",
|
'racialLeader' => "Volksanführer: ",
|
||||||
'startZone' => "Startgebiet",
|
'startZone' => "Startgebiet",
|
||||||
),
|
),
|
||||||
'maps' => array(
|
'maps' => array(
|
||||||
|
|||||||
@@ -1175,7 +1175,7 @@ $lang = array(
|
|||||||
),
|
),
|
||||||
'race' => array(
|
'race' => array(
|
||||||
'notFound' => "This race doesn't exist.",
|
'notFound' => "This race doesn't exist.",
|
||||||
'racialLeader' => "Racial leader",
|
'racialLeader' => "Racial leader: ",
|
||||||
'startZone' => "Starting zone",
|
'startZone' => "Starting zone",
|
||||||
),
|
),
|
||||||
'maps' => array(
|
'maps' => array(
|
||||||
|
|||||||
@@ -1175,7 +1175,7 @@ $lang = array(
|
|||||||
),
|
),
|
||||||
'race' => array(
|
'race' => array(
|
||||||
'notFound' => "Esta raza no existe.",
|
'notFound' => "Esta raza no existe.",
|
||||||
'racialLeader' => "Lider racial",
|
'racialLeader' => "Lider racial: ",
|
||||||
'startZone' => "Zona de inicio",
|
'startZone' => "Zona de inicio",
|
||||||
),
|
),
|
||||||
'maps' => array(
|
'maps' => array(
|
||||||
|
|||||||
@@ -1175,7 +1175,7 @@ $lang = array(
|
|||||||
),
|
),
|
||||||
'race' => array(
|
'race' => array(
|
||||||
'notFound' => "Cette race n'existe pas.",
|
'notFound' => "Cette race n'existe pas.",
|
||||||
'racialLeader' => "Leader racial",
|
'racialLeader' => "Leader racial : ",
|
||||||
'startZone' => "Zone initiales",
|
'startZone' => "Zone initiales",
|
||||||
),
|
),
|
||||||
'maps' => array(
|
'maps' => array(
|
||||||
|
|||||||
@@ -1175,7 +1175,7 @@ $lang = array(
|
|||||||
),
|
),
|
||||||
'race' => array(
|
'race' => array(
|
||||||
'notFound' => "Такая раса не существует.",
|
'notFound' => "Такая раса не существует.",
|
||||||
'racialLeader' => "Лидер расы",
|
'racialLeader' => "Лидер расы: ",
|
||||||
'startZone' => "Начальная локация",
|
'startZone' => "Начальная локация",
|
||||||
),
|
),
|
||||||
'maps' => array(
|
'maps' => array(
|
||||||
|
|||||||
@@ -1174,7 +1174,7 @@ $lang = array(
|
|||||||
),
|
),
|
||||||
'race' => array(
|
'race' => array(
|
||||||
'notFound' => "这个种族不存在。",
|
'notFound' => "这个种族不存在。",
|
||||||
'racialLeader' => "种族领袖",
|
'racialLeader' => "种族领袖:",
|
||||||
'startZone' => "起始区域"
|
'startZone' => "起始区域"
|
||||||
),
|
),
|
||||||
'maps' => array(
|
'maps' => array(
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Aowow;
|
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
|
||||||
die('illegal access');
|
|
||||||
|
|
||||||
|
|
||||||
// menuId 13: Race g_initPath()
|
|
||||||
// tabId 0: Database g_initHeader()
|
|
||||||
class RacesPage extends GenericPage
|
|
||||||
{
|
|
||||||
use TrListPage;
|
|
||||||
|
|
||||||
protected $type = Type::CHR_RACE;
|
|
||||||
protected $tpl = 'list-page-generic';
|
|
||||||
protected $path = [0, 13];
|
|
||||||
protected $tabId = 0;
|
|
||||||
protected $mode = CACHE_TYPE_PAGE;
|
|
||||||
|
|
||||||
public function __construct($pageCall, $pageParam)
|
|
||||||
{
|
|
||||||
parent::__construct($pageCall, $pageParam);
|
|
||||||
|
|
||||||
$this->name = Util::ucFirst(Lang::game('races'));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function generateContent()
|
|
||||||
{
|
|
||||||
$conditions = [];
|
|
||||||
|
|
||||||
if (!User::isInGroup(U_GROUP_EMPLOYEE))
|
|
||||||
$conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
|
|
||||||
|
|
||||||
$data = [];
|
|
||||||
$races = new CharRaceList($conditions);
|
|
||||||
if (!$races->error)
|
|
||||||
$data = array_values($races->getListviewData());
|
|
||||||
|
|
||||||
$this->lvTabs[] = [CharRaceList::$brickFile, ['data' => $data]];
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function generateTitle()
|
|
||||||
{
|
|
||||||
array_unshift($this->title, Util::ucFirst(Lang::game('races')));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function generatePath() {}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
Reference in New Issue
Block a user