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 trait DetailPage
{ {
protected $hasComContent = true;
// require 'includes/community.class.php';
function generateCacheKey($cacheType, $params = '-1') function generateCacheKey($cacheType, $params = '-1')
{ {
@@ -53,7 +52,6 @@ class GenericPage
protected $name = ''; // for h1-Element protected $name = ''; // for h1-Element
protected $tabId = 0; protected $tabId = 0;
protected $community = ['co' => [], 'sc' => [], 'vi' => []]; protected $community = ['co' => [], 'sc' => [], 'vi' => []];
protected $hasComContent = false;
private $js = []; private $js = [];
private $css = []; private $css = [];
@@ -103,7 +101,7 @@ class GenericPage
$this->saveCache(); $this->saveCache();
} }
if ($this->hasComContent) if (!empty($this->hasComContent))
$this->community = CommunityContent::getAll($this->type, $this->typeId); $this->community = CommunityContent::getAll($this->type, $this->typeId);
$this->mysql = DB::Aowow()->getStatistics(); $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 $queryBase = 'SELECT f.*, f.parentFactionId AS cat2, f.id AS ARRAY_KEY FROM ?_factions f';
protected $queryOpts = array( protected $queryOpts = array(
'f' => [['f2']], '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 = []) public function __construct($conditions = [])

View File

@@ -15,19 +15,16 @@ require 'includes/kernel.php';
if (version_compare(PHP_VERSION, '5.4.0') <= 0) if (version_compare(PHP_VERSION, '5.4.0') <= 0)
{ {
if (User::isInGroup(U_GROUP_EMPLOYEE)) 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 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) switch ($pageCall)
{ {
/* called by user */ /* called by user */
case '': // no parameter given -> MainPage
$pageCall = 'main';
case 'account': // account management [nyi] case 'account': // account management [nyi]
case 'achievement': case 'achievement':
case 'achievements': case 'achievements':
@@ -73,15 +70,10 @@ switch ($pageCall)
case 'user': // tool: user profiles [nyi] case 'user': // tool: user profiles [nyi]
case 'zone': case 'zone':
case 'zones': case 'zones':
if (file_exists('pages/'.$pageCall.'.php')) $_ = $pageCall.'Page';
require 'pages/'.$pageCall.'.php'; new $_($pageParam);
else
$smarty->error();
break; break;
/* other pages */ /* other pages */
case '': // no parameter given -> MainPage
require 'pages/main.php';
break;
case 'whats-new': case 'whats-new':
case 'searchplugins': case 'searchplugins':
case 'searchbox': case 'searchbox':
@@ -89,7 +81,7 @@ switch ($pageCall)
case 'help': case 'help':
case 'faq': case 'faq':
case 'aboutus': case 'aboutus':
require 'pages/more.php'; new MorePage($pageCall);
break; break;
case 'latest-additions': case 'latest-additions':
case 'latest-articles': case 'latest-articles':
@@ -141,7 +133,7 @@ switch ($pageCall)
if (isset($_GET['power'])) if (isset($_GET['power']))
die('$WowheadPower.register(0, '.User::$localeId.', {})'); die('$WowheadPower.register(0, '.User::$localeId.', {})');
else // in conjunction with a propper rewriteRule in .htaccess... else // in conjunction with a propper rewriteRule in .htaccess...
$smarty->error(); (new GenericPage)->error();
break; break;
} }

View File

@@ -4,236 +4,262 @@ if (!defined('AOWOW_REVISION'))
die('illegal access'); die('illegal access');
require 'includes/community.class.php'; // menuId 12: Class g_initPath()
// tabId 0: Database g_initHeader()
$_id = intVal($pageParam); class ClassPage extends GenericPage
$_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))
{ {
$cl = new CharClassList(array(['id', $_id])); use DetailPage;
if ($cl->error)
$smarty->notFound(Lang::$game['class'], $_id);
/***********/ protected $type = TYPE_CLASS;
/* Infobox */ protected $typeId = 0;
/***********/ protected $tpl = 'detail-page-generic';
protected $path = [0, 12];
protected $tabId = 0;
protected $mode = CACHETYPE_PAGE;
protected $js = ['swfobject.js'];
$infobox = []; public function __construct($id)
// hero class {
if ($cl->getField('flags') & 0x40) $this->typeId = intVal($id);
$infobox[] = '[tooltip=tooltip_heroclass]'.Lang::$game['heroClass'].'[/tooltip]';
// resource $this->subject = new CharClassList(array(['id', $id]));
if ($_id == 11) // special Druid case if ($this->subject->error)
$infobox[] = Lang::$game['resources'].Lang::$colon. $this->notFound(Lang::$game['class']);
'[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 // regular case
$infobox[] = Lang::$game['resource'].Lang::$colon.'[span]'.Util::ucFirst(Lang::$spell['powerTypes'][$cl->getField('powerType')]).'[/span]';
// roles $this->name = $this->subject->getField('name', true);
$roles = []; $this->gPageInfo = array(
for ($i = 0; $i < 4; $i++) 'type' => $this->type,
if ($cl->getField('roles') & (1 << $i)) 'typeId' => $this->typeId,
$roles[] = (count($roles) == 2 ? '\n' : '').Lang::$game['_roles'][$i]; 'name' => $this->name
);
if ($roles) parent::__construct();
$infobox[] = (count($roles) > 1 ? Lang::$game['roles'] : Lang::$game['role']).Lang::$colon.implode(', ', $roles); }
// specs protected function generatePath()
$specList = []; {
$skills = new SkillList(array(['id', $cl->getField('skills')])); $this->path[] = $this->typeId;
$skills->addGlobalsToJscript(); }
foreach ($skills->iterate() as $k => $__)
$specList[$k] = '[icon name='.$skills->getField('iconString').'][url=?spells=7.'.$_id.'.'.$k.']'.$skills->getField('name', true).'[/url][/icon]';
if ($specList) protected function generateTitle()
$infobox[] = Lang::$game['specs'].Lang::$colon.'[ul][li]'.implode('[/li][li]', $specList).'[/li][/ul]'; {
array_unshift($this->title, $this->subject->getField('name', true), Util::ucFirst(Lang::$game['class']));
}
/****************/ protected function generateContent()
/* Main Content */ {
/****************/ $infobox = [];
$_mask = 1 << ($this->typeId - 1);
// menuId 12: Class g_initPath() $tcClassId = [null, 8, 3, 1, 5, 4, 9, 6, 2, 7, null, 0]; // see TalentCalc.js
// 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(
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' => [],
);
/**************/
/* Extra Tabs */
/**************/
// Tab: Spells (grouped)
// '$LANG.tab_armorproficiencies',
// '$LANG.tab_weaponskills',
// '$LANG.tab_glyphs',
// '$LANG.tab_abilities',
// '$LANG.tab_talents',
$conditions = array(
['s.typeCat', [-13, -11, -2, 7]],
[['s.cuFlags', (SPELL_CU_TRIGGERED | CUSTOM_EXCLUDE_FOR_LISTVIEW), '&'], 0],
[
'OR',
['s.reqClassMask', $_mask, '&'], // Glyphs, Proficiencies
['s.skillLine1', $cl->getField('skills')], // Abilities / Talents
['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $cl->getField('skills')]]
],
[ // last rank or unranked
'OR',
['s.cuFlags', SPELL_CU_LAST_RANK, '&'],
['s.rankId', 0]
]
);
$genSpells = new SpellList($conditions);
$genSpells->addGlobalsToJScript(GLOBALINFO_SELF);
$pageData['relTabs'][] = array(
'file' => 'spell',
'data' => $genSpells->getListviewData(),
'params' => array(
'id' => 'spells',
'name' => '$LANG.tab_spells',
'visibleCols' => "$['level', 'schools', 'type', 'classes']",
'hiddenCols' => "$['reagents', 'skill']",
'sort' => "$['-level', 'type', 'name']",
'tabs' => '$tabsRelated',
'computeDataFunc' => '$Listview.funcBox.initSpellFilter',
'onAfterCreate' => '$Listview.funcBox.addSpellIndicator'
)
);
// Tab: Items (grouped) /***********/
$conditions = array( /* Infobox */
['requiredClass', 0, '>'], /***********/
['requiredClass', $_mask, '&'],
[['requiredClass', CLASS_MASK_ALL, '&'], CLASS_MASK_ALL, '!'],
['itemset', 0], // hmm, do or dont..?
0
);
$items = new ItemList($conditions); // hero class
$items->addGlobalsToJscript(); if ($this->subject->getField('flags') & 0x40)
$infobox[] = '[tooltip=tooltip_heroclass]'.Lang::$game['heroClass'].'[/tooltip]';
if (!$items->hasDiffFields(['requiredRace'])) // resource
$hidden = "$['side']"; 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 ($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::$main['colon'].'[span]'.Util::ucFirst(Lang::$spell['powerTypes'][$this->subject->getField('powerType')]).'[/span]';
$pageData['relTabs'][] = array( // roles
'file' => 'item', $roles = [];
'data' => $items->getListviewData(), for ($i = 0; $i < 4; $i++)
'params' => array( if ($this->subject->getField('roles') & (1 << $i))
'id' => 'items', $roles[] = (count($roles) == 2 ? "\n" : '').Lang::$game['_roles'][$i];
'name' => '$LANG.tab_items',
'tabs' => '$tabsRelated',
'visibleCols' => "$['dps', 'armor', 'slot']",
'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'),
'_truncated' => 1
)
);
// Tab: Quests if ($roles)
$conditions = array( $infobox[] = (count($roles) > 1 ? Lang::$game['roles'] : Lang::$game['role']).Lang::$main['colon'].implode(', ', $roles);
['reqClassMask', $_mask, '&'],
[['reqClassMask', CLASS_MASK_ALL, '&'], CLASS_MASK_ALL, '!']
);
$quests = new QuestList($conditions); // specs
$quests->addGlobalsToJscript(); $specList = [];
$skills = new SkillList(array(['id', $this->subject->getField('skills')]));
foreach ($skills->iterate() as $k => $__)
$specList[$k] = '[icon name='.$skills->getField('iconString').'][url=?spells=7.'.$this->typeId.'.'.$k.']'.$skills->getField('name', true).'[/url][/icon]';
$pageData['relTabs'][] = array( if ($specList)
'file' => 'quest', $infobox[] = Lang::$game['specs'].Lang::$main['colon'].'[ul][li]'.implode('[/li][li]', $specList).'[/li][/ul]';
'data' => $quests->getListviewData(),
'params' => array(
'sort' => "$['reqlevel', 'name']",
'tabs' => '$tabsRelated'
)
);
// Tab: Itemsets
$sets = new ItemsetList(array(['classMask', $_mask, '&']));
$sets->addGlobalsToJScript(GLOBALINFO_SELF);
$pageData['relTabs'][] = array( /****************/
'file' => 'itemset', /* Main Content */
'data' => $sets->getListviewData(), /****************/
'params' => array(
'note' => sprintf(Util::$filterResultString, '?itemsets&filter=cl='.$_id),
'hiddenCols' => "$['classes']",
'sort' => "$['-level', 'name']",
'tabs' => '$tabsRelated'
)
);
// Tab: Trainer $this->infobox = '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]';
$conditions = array( $this->expansion = Util::$expansionString[$this->subject->getField('expansion')];
['npcflag', 0x30, '&'], // is trainer $this->headIcons = ['class_'.strtolower($this->subject->getField('fileString'))];
['trainerType', 0], // trains class spells $this->redButtons = array(
['trainerClass', $_id] BUTTON_LINKS => ['color' => '', 'linkId' => ''],
); BUTTON_WOWHEAD => true,
BUTTON_TALENT => ['href' => '?talent#'.Util::$tcEncoding[$tcClassId[$this->typeId] * 3], 'pet' => false],
BUTTON_FORUM => false // todo (low): CFG_BOARD_URL + X
);
$trainer = new CreatureList($conditions);
$pageData['relTabs'][] = array( /**************/
'file' => 'creature', /* Extra Tabs */
'data' => $trainer->getListviewData(), /**************/
'params' => array(
'id' => 'trainers',
'name' => '$LANG.tab_trainers',
'tabs' => '$tabsRelated'
)
);
// Tab: Races // Tab: Spells (grouped)
$races = new CharRaceList(array(['classMask', $_mask, '&'])); // '$LANG.tab_armorproficiencies',
// '$LANG.tab_weaponskills',
// '$LANG.tab_glyphs',
// '$LANG.tab_abilities',
// '$LANG.tab_talents',
$conditions = array(
['s.typeCat', [-13, -11, -2, 7]],
[['s.cuFlags', (SPELL_CU_TRIGGERED | CUSTOM_EXCLUDE_FOR_LISTVIEW), '&'], 0],
[
'OR',
['s.reqClassMask', $_mask, '&'], // Glyphs, Proficiencies
['s.skillLine1', $this->subject->getField('skills')], // Abilities / Talents
['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $this->subject->getField('skills')]]
],
[ // last rank or unranked
'OR',
['s.cuFlags', SPELL_CU_LAST_RANK, '&'],
['s.rankId', 0]
]
);
$pageData['relTabs'][] = array( $genSpells = new SpellList($conditions);
'file' => 'race', if (!$genSpells->error)
'data' => $races->getListviewData(), {
'params' => array( $this->extendGlobalData($genSpells->getJSGlobals(GLOBALINFO_SELF));
'tabs' => '$tabsRelated'
)
);
$smarty->saveCache($cacheKeyPage, $pageData); $this->lvData[] = array(
'file' => 'spell',
'data' => $genSpells->getListviewData(),
'params' => array(
'id' => 'spells',
'name' => '$LANG.tab_spells',
'visibleCols' => "$['level', 'schools', 'type', 'classes']",
'hiddenCols' => "$['reagents', 'skill']",
'sort' => "$['-level', 'type', 'name']",
'tabs' => '$tabsRelated',
'computeDataFunc' => '$Listview.funcBox.initSpellFilter',
'onAfterCreate' => '$Listview.funcBox.addSpellIndicator'
)
);
}
// Tab: Items (grouped)
$conditions = array(
['requiredClass', 0, '>'],
['requiredClass', $_mask, '&'],
[['requiredClass', CLASS_MASK_ALL, '&'], CLASS_MASK_ALL, '!'],
['itemset', 0], // hmm, do or dont..?
0
);
$items = new ItemList($conditions);
if (!$items->error)
{
$this->extendGlobalData($items->getJSGlobals());
if (!$items->hasDiffFields(['requiredRace']))
$hidden = "$['side']";
$this->lvData[] = array(
'file' => 'item',
'data' => $items->getListviewData(),
'params' => array(
'id' => 'items',
'name' => '$LANG.tab_items',
'tabs' => '$tabsRelated',
'visibleCols' => "$['dps', 'armor', 'slot']",
'hiddenCols' => isset($hidden) ? $hidden : null,
'computeDataFunc' => '$Listview.funcBox.initSubclassFilter',
'onAfterCreate' => '$Listview.funcBox.addSubclassIndicator',
'note' => sprintf(Util::$filterResultString, '?items&filter=cr=152;crs='.$this->typeId.';crv=0'),
'_truncated' => 1
)
);
}
// Tab: Quests
$conditions = array(
['reqClassMask', $_mask, '&'],
[['reqClassMask', CLASS_MASK_ALL, '&'], CLASS_MASK_ALL, '!']
);
$quests = new QuestList($conditions);
if (!$quests->error)
{
$this->extendGlobalData($quests->getJSGlobals());
$this->lvData[] = array(
'file' => 'quest',
'data' => $quests->getListviewData(),
'params' => array(
'sort' => "$['reqlevel', 'name']",
'tabs' => '$tabsRelated'
)
);
}
// Tab: Itemsets
$sets = new ItemsetList(array(['classMask', $_mask, '&']));
if (!$sets->error)
{
$this->extendGlobalData($sets->getJSGlobals(GLOBALINFO_SELF));
$this->lvData[] = array(
'file' => 'itemset',
'data' => $sets->getListviewData(),
'params' => array(
'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', $this->typeId]
);
$trainer = new CreatureList($conditions);
if (!$trainer->error)
{
$this->lvData[] = array(
'file' => 'creature',
'data' => $trainer->getListviewData(),
'params' => array(
'id' => 'trainers',
'name' => '$LANG.tab_trainers',
'tabs' => '$tabsRelated'
)
);
}
// Tab: Races
$races = new CharRaceList(array(['classMask', $_mask, '&']));
if (!$races->error)
{
$this->lvData[] = array(
'file' => 'race',
'data' => $races->getListviewData(),
'params' => array(
'tabs' => '$tabsRelated'
)
);
}
}
} }
$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'); die('illegal access');
$cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_CLASS, -1, -1, User::$localeId]); // menuId 12: Class g_initPath()
// tabId 0: Database g_initHeader()
if (!$smarty->loadCache($cacheKey, $pageData)) class ClassesPage extends GenericPage
{ {
$classes = new CharClassList(); use ListPage;
// menuId 12: Class g_initPath() protected $type = TYPE_CLASS;
// tabId 0: Database g_initHeader() protected $tpl = 'list-page-generic';
$pageData = array( protected $path = [0, 12];
'page' => array( protected $tabId = 0;
'title' => Util::ucFirst(Lang::$game['classes']), protected $mode = CACHETYPE_PAGE;
'path' => "[0, 12]",
'tab' => 0 public function __construct()
), {
'lv' => array( $this->name = Util::ucFirst(Lang::$game['classes']);
array(
parent::__construct();
}
protected function generateContent()
{
$classes = new CharClassList();
if (!$classes->error)
{
$this->lvData[] = array(
'file' => 'class', 'file' => 'class',
'data' => $classes->getListviewData(), 'data' => $classes->getListviewData(),
'params' => [] '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 - different styles for newsbox
- flags for news .. disabled, deleted, recurring, whatever.. - flags for news .. disabled, deleted, recurring, whatever..
*/ */
// load news class MainPage extends GenericPage
$rows = DB::Aowow()->select('SELECT * FROM ?_news ORDER BY time DESC, id DESC LIMIT 5'); {
protected $tpl = 'main';
protected $news = [];
foreach ($rows as $i => $row) protected function generateContent()
$rows[$i]['text'] = Util::localizedString($row, 'text'); {
// 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');
}
protected function generateTitle() {}
$smarty->assign('news', isset($rows) ? $rows : NULL); protected function generatePath() {}
$smarty->assign('lang', Lang::$main); }
// load the page
$smarty->display('main.tpl');
?> ?>

View File

@@ -4,202 +4,217 @@ if (!defined('AOWOW_REVISION'))
die('illegal access'); die('illegal access');
require 'includes/community.class.php'; // menuId 13: Race g_initPath()
// tabId 0: Database g_initHeader()
$_id = intVal($pageParam); class RacePage extends GenericPage
$_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))
{ {
$race = new CharRaceList(array(['id', $_id])); // should this be limited to playable races..? use DetailPage;
if ($race->error)
$smarty->notFound(Lang::$game['race'], $_id);
/***********/ protected $type = TYPE_RACE;
/* Infobox */ protected $typeId = 0;
/***********/ protected $tpl = 'detail-page-generic';
protected $path = [0, 13];
protected $tabId = 0;
protected $mode = CACHETYPE_PAGE;
protected $js = ['swfobject.js'];
$infobox = []; // unfortunately is all of this custom data :/ public function __construct($id)
// side
if ($_ = $race->getField('side'))
$infobox[] = Lang::$main['side'].Lang::$colon.'[span class=icon-'.($_ == 2 ? 'horde' : 'alliance').']'.Lang::$game['si'][$_].'[/span]';
// faction
if ($_ = $race->getField('factionId'))
{ {
$smarty->extendGlobalIds(TYPE_FACTION, $_); $this->typeId = intVal($id);
$infobox[] = Util::ucFirst(Lang::$game['faction']).Lang::$colon.'[faction='.$_.']';
$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();
} }
// leader protected function generatePath()
if ($_ = $race->getField('leader'))
{ {
$smarty->extendGlobalIds(TYPE_NPC, $_); $this->path[] = $this->typeId;
$infobox[] = Lang::$class['racialLeader'].Lang::$colon.'[npc='.$_.']';
} }
// start area protected function generateTitle()
if ($_ = $race->getField('startAreaId'))
{ {
$smarty->extendGlobalIds(TYPE_ZONE, $_); array_unshift($this->title, $this->subject->getField('name', true), Util::ucFirst(Lang::$game['class']));
$infobox[] = Lang::$class['startZone'].Lang::$colon.'[zone='.$_.']';
} }
/****************/ protected function generateContent()
/* Main Content */ {
/****************/ $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]
);
// 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(
BUTTON_WOWHEAD => true,
BUTTON_LINKS => true
)
),
'relTabs' => []
);
/**************/ /***********/
/* Extra Tabs */ /* Infobox */
/**************/ /***********/
// Classes $infobox = []; // unfortunately, all of this is custom data :/
$classes = new CharClassList(array(['racemask', $_mask, '&']));
$classes->addGlobalsToJscript();
$pageData['relTabs'][] = array( // side
'file' => 'class', if ($_ = $this->subject->getField('side'))
'data' => $classes->getListviewData(), $infobox[] = Lang::$main['side'].Lang::$main['colon'].'[span class=icon-'.($_ == 2 ? 'horde' : 'alliance').']'.Lang::$game['si'][$_].'[/span]';
'params' => array(
'tabs' => '$tabsRelated'
)
);
// Tongues // faction
$conditions = array( if ($_ = $this->subject->getField('factionId'))
['typeCat', -11], // proficiencies {
['reqRaceMask', $_mask, '&'] // only languages are race-restricted $fac = new FactionList(array(['ft.id', $_]));
); $this->extendGlobalData($fac->getJSGlobals());
$infobox[] = Util::ucFirst(Lang::$game['faction']).Lang::$main['colon'].'[faction='.$fac->id.']';
}
$tongues = new SpellList($conditions); // leader
$tongues->addGlobalsToJscript(); if ($_ = $this->subject->getField('leader'))
{
$this->extendGlobalIds(TYPE_NPC, $_);
$infobox[] = Lang::$class['racialLeader'].Lang::$main['colon'].'[npc='.$_.']';
}
$pageData['relTabs'][] = array( // start area
'file' => 'spell', if ($_ = $this->subject->getField('startAreaId'))
'data' => $tongues->getListviewData(), {
'params' => array( $this->extendGlobalIds(TYPE_ZONE, $_);
'id' => 'languages', $infobox[] = Lang::$class['startZone'].Lang::$main['colon'].'[zone='.$_.']';
'name' => '$LANG.tab_languages', }
'hiddenCols' => "$['reagents']",
'tabs' => '$tabsRelated'
)
);
// Racials
$conditions = array(
['typeCat', -4], // racial traits
['reqRaceMask', $_mask, '&']
);
$racials = new SpellList($conditions); /****************/
$racials->addGlobalsToJscript(); /* Main Content */
/****************/
$pageData['relTabs'][] = array( $this->infobox = '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]';
'file' => 'spell', $this->expansion = Util::$expansionString[$this->subject->getField('expansion')];
'data' => $racials->getListviewData(), $this->headIcons = array(
'params' => array( 'race_'.strtolower($this->subject->getField('fileString')).'_male',
'id' => 'racial-traits', 'race_'.strtolower($this->subject->getField('fileString')).'_female'
'name' => '$LANG.tab_racialtraits', );
'hiddenCols' => "$['reagents']", $this->redButtons = array(
'tabs' => '$tabsRelated' BUTTON_WOWHEAD => true,
) BUTTON_LINKS => true
); );
// Quests
$conditions = array(
['reqRaceMask', $_mask, '&'],
[['reqRaceMask', RACE_MASK_HORDE, '&'], RACE_MASK_HORDE, '!'],
[['reqRaceMask', RACE_MASK_ALLIANCE, '&'], RACE_MASK_ALLIANCE, '!']
);
$quests = new QuestList($conditions); /**************/
$quests->addGlobalsToJscript(); /* Extra Tabs */
/**************/
$pageData['relTabs'][] = array( // Classes
'file' => 'quest', $classes = new CharClassList(array(['racemask', $_mask, '&']));
'data' => $quests->getListviewData(), if (!$classes->error)
'params' => array( {
'tabs' => '$tabsRelated' $this->extendGlobalData($classes->getJSGlobals());
) $this->lvData[] = array(
); 'file' => 'class',
'data' => $classes->getListviewData(),
'params' => array(
'tabs' => '$tabsRelated'
)
);
}
// Mounts // Tongues
// ok, this sucks, but i rather hardcode the trainer, than fetch items by namepart $conditions = array(
$items = isset($mountVendors[$_id]) ? DB::Aowow()->selectCol('SELECT item FROM npc_vendor WHERE entry IN (?a)', $mountVendors[$_id]) : 0; ['typeCat', -11], // proficiencies
['reqRaceMask', $_mask, '&'] // only languages are race-restricted
);
$conditions = array( $tongues = new SpellList($conditions);
['i.id', $items], if (!$tongues->error)
['i.class', ITEM_CLASS_MISC], {
['i.subClass', 5], // mounts $this->extendGlobalData($tongues->getJSGlobals());
); $this->lvData[] = array(
'file' => 'spell',
'data' => $tongues->getListviewData(),
'params' => array(
'id' => 'languages',
'name' => '$LANG.tab_languages',
'hiddenCols' => "$['reagents']",
'tabs' => '$tabsRelated'
)
);
}
$mounts = new ItemList($conditions); // Racials
$mounts->addGlobalsToJscript(); $conditions = array(
['typeCat', -4], // racial traits
['reqRaceMask', $_mask, '&']
);
$pageData['relTabs'][] = array( $racials = new SpellList($conditions);
'file' => 'item', if (!$racials->error)
'data' => $mounts->getListviewData(), {
'params' => array( $this->extendGlobalData($racials->getJSGlobals());
'id' => 'mounts', $this->lvData[] = array(
'name' => '$LANG.tab_mounts', 'file' => 'spell',
'tabs' => '$tabsRelated', 'data' => $racials->getListviewData(),
'hiddenCols' => "$['slot', 'type']" 'params' => array(
) 'id' => 'racial-traits',
); 'name' => '$LANG.tab_racialtraits',
'hiddenCols' => "$['reagents']",
'tabs' => '$tabsRelated'
)
);
}
$smarty->saveCache($cacheKeyPage, $pageData); // Quests
$conditions = array(
['reqRaceMask', $_mask, '&'],
[['reqRaceMask', RACE_MASK_HORDE, '&'], RACE_MASK_HORDE, '!'],
[['reqRaceMask', RACE_MASK_ALLIANCE, '&'], RACE_MASK_ALLIANCE, '!']
);
$quests = new QuestList($conditions);
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[$this->typeId]) ? DB::Aowow()->selectCol('SELECT item FROM npc_vendor WHERE entry IN (?a)', $mountVendors[$this->typeId]) : 0;
$conditions = array(
['i.id', $items],
['i.class', ITEM_CLASS_MISC],
['i.subClass', 5], // mounts
);
$mounts = new ItemList($conditions);
if (!$mounts->error)
{
$this->extendGlobalData($mounts->getJSGlobals());
$this->lvData[] = array(
'file' => 'item',
'data' => $mounts->getListviewData(),
'params' => array(
'id' => 'mounts',
'name' => '$LANG.tab_mounts',
'tabs' => '$tabsRelated',
'hiddenCols' => "$['slot', 'type']"
)
);
}
}
} }
$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'); die('illegal access');
$cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_RACE, -1, -1, User::$localeId]); // menuId 13: Race g_initPath()
// tabId 0: Database g_initHeader()
if (!$smarty->loadCache($cacheKey, $pageData)) class RacesPage extends GenericPage
{ {
$races = new CharRaceList(array(['side', 0, '!'])); // only playable use ListPage;
// menuId 13: Race g_initPath() protected $type = TYPE_CLASS;
// tabId 0: Database g_initHeader() protected $tpl = 'list-page-generic';
$pageData = array( protected $path = [0, 13];
'page' => array( protected $tabId = 0;
'title' => Util::ucFirst(Lang::$game['races']), protected $mode = CACHETYPE_PAGE;
'path' => "[0, 13]",
'tab' => 0 public function __construct()
), {
'lv' => array( $this->name = Util::ucFirst(Lang::$game['races']);
array(
parent::__construct();
}
protected function generateContent()
{
$races = new CharRaceList(array(['side', 0, '!']));
if (!$races->error)
{
$this->lvData[] = array(
'file' => 'race', 'file' => 'race',
'data' => $races->getListviewData(), 'data' => $races->getListviewData(),
'params' => [] '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 buff = 'coexist'; // without condition
break; break;
case 2: case 2:
buff2 = '(from same caster)'; case 4:
buff2 = spell.stackRule == 2 ? '(from same caster)' : '(strongest effect is applied)';
case 1: case 1:
buff = 'exclusive'; // without condition buff = 'exclusive'; // without condition
break; break;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -23,7 +23,7 @@
$this->brick('redButtons'); $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 <?php
$this->brick('article'); $this->brick('article');