diff --git a/includes/utilities.php b/includes/utilities.php
index eac4b810..5b424a11 100644
--- a/includes/utilities.php
+++ b/includes/utilities.php
@@ -309,6 +309,60 @@ trait listviewHelper
}
+trait spawnHelper
+{
+ private static $spawnQuery = " SELECT a.guid AS ARRAY_KEY, map, position_x, position_y, spawnMask, phaseMask, spawntimesecs, eventEntry, pool_entry AS pool FROM ?# a LEFT JOIN ?# b ON a.guid = b.guid LEFT JOIN ?# c ON a.guid = c.guid WHERE id = ?d";
+
+ private function fetch()
+ {
+ if (!$this->id)
+ return false;
+
+ switch (get_class($this))
+ {
+ case 'CreatureList':
+ return DB::Aowow()->select(self::$spawnQuery, 'creature', 'game_event_creature', 'pool_creature', $this->id);
+ case 'GameObjectList':
+ return DB::Aowow()->select(self::$spawnQuery, 'gameobject', 'game_event_gameobject', 'pool_gameobject', $this->id);
+ default:
+ return false;
+ }
+ }
+
+ public function getSpawns($short = false)
+ {
+ // short: true => only the most populated area and only coordinates
+ $data = [];
+
+ $raw = $this->fetch();
+ if (!$raw)
+ return [];
+
+ /*
+ long:
+ $data = array(
+ areaId => array(
+ floorNo => array (
+ posX =>
+ posY =>
+ respawn =>
+ phaseMask =>
+ spawnMask =>
+ eventId =>
+ poolId =>
+ )
+ )
+ )
+
+ short: zoneId, [pos-sets]
+ $data = [6456, [[51,42.2],[51,43]]];
+ */
+
+ return $data;
+ }
+}
+
+
class Lang
{
public static $main;
@@ -584,10 +638,55 @@ class SmartyAoWoW extends Smarty
public function display($tpl)
{
- // since it's the same for every page, except index..
- if ($this->_tpl_vars['query'][0] && !preg_match('/[^a-z]/i', $this->_tpl_vars['query'][0]))
+ $tv = &$this->_tpl_vars;
+ $_ = [];
+
+ if ($tv['page']['type'] && $tv['page']['typeId'])
{
- $ann = DB::Aowow()->Select('SELECT * FROM ?_announcements WHERE status = 1 AND (page = ?s OR page = "*")', $this->_tpl_vars['query'][0]);
+ if ($article = DB::Aowow()->selectRow('SELECT id, article, quickInfo FROM ?_articles WHERE type = ?d AND typeId = ?d AND locale = ?d', $tv['page']['type'], $tv['page']['typeId'], User::$localeId))
+ {
+ $globals = DB::Aowow()->select('SELECT type, typeId FROM ?_article_items WHERE id = ?d', $article['id']);
+
+ $tv['article'] = $article['article'];
+ @$tv['infoBox'] .= $article['quickInfo'];
+
+ foreach ($globals as $glob)
+ {
+ if (!isset($_[$glob['type']]))
+ $_[$glob['type']] = [];
+
+ $_[$glob['type']][] = $glob['typeId'];
+ }
+
+ foreach ($_ as $type => $ids)
+ {
+ switch ($type)
+ {
+ case TYPE_NPC: (new CreatureList(array(['ct.entry', $ids])))->addGlobalsToJscript($tv['lvData']); break;
+ case TYPE_OBJECT: (new GameobjectList(array(['gt.entry', $ids])))->addGlobalsToJscript($tv['lvData']); break;
+ case TYPE_ITEM: (new ItemList(array(['it.entry', $ids])))->addGlobalsToJscript($tv['lvData']); break;
+ case TYPE_ITEMSET: (new ItemsetList(array(['id', $ids])))->addGlobalsToJscript($tv['lvData']); break;
+ case TYPE_QUEST: (new QuestList(array(['qt.entry', $ids])))->addGlobalsToJscript($tv['lvData']); break;
+ case TYPE_SPELL: (new SpellList(array(['s.id', $ids])))->addGlobalsToJscript($tv['lvData']); break;
+ case TYPE_ZONE: (new ZoneList(array(['z.id', $ids])))->addGlobalsToJscript($tv['lvData']); break;
+ case TYPE_FACTION: (new FactionList(array(['id', $ids])))->addGlobalsToJscript($tv['lvData']); break;
+ case TYPE_PET: (new PetList(array(['id', $ids])))->addGlobalsToJscript($tv['lvData']); break;
+ case TYPE_ACHIEVEMENT: (new AchievementList(array(['id', $ids])))->addGlobalsToJscript($tv['lvData']); break;
+ case TYPE_TITLE: (new TitleList(array(['id', $ids])))->addGlobalsToJscript($tv['lvData']); break;
+ case TYPE_WORLDEVENT: (new WorldEventList(array(['id', $ids])))->addGlobalsToJscript($tv['lvData']); break;
+ case TYPE_CLASS: (new CharClassList(array(['id', $ids])))->addGlobalsToJscript($tv['lvData']); break;
+ case TYPE_RACE: (new CharRaceList(array(['id', $ids])))->addGlobalsToJscript($tv['lvData']); break;
+ case TYPE_SKILL: (new SkillList(array(['id', $ids])))->addGlobalsToJscript($tv['lvData']); break;
+ case TYPE_CURRENCY: (new CurrencyList(array(['id', $ids])))->addGlobalsToJscript($tv['lvData']); break;
+ }
+ }
+ }
+ }
+
+ // since it's the same for every page, except index..
+ if ($tv['query'][0] && !preg_match('/[^a-z]/i', $tv['query'][0]))
+ {
+ $ann = DB::Aowow()->Select('SELECT * FROM ?_announcements WHERE status = 1 AND (page = ?s OR page = "*")', $tv['query'][0]);
foreach ($ann as $k => $v)
{
if ($t = Util::localizedString($v, 'text'))
diff --git a/pages/itemset.php b/pages/itemset.php
index 6e795837..332ff9ef 100644
--- a/pages/itemset.php
+++ b/pages/itemset.php
@@ -164,7 +164,6 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
'title' => $name, // for header
'path' => $path,
'infobox' => $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null,
- 'article' => null, // todo (med): hmm, move to $smarty..?
'pieces' => $pieces,
'spells' => $spells,
'view3D' => json_encode($eqList, JSON_NUMERIC_CHECK),
diff --git a/template/achievement.tpl b/template/achievement.tpl
index 58fffe09..1247c6b9 100644
--- a/template/achievement.tpl
+++ b/template/achievement.tpl
@@ -3,165 +3,167 @@
+
{if !empty($announcements)}
{foreach from=$announcements item=item}
{include file='bricks/announcement.tpl' an=$item}
{/foreach}
{/if}
-
+ //]]>
-
- | {$lang.quickFacts} |
- |
-
- |
-{strip}{*************** CHAIN OF ACHIEVEMENTS ***************}
- {if isset($lvData.page.series)}
- | {$lang.series} |
-
-
- {section name=i loop=$lvData.page.series}
-
- | {$smarty.section.i.index+1}. |
-
- {if ($lvData.page.series[i].id == $lvData.page.id)}
- {$lvData.page.series[i].name}
- {else}
-
- {/if}
- |
-
- {/section}
-
- |
-
- {/if}
- {/strip}{*************** / CHAIN OF ACHIEVEMENTS ***************}
- | {$lang.screenshots} |
- |
- | {$lang.videos} |
- |
-
-
-
+{* include file='bricks/infobox.tpl' *}
-
-
-
-
-
-
-
- {$lang.links}{$lang.links}
-
WowheadWowhead
-
{$lvData.page.name}
-
- {$lvData.page.description}
-
- {if !empty($lvData.page.criteria)}
{$lang.criteria}{if $lvData.page.count} – {$lang.requires} {$lvData.page.count} {$lang.outOf} {$lvData.page.total_criteria}{/if}
{/if}
-
-
-
- {strip}
- {foreach from=$lvData.page.criteria item=cr name=criteria}
-
- |
- {* for reference and standard entries *}
- {if !isset($cr.icon) && (isset($cr.link) || $cr.standard)}
-
- {/if}
- |
-
- {if isset($cr.link)}{$cr.link.text|escape:"html"}{if isset($cr.link.count) && $cr.link.count > 1} ({$cr.link.count}){/if}{/if}
-
- {* STANDARD TEXT *}
- {if isset($cr.extra_text)} {$cr.extra_text}{/if}
- {if $user.roles > 0} [{$cr.id}]{/if}
+
+ | {$lang.quickFacts} |
+ |
+
+ |
+ {strip}{*************** CHAIN OF ACHIEVEMENTS ***************}
+ {if isset($lvData.page.series)}
+ | {$lang.series} |
+
+
+ {section name=i loop=$lvData.page.series}
+
+ | {$smarty.section.i.index+1}. |
+
+ {if ($lvData.page.series[i].id == $lvData.page.id)}
+ {$lvData.page.series[i].name}
+ {else}
+
+ {/if}
+ |
+
+ {/section}
+
|
- {* If the first column is over (it may be a greater element) *}
- {if $smarty.foreach.criteria.index+1 == round(count($lvData.page.criteria) / 2)}
+ {/if}
+ {/strip}{*************** / CHAIN OF ACHIEVEMENTS ***************}
+ | {$lang.screenshots} |
+ |
+ | {$lang.videos} |
+ |
+
+
+
+
+
+
+
+
+
+
+ {$lang.links}{$lang.links}
+ WowheadWowhead
+ {$lvData.page.name}
+
+ {$lvData.page.description}
+
+ {if !empty($lvData.page.criteria)} {$lang.criteria}{if $lvData.page.count} – {$lang.requires} {$lvData.page.count} {$lang.outOf} {$lvData.page.total_criteria}{/if}{/if}
+
+
+
+ {strip}
+ {foreach from=$lvData.page.criteria item=cr name=criteria}
+
+ |
+ {* for reference and standard entries *}
+ {if !isset($cr.icon) && (isset($cr.link) || $cr.standard)}
+
+ {/if}
+ |
+
+ {if isset($cr.link)}{$cr.link.text|escape:"html"}{if isset($cr.link.count) && $cr.link.count > 1} ({$cr.link.count}){/if}{/if}
+
+ {* STANDARD TEXT *}
+ {if isset($cr.extra_text)} {$cr.extra_text}{/if}
+ {if $user.roles > 0} [{$cr.id}]{/if}
+ |
+
+ {* If the first column is over (it may be a greater element) *}
+ {if $smarty.foreach.criteria.index+1 == round(count($lvData.page.criteria) / 2)}
+
+
+
+
+ {/if}
+ {/foreach}
+ {/strip}
-
-
- {/if}
- {/foreach}
- {/strip}
-
-
- {strip}
-
- {/strip}
+ {strip}
+
+ {/strip}
-
+
- {* for items *}
- {if $lvData.page.itemReward}
- {$lang.rewards}
- {$lang.itemReward}
-
- {foreach from=$lvData.page.itemReward item=i name=item key=id}
- | {$i.name} |
- {/foreach}
-
-
-
- {/if}
+ {* for items *}
+ {if $lvData.page.itemReward}
+ {$lang.rewards}
+ {$lang.itemReward}
+
+ {foreach from=$lvData.page.itemReward item=i name=item key=id}
+ | {$i.name} |
+ {/foreach}
+
+
+
+ {/if}
- {* for titles *}
- {if $lvData.page.titleReward}
- {$lang.gains}
-
- {foreach from=$lvData.page.titleReward item=i}
- {$i}
- {/foreach}
-
- {/if}
+ {* for titles *}
+ {if $lvData.page.titleReward}
+ {$lang.gains}
+
+ {foreach from=$lvData.page.titleReward item=i}
+ {$i}
+ {/foreach}
+
+ {/if}
- {$lang.related}
+ {$lang.related}
-
+
-
-
-
+
+
+
{include file='bricks/contribute.tpl'}
-
+
-{include file='footer.tpl'}
\ No newline at end of file
+{include file='footer.tpl'}
diff --git a/template/bricks/article.tpl b/template/bricks/article.tpl
new file mode 100644
index 00000000..d47e96ac
--- /dev/null
+++ b/template/bricks/article.tpl
@@ -0,0 +1,8 @@
+{if !empty($article)}
+
+
+
+
+{/if}
\ No newline at end of file
diff --git a/template/itemset.tpl b/template/itemset.tpl
index 4f54caf3..bd7f7919 100644
--- a/template/itemset.tpl
+++ b/template/itemset.tpl
@@ -3,17 +3,18 @@
+
{if !empty($announcements)}
{foreach from=$announcements item=item}
{include file='bricks/announcement.tpl' an=$item}
{/foreach}
{/if}
-
+ //]]>
{include file='bricks/infobox.tpl'}
@@ -24,12 +25,7 @@
WowheadWowhead
{$lvData.page.name}
-{if $lvData.article}
-
-
-{/if}
+{include file='bricks/article.tpl'}
{$lvData.page.description}
@@ -45,11 +41,11 @@
{/section}
|
-
+ //]]>
{if $lvData.page.unavailable}
{$lang._unavailable}
@@ -74,19 +70,19 @@
{$lang.related}
-
-
-
+ new Listview({ldelim}template: 'comment', id: 'comments', name: LANG.tab_comments, tabs: tabsRelated, parent: 'listview-generic', data: lv_comments{rdelim});
+ new Listview({ldelim}template: 'screenshot', id: 'screenshots', name: LANG.tab_screenshots, tabs: tabsRelated, parent: 'listview-generic', data: lv_screenshots{rdelim});
+ if (lv_videos.length || (g_user && g_user.roles & (U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_VIDEO)))
+ new Listview({ldelim}template: 'video', id: 'videos', name: LANG.tab_videos, tabs: tabsRelated, parent: 'listview-generic', data: lv_videos{rdelim});
+ tabsRelated.flush();
+ //]]>
- {include file='bricks/contribute.tpl'}
+{include file='bricks/contribute.tpl'}
diff --git a/template/spell.tpl b/template/spell.tpl
index 34e91152..b656326a 100644
--- a/template/spell.tpl
+++ b/template/spell.tpl
@@ -1,19 +1,25 @@
{include file='header.tpl'}
{assign var="iconlist1" value="1"}
{assign var="iconlist2" value="1"}
-
-
-
+
+
+
-
+ var g_pageInfo = {ldelim}type: {$page.type}, typeId: {$page.typeId}, name: '{$lvData.page.name|escape:"javascript"}'{rdelim};
+ g_initPath({$page.path});
+
{include file='bricks/infobox.tpl'}
-
+
WowheadWowhead
{$lvData.page.name}
-
-
-
+
+
+
-
+
- {if !empty($lvData.page.buff)}
-
{$lang._aura}
-
-
- {/if}
+ {if !empty($lvData.page.buff)}
+
{$lang._aura}
+
+
+ {/if}
{if $lvData.page.reagents}{if $lvData.page.tools}
{/if}
-
{$lang.reagents}
-
+ {$lang.reagents}
+
-
-{if $lvData.page.tools}{/if}{/if}
-{if $lvData.page.tools}{if $lvData.page.reagents}{/if}
-
{$lang.tools}
-
-
-{if $lvData.page.reagents}
{/if}{/if}
-
-
- {$lang._spellDetails}
-
-
-
-
-
-
-
-
- |
-
-
-
- |
-
-
- | {$lang.duration} |
- {$lvData.page.duration} |
-
-
- | {$lang.school} |
- {$lvData.page.school} |
-
-
- | {$lang.mechanic} |
- {$lvData.page.mechanic} |
-
-
- | {$lang.dispelType} |
- {$lvData.page.dispel} |
-
-
- | {$lang._gcdCategory} |
- {$lvData.page.gcdCat} |
-
-
- |
-
-
- | {$lang._cost} |
- {if !empty($lvData.page.powerCost)}{$lvData.page.powerCost}{else}{$lang._none}{/if} |
-
-
- | {$lang._range} |
- {$lvData.page.range} {$lang._distUnit} ({$lvData.page.rangeName}) |
-
-
- | {$lang._castTime} |
- {$lvData.page.castTime} |
-
-
- | {$lang._cooldown} |
- {$lvData.page.cooldown} |
-
-
- | {$lang._gcd} |
- {$lvData.page.gcd} |
-
-{if $lvData.page.stances}
-
- | {$lang._forms} |
- {$lvData.page.stances} |
-
-{/if}
-{if $lvData.page.items}
-
- | {$lang.requires2} |
- {$lvData.page.items} |
-
-{/if}
-{section name=i loop=$lvData.page.effect}
-
- | {$lang._effect} #{$smarty.section.i.index+1} |
-
- {$lvData.page.effect[i].name}
-
-
- {if isset($lvData.page.effect[i].value)} {$lang._value}{$lang.colon}{$lvData.page.effect[i].value}{/if}
- {if isset($lvData.page.effect[i].radius)} {$lang._radius}{$lang.colon}{$lvData.page.effect[i].radius} {$lang._distUnit}{/if}
- {if isset($lvData.page.effect[i].interval)} {$lang._interval}{$lang.colon}{$lvData.page.effect[i].interval} {$lang.seconds}{/if}
-
-{if isset($lvData.page.effect[i].icon)}
-
-{/if}
- |
-
+{section name=i loop=$lvData.page.reagents}
+ ge('iconlist-icon{$iconlist2++}').appendChild(g_items.createIcon({$lvData.page.reagents[i].entry}, 0, {$lvData.page.reagents[i].count}));
{/section}
-
+
+{if $lvData.page.tools}{/if}{/if}
+{if $lvData.page.tools}{if $lvData.page.reagents}{/if}
+
{$lang.tools}
+
+
+{if $lvData.page.reagents}
{/if}{/if}
- {$lang.related}
+
-
+{include file='bricks/article.tpl'}
-
-
-
+{/if}
+
+
+{/section}
+
+
+
{$lang.related}
+
+
+
+
+
+
- {include file='bricks/contribute.tpl'}
-
-
+ new Listview({ldelim}template: 'comment', id: 'comments', name: LANG.tab_comments, tabs: tabsRelated, parent: 'listview-generic', data: lv_comments{rdelim});
+ new Listview({ldelim}template: 'screenshot', id: 'screenshots', name: LANG.tab_screenshots, tabs: tabsRelated, parent: 'listview-generic', data: lv_screenshots{rdelim});
+ if (lv_videos.length || (g_user && g_user.roles & (U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_VIDEO)))
+ new Listview({ldelim}template: 'video', id: 'videos', name: LANG.tab_videos, tabs: tabsRelated, parent: 'listview-generic', data: lv_videos{rdelim});
+ tabsRelated.flush();
+ //]]>
+
+{include file='bricks/contribute.tpl'}
+
+
+
{include file='footer.tpl'}
diff --git a/template/title.tpl b/template/title.tpl
index dc6f2b54..88758844 100644
--- a/template/title.tpl
+++ b/template/title.tpl
@@ -3,45 +3,47 @@
+
{if !empty($announcements)}
{foreach from=$announcements item=item}
{include file='bricks/announcement.tpl' an=$item}
{/foreach}
{/if}
-
+ //]]>
{include file='bricks/infobox.tpl'}
-
- {$lang.links}{$lang.links}
-
+
{$lang.links}{$lang.links}
WowheadWowhead
{if isset($lvData.page.expansion)}{$lvData.page.name}{else}{$lvData.page.name}{/if}
+
+{include file='bricks/article.tpl'}
+
{$lang.related}
- {include file='bricks/contribute.tpl'}
+{include file='bricks/contribute.tpl'}
-{include file='footer.tpl'}
\ No newline at end of file
+{include file='footer.tpl'}