removing smarty - part III

- convert first pages to extend GenericPage (Race/s; Class/es; Main)
- added new stack-rule from TC to spells
This commit is contained in:
Sarjuuk
2014-06-15 22:00:01 +02:00
parent 3347778e4c
commit a5ae244216
17 changed files with 507 additions and 463 deletions

View File

@@ -6,8 +6,7 @@ if (!defined('AOWOW_REVISION'))
trait DetailPage
{
// require 'includes/community.class.php';
protected $hasComContent = true;
function generateCacheKey($cacheType, $params = '-1')
{
@@ -53,7 +52,6 @@ class GenericPage
protected $name = ''; // for h1-Element
protected $tabId = 0;
protected $community = ['co' => [], 'sc' => [], 'vi' => []];
protected $hasComContent = false;
private $js = [];
private $css = [];
@@ -103,7 +101,7 @@ class GenericPage
$this->saveCache();
}
if ($this->hasComContent)
if (!empty($this->hasComContent))
$this->community = CommunityContent::getAll($this->type, $this->typeId);
$this->mysql = DB::Aowow()->getStatistics();

View File

@@ -12,7 +12,8 @@ class FactionList extends BaseType
protected $queryBase = 'SELECT f.*, f.parentFactionId AS cat2, f.id AS ARRAY_KEY FROM ?_factions f';
protected $queryOpts = array(
'f' => [['f2']],
'f2' => ['j' => ['?_factions f2 ON f.parentFactionId = f2.id', true], 's' => ', IFNULL(f2.parentFactionId, 0) AS cat']
'f2' => ['j' => ['?_factions f2 ON f.parentFactionId = f2.id', true], 's' => ', IFNULL(f2.parentFactionId, 0) AS cat'],
'ft' => ['j' => '?_factiontemplate ft ON ft.factionId = f.id']
);
public function __construct($conditions = [])

View File

@@ -15,19 +15,16 @@ require 'includes/kernel.php';
if (version_compare(PHP_VERSION, '5.4.0') <= 0)
{
if (User::isInGroup(U_GROUP_EMPLOYEE))
$smarty->internalNotice(U_GROUP_EMPLOYEE, 'PHP Version 5.4.0 or higher required! Your version is '.PHP_VERSION."\nCore functions are unavailable!");
Util::addNote(U_GROUP_EMPLOYEE, 'PHP Version 5.4.0 or higher required! Your version is '.PHP_VERSION."[br]Core functions are unavailable!");
else
$smarty->brb();
(new GenericPage)->maintenance();
}
if (CFG_MAINTENANCE && !User::isInGroup(U_GROUP_EMPLOYEE))
$smarty->brb();
else if (CFG_MAINTENANCE && User::isInGroup(U_GROUP_EMPLOYEE))
$smarty->internalNotice(U_GROUP_EMPLOYEE, 'Maintenance mode enabled!');
switch ($pageCall)
{
/* called by user */
case '': // no parameter given -> MainPage
$pageCall = 'main';
case 'account': // account management [nyi]
case 'achievement':
case 'achievements':
@@ -73,15 +70,10 @@ switch ($pageCall)
case 'user': // tool: user profiles [nyi]
case 'zone':
case 'zones':
if (file_exists('pages/'.$pageCall.'.php'))
require 'pages/'.$pageCall.'.php';
else
$smarty->error();
$_ = $pageCall.'Page';
new $_($pageParam);
break;
/* other pages */
case '': // no parameter given -> MainPage
require 'pages/main.php';
break;
case 'whats-new':
case 'searchplugins':
case 'searchbox':
@@ -89,7 +81,7 @@ switch ($pageCall)
case 'help':
case 'faq':
case 'aboutus':
require 'pages/more.php';
new MorePage($pageCall);
break;
case 'latest-additions':
case 'latest-articles':
@@ -141,7 +133,7 @@ switch ($pageCall)
if (isset($_GET['power']))
die('$WowheadPower.register(0, '.User::$localeId.', {})');
else // in conjunction with a propper rewriteRule in .htaccess...
$smarty->error();
(new GenericPage)->error();
break;
}

View File

@@ -4,87 +4,108 @@ if (!defined('AOWOW_REVISION'))
die('illegal access');
require 'includes/community.class.php';
$_id = intVal($pageParam);
$_mask = 1 << ($_id - 1);
$_path = [0, 12, $_id];
$tcClassId = [null, 8, 3, 1, 5, 4, 9, 6, 2, 7, null, 0]; // see TalentCalc.js
$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_CLASS, $_id, -1, User::$localeId]);
if (!$smarty->loadCache($cacheKeyPage, $pageData))
// menuId 12: Class g_initPath()
// tabId 0: Database g_initHeader()
class ClassPage extends GenericPage
{
$cl = new CharClassList(array(['id', $_id]));
if ($cl->error)
$smarty->notFound(Lang::$game['class'], $_id);
use DetailPage;
protected $type = TYPE_CLASS;
protected $typeId = 0;
protected $tpl = 'detail-page-generic';
protected $path = [0, 12];
protected $tabId = 0;
protected $mode = CACHETYPE_PAGE;
protected $js = ['swfobject.js'];
public function __construct($id)
{
$this->typeId = intVal($id);
$this->subject = new CharClassList(array(['id', $id]));
if ($this->subject->error)
$this->notFound(Lang::$game['class']);
$this->name = $this->subject->getField('name', true);
$this->gPageInfo = array(
'type' => $this->type,
'typeId' => $this->typeId,
'name' => $this->name
);
parent::__construct();
}
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 = [];
$_mask = 1 << ($this->typeId - 1);
$tcClassId = [null, 8, 3, 1, 5, 4, 9, 6, 2, 7, null, 0]; // see TalentCalc.js
/***********/
/* Infobox */
/***********/
$infobox = [];
// hero class
if ($cl->getField('flags') & 0x40)
if ($this->subject->getField('flags') & 0x40)
$infobox[] = '[tooltip=tooltip_heroclass]'.Lang::$game['heroClass'].'[/tooltip]';
// resource
if ($_id == 11) // special Druid case
$infobox[] = Lang::$game['resources'].Lang::$colon.
if ($this->typeId == 11) // special Druid case
$infobox[] = Lang::$game['resources'].Lang::$main['colon'].
'[tooltip name=powertype1]'.Lang::$game['st'][0].', '.Lang::$game['st'][31].', '.Lang::$game['st'][2].'[/tooltip][span class=tip tooltip=powertype1]'.Util::ucFirst(Lang::$spell['powerTypes'][0]).'[/span], '.
'[tooltip name=powertype2]'.Lang::$game['st'][5].', '.Lang::$game['st'][8].'[/tooltip][span class=tip tooltip=powertype2]'.Util::ucFirst(Lang::$spell['powerTypes'][1]).'[/span], '.
'[tooltip name=powertype8]'.Lang::$game['st'][1].'[/tooltip][span class=tip tooltip=powertype8]'.Util::ucFirst(Lang::$spell['powerTypes'][3]).'[/span]';
else if ($_id == 6) // special DK case
$infobox[] = Lang::$game['resources'].Lang::$colon.'[span]'.Util::ucFirst(Lang::$spell['powerTypes'][5]).', '.Util::ucFirst(Lang::$spell['powerTypes'][$cl->getField('powerType')]).'[/span]';
else if ($this->typeId == 6) // special DK case
$infobox[] = Lang::$game['resources'].Lang::$main['colon'].'[span]'.Util::ucFirst(Lang::$spell['powerTypes'][5]).', '.Util::ucFirst(Lang::$spell['powerTypes'][$this->subject->getField('powerType')]).'[/span]';
else // regular case
$infobox[] = Lang::$game['resource'].Lang::$colon.'[span]'.Util::ucFirst(Lang::$spell['powerTypes'][$cl->getField('powerType')]).'[/span]';
$infobox[] = Lang::$game['resource'].Lang::$main['colon'].'[span]'.Util::ucFirst(Lang::$spell['powerTypes'][$this->subject->getField('powerType')]).'[/span]';
// roles
$roles = [];
for ($i = 0; $i < 4; $i++)
if ($cl->getField('roles') & (1 << $i))
$roles[] = (count($roles) == 2 ? '\n' : '').Lang::$game['_roles'][$i];
if ($this->subject->getField('roles') & (1 << $i))
$roles[] = (count($roles) == 2 ? "\n" : '').Lang::$game['_roles'][$i];
if ($roles)
$infobox[] = (count($roles) > 1 ? Lang::$game['roles'] : Lang::$game['role']).Lang::$colon.implode(', ', $roles);
$infobox[] = (count($roles) > 1 ? Lang::$game['roles'] : Lang::$game['role']).Lang::$main['colon'].implode(', ', $roles);
// specs
$specList = [];
$skills = new SkillList(array(['id', $cl->getField('skills')]));
$skills->addGlobalsToJscript();
$skills = new SkillList(array(['id', $this->subject->getField('skills')]));
foreach ($skills->iterate() as $k => $__)
$specList[$k] = '[icon name='.$skills->getField('iconString').'][url=?spells=7.'.$_id.'.'.$k.']'.$skills->getField('name', true).'[/url][/icon]';
$specList[$k] = '[icon name='.$skills->getField('iconString').'][url=?spells=7.'.$this->typeId.'.'.$k.']'.$skills->getField('name', true).'[/url][/icon]';
if ($specList)
$infobox[] = Lang::$game['specs'].Lang::$colon.'[ul][li]'.implode('[/li][li]', $specList).'[/li][/ul]';
$infobox[] = Lang::$game['specs'].Lang::$main['colon'].'[ul][li]'.implode('[/li][li]', $specList).'[/li][/ul]';
/****************/
/* Main Content */
/****************/
// menuId 12: Class g_initPath()
// tabId 0: Database g_initHeader()
$pageData = array (
'page' => array(
'title' => $cl->getField('name', true).' - '.Util::ucFirst(Lang::$game['class']),
'path' => json_encode($_path, JSON_NUMERIC_CHECK),
'tab' => 0,
'type' => TYPE_CLASS,
'typeId' => $_id,
'reqJS' => [STATIC_URL.'/js/swfobject.js'],
'name' => $cl->getField('name', true),
'expansion' => Util::$expansionString[$cl->getField('expansion')],
'infobox' => '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]',
'headIcons' => ['class_'.strtolower($cl->getField('fileString'))],
'redButtons' => array(
$this->infobox = '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]';
$this->expansion = Util::$expansionString[$this->subject->getField('expansion')];
$this->headIcons = ['class_'.strtolower($this->subject->getField('fileString'))];
$this->redButtons = array(
BUTTON_LINKS => ['color' => '', 'linkId' => ''],
BUTTON_WOWHEAD => true,
BUTTON_TALENT => ['href' => '?talent#'.Util::$tcEncoding[$tcClassId[$_id] * 3], 'pet' => false],
BUTTON_FORUM => false // doto (low): CFG_BOARD_URL + X
)
),
'relTabs' => [],
BUTTON_TALENT => ['href' => '?talent#'.Util::$tcEncoding[$tcClassId[$this->typeId] * 3], 'pet' => false],
BUTTON_FORUM => false // todo (low): CFG_BOARD_URL + X
);
/**************/
/* Extra Tabs */
/**************/
@@ -101,8 +122,8 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
[
'OR',
['s.reqClassMask', $_mask, '&'], // Glyphs, Proficiencies
['s.skillLine1', $cl->getField('skills')], // Abilities / Talents
['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $cl->getField('skills')]]
['s.skillLine1', $this->subject->getField('skills')], // Abilities / Talents
['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $this->subject->getField('skills')]]
],
[ // last rank or unranked
'OR',
@@ -112,9 +133,11 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
);
$genSpells = new SpellList($conditions);
$genSpells->addGlobalsToJScript(GLOBALINFO_SELF);
if (!$genSpells->error)
{
$this->extendGlobalData($genSpells->getJSGlobals(GLOBALINFO_SELF));
$pageData['relTabs'][] = array(
$this->lvData[] = array(
'file' => 'spell',
'data' => $genSpells->getListviewData(),
'params' => array(
@@ -128,7 +151,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
'onAfterCreate' => '$Listview.funcBox.addSpellIndicator'
)
);
}
// Tab: Items (grouped)
$conditions = array(
@@ -140,12 +163,14 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
);
$items = new ItemList($conditions);
$items->addGlobalsToJscript();
if (!$items->error)
{
$this->extendGlobalData($items->getJSGlobals());
if (!$items->hasDiffFields(['requiredRace']))
$hidden = "$['side']";
$pageData['relTabs'][] = array(
$this->lvData[] = array(
'file' => 'item',
'data' => $items->getListviewData(),
'params' => array(
@@ -156,10 +181,11 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
'hiddenCols' => isset($hidden) ? $hidden : null,
'computeDataFunc' => '$Listview.funcBox.initSubclassFilter',
'onAfterCreate' => '$Listview.funcBox.addSubclassIndicator',
'note' => sprintf(Util::$filterResultString, '?items&filter=cr=152;crs='.$_id.';crv=0'),
'note' => sprintf(Util::$filterResultString, '?items&filter=cr=152;crs='.$this->typeId.';crv=0'),
'_truncated' => 1
)
);
}
// Tab: Quests
$conditions = array(
@@ -168,9 +194,11 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
);
$quests = new QuestList($conditions);
$quests->addGlobalsToJscript();
if (!$quests->error)
{
$this->extendGlobalData($quests->getJSGlobals());
$pageData['relTabs'][] = array(
$this->lvData[] = array(
'file' => 'quest',
'data' => $quests->getListviewData(),
'params' => array(
@@ -178,32 +206,37 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
'tabs' => '$tabsRelated'
)
);
}
// Tab: Itemsets
$sets = new ItemsetList(array(['classMask', $_mask, '&']));
$sets->addGlobalsToJScript(GLOBALINFO_SELF);
if (!$sets->error)
{
$this->extendGlobalData($sets->getJSGlobals(GLOBALINFO_SELF));
$pageData['relTabs'][] = array(
$this->lvData[] = array(
'file' => 'itemset',
'data' => $sets->getListviewData(),
'params' => array(
'note' => sprintf(Util::$filterResultString, '?itemsets&filter=cl='.$_id),
'note' => sprintf(Util::$filterResultString, '?itemsets&filter=cl='.$this->typeId),
'hiddenCols' => "$['classes']",
'sort' => "$['-level', 'name']",
'tabs' => '$tabsRelated'
)
);
}
// Tab: Trainer
$conditions = array(
['npcflag', 0x30, '&'], // is trainer
['trainerType', 0], // trains class spells
['trainerClass', $_id]
['trainerClass', $this->typeId]
);
$trainer = new CreatureList($conditions);
$pageData['relTabs'][] = array(
if (!$trainer->error)
{
$this->lvData[] = array(
'file' => 'creature',
'data' => $trainer->getListviewData(),
'params' => array(
@@ -212,28 +245,21 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
'tabs' => '$tabsRelated'
)
);
}
// Tab: Races
$races = new CharRaceList(array(['classMask', $_mask, '&']));
$pageData['relTabs'][] = array(
if (!$races->error)
{
$this->lvData[] = array(
'file' => 'race',
'data' => $races->getListviewData(),
'params' => array(
'tabs' => '$tabsRelated'
)
);
$smarty->saveCache($cacheKeyPage, $pageData);
}
}
}
$smarty->updatePageVars($pageData['page']);
$smarty->assign('community', CommunityContent::getAll(TYPE_CLASS, $_id)); // comments, screenshots, videos
$smarty->assign('lang', array_merge(Lang::$main, ['colon' => Lang::$colon]));
$smarty->assign('lvData', $pageData['relTabs']);
// load the page
$smarty->display('detail-page-generic.tpl');
?>

View File

@@ -4,38 +4,44 @@ if (!defined('AOWOW_REVISION'))
die('illegal access');
$cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_CLASS, -1, -1, User::$localeId]);
if (!$smarty->loadCache($cacheKey, $pageData))
// menuId 12: Class g_initPath()
// tabId 0: Database g_initHeader()
class ClassesPage extends GenericPage
{
$classes = new CharClassList();
use ListPage;
// menuId 12: Class g_initPath()
// tabId 0: Database g_initHeader()
$pageData = array(
'page' => array(
'title' => Util::ucFirst(Lang::$game['classes']),
'path' => "[0, 12]",
'tab' => 0
),
'lv' => array(
array(
protected $type = TYPE_CLASS;
protected $tpl = 'list-page-generic';
protected $path = [0, 12];
protected $tabId = 0;
protected $mode = CACHETYPE_PAGE;
public function __construct()
{
$this->name = Util::ucFirst(Lang::$game['classes']);
parent::__construct();
}
protected function generateContent()
{
$classes = new CharClassList();
if (!$classes->error)
{
$this->lvData[] = array(
'file' => 'class',
'data' => $classes->getListviewData(),
'params' => []
)
)
);
}
}
$smarty->saveCache($cacheKey, $pageData);
protected function generateTitle()
{
array_unshift($this->title, Util::ucFirst(Lang::$game['classes']));
}
protected function generatePath() {}
}
$smarty->updatePageVars($pageData['page']);
$smarty->assign('lang', Lang::$main);
$smarty->assign('lvData', $pageData['lv']);
// load the page
$smarty->display('list-page-generic.tpl');
?>

View File

@@ -5,22 +5,26 @@ if (!defined('AOWOW_REVISION'))
/*
todo:
todo (med):
- different styles for newsbox
- flags for news .. disabled, deleted, recurring, whatever..
*/
// load news
$rows = DB::Aowow()->select('SELECT * FROM ?_news ORDER BY time DESC, id DESC LIMIT 5');
class MainPage extends GenericPage
{
protected $tpl = 'main';
protected $news = [];
foreach ($rows as $i => $row)
$rows[$i]['text'] = Util::localizedString($row, 'text');
protected function generateContent()
{
// load news
$rows = DB::Aowow()->select('SELECT * FROM ?_news ORDER BY time DESC, id DESC LIMIT 5');
foreach ($rows as $i => $row)
$this->news[$i]['text'] = Util::localizedString($row, 'text');
}
$smarty->assign('news', isset($rows) ? $rows : NULL);
$smarty->assign('lang', Lang::$main);
// load the page
$smarty->display('main.tpl');
protected function generateTitle() {}
protected function generatePath() {}
}
?>

View File

@@ -4,109 +4,125 @@ if (!defined('AOWOW_REVISION'))
die('illegal access');
require 'includes/community.class.php';
$_id = intVal($pageParam);
$_mask = 1 << ($_id - 1);
$_path = [0, 13, $_id];
$mountVendors = array( // race => [starter, argent tournament]
null,
[384, 33307],
[3362, 33553],
[1261, 33310],
[4730, 33653],
[4731, 33555],
[3685, 33556],
[7955, 33650],
[7952, 33554],
null,
[16264, 33557],
[17584, 33657]
);
$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_RACE, $_id, -1, User::$localeId]);
if (!$smarty->loadCache($cacheKeyPage, $pageData))
// menuId 13: Race g_initPath()
// tabId 0: Database g_initHeader()
class RacePage extends GenericPage
{
$race = new CharRaceList(array(['id', $_id])); // should this be limited to playable races..?
if ($race->error)
$smarty->notFound(Lang::$game['race'], $_id);
use DetailPage;
protected $type = TYPE_RACE;
protected $typeId = 0;
protected $tpl = 'detail-page-generic';
protected $path = [0, 13];
protected $tabId = 0;
protected $mode = CACHETYPE_PAGE;
protected $js = ['swfobject.js'];
public function __construct($id)
{
$this->typeId = intVal($id);
$this->subject = new CharRaceList(array(['id', $id]));
if ($this->subject->error)
$this->notFound(Lang::$game['race']);
$this->name = $this->subject->getField('name', true);
$this->gPageInfo = array(
'type' => $this->type,
'typeId' => $this->typeId,
'name' => $this->name
);
parent::__construct();
}
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 = [];
$_mask = 1 << ($this->typeId - 1);
$mountVendors = array( // race => [starter, argent tournament]
null, [384, 33307], [3362, 33553], [1261, 33310],
[4730, 33653], [4731, 33555], [3685, 33556], [7955, 33650],
[7952, 33554], null, [16264, 33557], [17584, 33657]
);
/***********/
/* Infobox */
/***********/
$infobox = []; // unfortunately is all of this custom data :/
$infobox = []; // unfortunately, all of this is custom data :/
// side
if ($_ = $race->getField('side'))
$infobox[] = Lang::$main['side'].Lang::$colon.'[span class=icon-'.($_ == 2 ? 'horde' : 'alliance').']'.Lang::$game['si'][$_].'[/span]';
if ($_ = $this->subject->getField('side'))
$infobox[] = Lang::$main['side'].Lang::$main['colon'].'[span class=icon-'.($_ == 2 ? 'horde' : 'alliance').']'.Lang::$game['si'][$_].'[/span]';
// faction
if ($_ = $race->getField('factionId'))
if ($_ = $this->subject->getField('factionId'))
{
$smarty->extendGlobalIds(TYPE_FACTION, $_);
$infobox[] = Util::ucFirst(Lang::$game['faction']).Lang::$colon.'[faction='.$_.']';
$fac = new FactionList(array(['ft.id', $_]));
$this->extendGlobalData($fac->getJSGlobals());
$infobox[] = Util::ucFirst(Lang::$game['faction']).Lang::$main['colon'].'[faction='.$fac->id.']';
}
// leader
if ($_ = $race->getField('leader'))
if ($_ = $this->subject->getField('leader'))
{
$smarty->extendGlobalIds(TYPE_NPC, $_);
$infobox[] = Lang::$class['racialLeader'].Lang::$colon.'[npc='.$_.']';
$this->extendGlobalIds(TYPE_NPC, $_);
$infobox[] = Lang::$class['racialLeader'].Lang::$main['colon'].'[npc='.$_.']';
}
// start area
if ($_ = $race->getField('startAreaId'))
if ($_ = $this->subject->getField('startAreaId'))
{
$smarty->extendGlobalIds(TYPE_ZONE, $_);
$infobox[] = Lang::$class['startZone'].Lang::$colon.'[zone='.$_.']';
$this->extendGlobalIds(TYPE_ZONE, $_);
$infobox[] = Lang::$class['startZone'].Lang::$main['colon'].'[zone='.$_.']';
}
/****************/
/* Main Content */
/****************/
// menuId 13: Race g_initPath()
// tabId 0: Database g_initHeader()
$pageData = array (
'page' => array(
'name' => $race->getField('name', true),
'expansion' => Util::$expansionString[$race->getField('expansion')],
'title' => $race->getField('name', true).' - '.Util::ucFirst(Lang::$game['race']),
'path' => json_encode($_path, JSON_NUMERIC_CHECK),
'tab' => 0,
'type' => TYPE_RACE,
'typeId' => $_id,
'infobox' => '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]',
'headIcons' => array(
'race_'.strtolower($race->getField('fileString')).'_male',
'race_'.strtolower($race->getField('fileString')).'_female'
),
'redButtons' => array(
$this->infobox = '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]';
$this->expansion = Util::$expansionString[$this->subject->getField('expansion')];
$this->headIcons = array(
'race_'.strtolower($this->subject->getField('fileString')).'_male',
'race_'.strtolower($this->subject->getField('fileString')).'_female'
);
$this->redButtons = array(
BUTTON_WOWHEAD => true,
BUTTON_LINKS => true
)
),
'relTabs' => []
);
/**************/
/* Extra Tabs */
/**************/
// Classes
$classes = new CharClassList(array(['racemask', $_mask, '&']));
$classes->addGlobalsToJscript();
$pageData['relTabs'][] = array(
if (!$classes->error)
{
$this->extendGlobalData($classes->getJSGlobals());
$this->lvData[] = array(
'file' => 'class',
'data' => $classes->getListviewData(),
'params' => array(
'tabs' => '$tabsRelated'
)
);
}
// Tongues
$conditions = array(
@@ -115,9 +131,10 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
);
$tongues = new SpellList($conditions);
$tongues->addGlobalsToJscript();
$pageData['relTabs'][] = array(
if (!$tongues->error)
{
$this->extendGlobalData($tongues->getJSGlobals());
$this->lvData[] = array(
'file' => 'spell',
'data' => $tongues->getListviewData(),
'params' => array(
@@ -127,6 +144,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
'tabs' => '$tabsRelated'
)
);
}
// Racials
$conditions = array(
@@ -135,9 +153,10 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
);
$racials = new SpellList($conditions);
$racials->addGlobalsToJscript();
$pageData['relTabs'][] = array(
if (!$racials->error)
{
$this->extendGlobalData($racials->getJSGlobals());
$this->lvData[] = array(
'file' => 'spell',
'data' => $racials->getListviewData(),
'params' => array(
@@ -147,6 +166,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
'tabs' => '$tabsRelated'
)
);
}
// Quests
$conditions = array(
@@ -156,19 +176,21 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
);
$quests = new QuestList($conditions);
$quests->addGlobalsToJscript();
$pageData['relTabs'][] = array(
if (!$quests->error)
{
$this->extendGlobalData($quests->getJSGlobals());
$this->lvData[] = array(
'file' => 'quest',
'data' => $quests->getListviewData(),
'params' => array(
'tabs' => '$tabsRelated'
)
);
}
// Mounts
// ok, this sucks, but i rather hardcode the trainer, than fetch items by namepart
$items = isset($mountVendors[$_id]) ? DB::Aowow()->selectCol('SELECT item FROM npc_vendor WHERE entry IN (?a)', $mountVendors[$_id]) : 0;
$items = isset($mountVendors[$this->typeId]) ? DB::Aowow()->selectCol('SELECT item FROM npc_vendor WHERE entry IN (?a)', $mountVendors[$this->typeId]) : 0;
$conditions = array(
['i.id', $items],
@@ -177,9 +199,10 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
);
$mounts = new ItemList($conditions);
$mounts->addGlobalsToJscript();
$pageData['relTabs'][] = array(
if (!$mounts->error)
{
$this->extendGlobalData($mounts->getJSGlobals());
$this->lvData[] = array(
'file' => 'item',
'data' => $mounts->getListviewData(),
'params' => array(
@@ -189,17 +212,9 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
'hiddenCols' => "$['slot', 'type']"
)
);
$smarty->saveCache($cacheKeyPage, $pageData);
}
}
}
$smarty->updatePageVars($pageData['page']);
$smarty->assign('community', CommunityContent::getAll(TYPE_RACE, $_id)); // comments, screenshots, videos
$smarty->assign('lang', Lang::$main);
$smarty->assign('lvData', $pageData['relTabs']);
// load the page
$smarty->display('detail-page-generic.tpl');
?>

View File

@@ -4,38 +4,44 @@ if (!defined('AOWOW_REVISION'))
die('illegal access');
$cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_RACE, -1, -1, User::$localeId]);
if (!$smarty->loadCache($cacheKey, $pageData))
// menuId 13: Race g_initPath()
// tabId 0: Database g_initHeader()
class RacesPage extends GenericPage
{
$races = new CharRaceList(array(['side', 0, '!'])); // only playable
use ListPage;
// menuId 13: Race g_initPath()
// tabId 0: Database g_initHeader()
$pageData = array(
'page' => array(
'title' => Util::ucFirst(Lang::$game['races']),
'path' => "[0, 13]",
'tab' => 0
),
'lv' => array(
array(
protected $type = TYPE_CLASS;
protected $tpl = 'list-page-generic';
protected $path = [0, 13];
protected $tabId = 0;
protected $mode = CACHETYPE_PAGE;
public function __construct()
{
$this->name = Util::ucFirst(Lang::$game['races']);
parent::__construct();
}
protected function generateContent()
{
$races = new CharRaceList(array(['side', 0, '!']));
if (!$races->error)
{
$this->lvData[] = array(
'file' => 'race',
'data' => $races->getListviewData(),
'params' => []
)
)
);
}
}
$smarty->saveCache($cacheKey, $pageData);
protected function generateTitle()
{
array_unshift($this->title, Util::ucFirst(Lang::$game['races']));
}
protected function generatePath() {}
}
$smarty->updatePageVars($pageData['page']);
$smarty->assign('lang', Lang::$main);
$smarty->assign('lvData', $pageData['lv']);
// load the page
$smarty->display('list-page-generic.tpl');
?>

View File

@@ -11131,7 +11131,8 @@ Listview.templates = {
buff = 'coexist'; // without condition
break;
case 2:
buff2 = '(from same caster)';
case 4:
buff2 = spell.stackRule == 2 ? '(from same caster)' : '(strongest effect is applied)';
case 1:
buff = 'exclusive'; // without condition
break;

View File

@@ -1,5 +1,4 @@
var _ = g_classes;
{strip}
<?php
foreach ($vars as $id => $data):
echo '_['.$id.']={name_'.User::$localeString.':\''.Util::jsEscape($data['name']).'\'};';

View File

@@ -1,5 +1,4 @@
var _ = g_npcs;
{strip}
<?php
foreach ($vars as $id => $data):
echo '_['.$id.']={name_'.User::$localeString.':\''.Util::jsEscape($data['name']).'\'};';

View File

@@ -1,5 +1,4 @@
var _ = g_holidays;
{strip}
<?php
foreach ($vars as $id => $data):
echo '_['.$id.']={' .

View File

@@ -1,5 +1,4 @@
var _ = g_factions;
{strip}
<?php
foreach ($vars as $id => $data):
echo '_['.$id.']={name_'.User::$localeString.':\''.Util::jsEscape($data['name']).'\'};';

View File

@@ -24,4 +24,3 @@
"pinned":0
}
]);
{/strip}

View File

@@ -23,7 +23,7 @@
$this->brick('redButtons');
?>
<h1<?php echo isset($this->expansion) ? 'class="h1-icon"><span class="icon-'.$this->expansion.'-right">'.$this->name.'</span>' : '>'.$this->name; ?></h1>
<h1<?php echo isset($this->expansion) ? ' class="h1-icon"><span class="icon-'.$this->expansion.'-right">'.$this->name.'</span>' : '>'.$this->name; ?></h1>
<?php
$this->brick('article');