Moved most code related to jsGlobals to template. (Except for Globals, that belong to the object already created, it makes zero sense to look them up again from the template.)

I'm not overly happy with passing the templateObject to each typeObject, but it works .. for now.
Effectively this should reduce db-lookups as each type should be looked up only twice at max (once for relevant data on the page and maybe again to get related jsGlobals for the template)
also removed BaseType::addRewardsToJscript() get it with BaseType::addGlobalsToJscript() and the appropriate addMask

* added ListviewHelper::getSetFields() wich is more appropriate in some cases (like reagents for spells should be shown even if they are all the same)
* load bricks as needed, removed the if-blocks (maybe add the filename to every TypeClass..?)
This commit is contained in:
Sarjuuk
2013-07-11 21:29:05 +02:00
parent a8804f6440
commit 49800da2c8
43 changed files with 445 additions and 445 deletions

View File

@@ -7,6 +7,8 @@ class AchievementList extends BaseType
{ {
use listviewHelper; use listviewHelper;
public static $type = TYPE_ACHIEVEMENT;
public $criteria = []; public $criteria = [];
public $tooltip = []; public $tooltip = [];
@@ -42,38 +44,24 @@ class AchievementList extends BaseType
$this->reset(); // restore 'iterator' $this->reset(); // restore 'iterator'
} }
public function addRewardsToJScript(&$refs) public function addGlobalsToJscript(&$template, $addMask = GLOBALINFO_ANY)
{ {
$items = [];
$titles = [];
while ($this->iterate()) while ($this->iterate())
{ {
foreach ($this->curTpl['rewards'][TYPE_ITEM] as $_) if ($addMask & GLOBALINFO_SELF)
$items[] = $_; $template->extendGlobalData(self::$type, [$this->id => array(
foreach ($this->curTpl['rewards'][TYPE_TITLE] as $_)
$titles[] = $_;
}
if ($items)
(new ItemList(array(['i.entry', $items])))->addGlobalsToJscript($refs);
if ($titles)
(new TitleList(array(['id', $titles])))->addGlobalsToJscript($refs);
}
public function addGlobalsToJscript(&$refs)
{
if (!isset($refs['gAchievements']))
$refs['gAchievements'] = [];
while ($this->iterate())
{
$refs['gAchievements'][$this->id] = array(
'icon' => $this->curTpl['iconString'], 'icon' => $this->curTpl['iconString'],
'name' => Util::localizedString($this->curTpl, 'name') 'name' => Util::localizedString($this->curTpl, 'name')
); )]);
if ($addMask & GLOBALINFO_REWARDS)
{
foreach ($this->curTpl['rewards'][TYPE_ITEM] as $_)
$template->extendGlobalIds(TYPE_ITEM, $_);
foreach ($this->curTpl['rewards'][TYPE_TITLE] as $_)
$template->extendGlobalIds(TYPE_TITLE, $_);
}
} }
} }

View File

@@ -5,6 +5,8 @@ if (!defined('AOWOW_REVISION'))
class CharClassList extends BaseType class CharClassList extends BaseType
{ {
public static $type = TYPE_CLASS;
protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_classes WHERE [cond] ORDER BY Id ASC'; protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_classes WHERE [cond] ORDER BY Id ASC';
protected $matchQuery = 'SELECT COUNT(1) FROM ?_classes WHERE [cond]'; protected $matchQuery = 'SELECT COUNT(1) FROM ?_classes WHERE [cond]';
@@ -24,7 +26,7 @@ class CharClassList extends BaseType
'power' => $this->curTpl['powerType'], 'power' => $this->curTpl['powerType'],
); );
if ($this->curTpl['expansion'] == 2) // todo: grr, move to db if ($this->curTpl['expansion'] == 2) // todo (low): grr, move to db
$data[$this->id]['hero'] = 1; $data[$this->id]['hero'] = 1;
if ($this->curTpl['expansion']) if ($this->curTpl['expansion'])
@@ -34,13 +36,10 @@ class CharClassList extends BaseType
return $data; return $data;
} }
public function addGlobalsToJscript(&$refs) public function addGlobalsToJscript(&$template, $addMask = 0)
{ {
if (!isset($refs['gClasses']))
$refs['gClasses'] = [];
while ($this->iterate()) while ($this->iterate())
$refs['gClasses'][$this->id] = ['name' => $this->getField('name', true)]; $template->extendGlobalData(self::$type, [$this->id => ['name' => $this->getField('name', true)]]);
} }
public function addRewardsToJScript(&$ref) { } public function addRewardsToJScript(&$ref) { }

View File

@@ -5,6 +5,8 @@ if (!defined('AOWOW_REVISION'))
class CharRaceList extends BaseType class CharRaceList extends BaseType
{ {
public static $type = TYPE_RACE;
protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_races WHERE [cond] ORDER BY Id ASC'; protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_races WHERE [cond] ORDER BY Id ASC';
protected $matchQuery = 'SELECT COUNT(1) FROM ?_races WHERE [cond]'; protected $matchQuery = 'SELECT COUNT(1) FROM ?_races WHERE [cond]';
@@ -31,13 +33,10 @@ class CharRaceList extends BaseType
return $data; return $data;
} }
public function addGlobalsToJscript(&$refs) public function addGlobalsToJscript(&$template, $addMask = 0)
{ {
if (!isset($refs['gRaces']))
$refs['gRaces'] = [];
while ($this->iterate()) while ($this->iterate())
$refs['gRaces'][$this->id] = ['name' => $this->getField('name', true)]; $template->extendGlobalData(self::$type, [$this->id => ['name' => $this->getField('name', true)]]);
} }
public function addRewardsToJScript(&$ref) { } public function addRewardsToJScript(&$ref) { }

View File

@@ -8,6 +8,8 @@ class CreatureList extends BaseType
{ {
use spawnHelper; use spawnHelper;
public static $type = TYPE_NPC;
public $tooltips = []; public $tooltips = [];
protected $setupQuery = 'SELECT ct.*, ct.id AS ARRAY_KEY, ft.A, ft.H, ft.factionId FROM ?_creature ct LEFT JOIN ?_factiontemplate ft ON ft.id = ct.faction_A WHERE [filter] [cond]'; protected $setupQuery = 'SELECT ct.*, ct.id AS ARRAY_KEY, ft.A, ft.H, ft.factionId FROM ?_creature ct LEFT JOIN ?_factiontemplate ft ON ft.id = ct.faction_A WHERE [filter] [cond]';
@@ -151,16 +153,12 @@ class CreatureList extends BaseType
'location' => json_encode($this->getSpawns(SPAWNINFO_ZONES), JSON_NUMERIC_CHECK), 'location' => json_encode($this->getSpawns(SPAWNINFO_ZONES), JSON_NUMERIC_CHECK),
'name' => $this->getField('name', true), 'name' => $this->getField('name', true),
'tag' => $this->getField('subname', true), 'tag' => $this->getField('subname', true),
'type' => $this->curTpl['type'] 'type' => $this->curTpl['type'],
'react' => '['.$this->curTpl['A'].', '.$this->curTpl['H'].']'
); );
if ($addInfoMask & NPCINFO_TAMEABLE) if ($addInfoMask & NPCINFO_TAMEABLE) // only first skin of first model ... we're omitting potentially 11 skins here .. but the lv accepts only one .. w/e
{
// only first skin of first model ... we're omitting potentially 11 skins here .. but the lv accepts only one .. w/e
$data[$this->id]['skin'] = $this->curTpl['textureString']; $data[$this->id]['skin'] = $this->curTpl['textureString'];
$data[$this->id]['react'] = '['.$this->curTpl['A'].', '.$this->curTpl['H'].']';
}
} }
} }
@@ -168,13 +166,10 @@ class CreatureList extends BaseType
return $data; return $data;
} }
public function addGlobalsToJScript(&$refs) public function addGlobalsToJScript(&$template, $addMask = 0)
{ {
if (!isset($refs['gCreatures']))
$refs['gCreatures'] = [];
while ($this->iterate()) while ($this->iterate())
$refs['gCreatures'][$this->id] = ['name' => $this->getField('name', true)]; $template->extendGlobalData(TYPE_NPC, [$this->id => ['name' => $this->getField('name', true)]]);
} }
public function addRewardsToJScript(&$refs) { } public function addRewardsToJScript(&$refs) { }

View File

@@ -5,6 +5,8 @@ if (!defined('AOWOW_REVISION'))
class CurrencyList extends BaseType class CurrencyList extends BaseType
{ {
public static $type = TYPE_CURRENCY;
protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_currencies WHERE [cond] ORDER BY Id ASC'; protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_currencies WHERE [cond] ORDER BY Id ASC';
protected $matchQuery = 'SELECT COUNT(1) FROM ?_currencies WHERE [cond]'; protected $matchQuery = 'SELECT COUNT(1) FROM ?_currencies WHERE [cond]';
@@ -25,25 +27,17 @@ class CurrencyList extends BaseType
return $data; return $data;
} }
public function addGlobalsToJscript(&$refs) public function addGlobalsToJscript(&$template, $addMask = 0)
{ {
if (!isset($refs['gCurrencies']))
$refs['gCurrencies'] = [];
$data = [];
while ($this->iterate()) while ($this->iterate())
{ {
$refs['gCurrencies'][$this->id] = array( $template->extendGlobalData(self::$type, [$this->id => array(
'name' => $this->getField('name', true), 'name' => $this->getField('name', true),
'icon' => $this->curTpl['iconString'] 'icon' => $this->curTpl['iconString']
); )]);
}
} }
return $data;
}
public function addRewardsToJScript(&$ref) { }
public function renderTooltip() { } public function renderTooltip() { }
} }

View File

@@ -6,6 +6,8 @@ if (!defined('AOWOW_REVISION'))
class FactionList extends BaseType class FactionList extends BaseType
{ {
public static $type = TYPE_FACTION;
public static function getName($id) public static function getName($id)
{ {
$n = DB::Aowow()->SelectRow(' $n = DB::Aowow()->SelectRow('
@@ -35,8 +37,7 @@ class FactionList extends BaseType
} }
public function getListviewData() { } public function getListviewData() { }
public function addGlobalsToJScript(&$refs) { } public function addGlobalsToJScript(&$template, $addMask = 0) { }
public function addRewardsToJScript(&$refs) { }
public function renderTooltip() { } public function renderTooltip() { }
} }

View File

@@ -6,6 +6,8 @@ if (!defined('AOWOW_REVISION'))
class GameObjectList extends BaseType class GameObjectList extends BaseType
{ {
public static $type = TYPE_OBJECT;
public static function getName($id) public static function getName($id)
{ {
$n = DB::Aowow()->SelectRow(' $n = DB::Aowow()->SelectRow('
@@ -29,8 +31,7 @@ class GameObjectList extends BaseType
} }
public function getListviewData() { } public function getListviewData() { }
public function addGlobalsToJScript(&$refs) { } public function addGlobalsToJScript(&$template, $addMask = 0) { }
public function addRewardsToJScript(&$refs) { }
public function renderTooltip() { } public function renderTooltip() { }
} }

View File

@@ -5,6 +5,8 @@ if (!defined('AOWOW_REVISION'))
class ItemList extends BaseType class ItemList extends BaseType
{ {
public static $type = TYPE_ITEM;
public $tooltip = ''; public $tooltip = '';
public $json = []; public $json = [];
public $itemMods = []; public $itemMods = [];
@@ -148,7 +150,7 @@ class ItemList extends BaseType
{"source":[5],"sourcemore":[{"n":"Commander Oxheart","t":1,"ti":64606,"z":5842}], {"source":[5],"sourcemore":[{"n":"Commander Oxheart","t":1,"ti":64606,"z":5842}],
cost:[] format unk 0:copper, 1:[items]? 2, 3, 4, 5 cost:[] format unk 0:copper, 1:[items]? 2, 3, 4, 5
stack [unk, unk] stack [min, max] // when looting
avail unk avail unk
rel unk rel unk
glyph major | minor (as id) glyph major | minor (as id)
@@ -159,18 +161,15 @@ class ItemList extends BaseType
return $data; return $data;
} }
public function addGlobalsToJscript(&$refs) public function addGlobalsToJscript(&$template, $addMask = 0)
{ {
if (!isset($refs['gItems']))
$refs['gItems'] = [];
while ($this->iterate()) while ($this->iterate())
{ {
$refs['gItems'][$this->id] = array( $template->extendGlobalData(self::$type, [$this->id => array(
'name' => $this->getField('name', true), 'name' => $this->getField('name', true),
'quality' => $this->curTpl['Quality'], 'quality' => $this->curTpl['Quality'],
'icon' => $this->curTpl['icon'], 'icon' => $this->curTpl['icon']
); )]);
} }
} }

View File

@@ -7,8 +7,10 @@ class ItemsetList extends BaseType
{ {
use ListviewHelper; use ListviewHelper;
private $classes = []; // used to build g_classes public static $type = TYPE_ITEMSET;
public $pieceToSet = []; // used to build g_items and search public $pieceToSet = []; // used to build g_items and search
private $classes = []; // used to build g_classes
protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_itemset WHERE [filter] [cond] ORDER BY maxlevel DESC'; protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_itemset WHERE [filter] [cond] ORDER BY maxlevel DESC';
protected $matchQuery = 'SELECT COUNT(1) FROM ?_itemset WHERE [filter] [cond]'; protected $matchQuery = 'SELECT COUNT(1) FROM ?_itemset WHERE [filter] [cond]';
@@ -71,16 +73,15 @@ class ItemsetList extends BaseType
return $data; return $data;
} }
public function addGlobalsToJscript(&$refs) public function addGlobalsToJscript(&$template, $addMask = GLOBALINFO_ANY)
{ {
if ($this->classes) if ($this->classes && ($addMask & GLOBALINFO_RELATED))
(new CharClassList(array(['id', $this->classes])))->addGlobalsToJscript($refs); $template->extendGlobalIds(TYPE_CLASS, $this->classes);
if ($this->pieceToSet) if ($this->pieceToSet && ($addMask & GLOBALINFO_SELF))
(new ItemList(array(['i.entry', array_keys($this->pieceToSet)], 0)))->addGlobalsToJscript($refs); $template->extendGlobalIds(TYPE_ITEM, array_keys($this->pieceToSet));
} }
public function addRewardsToJScript(&$ref) { }
public function renderTooltip() { } public function renderTooltip() { }
} }

View File

@@ -7,6 +7,8 @@ class PetList extends BaseType
{ {
use ListviewHelper; use ListviewHelper;
public static $type = TYPE_PET;
protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_pet WHERE [cond] ORDER BY Id ASC'; protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_pet WHERE [cond] ORDER BY Id ASC';
protected $matchQuery = 'SELECT COUNT(1) FROM ?_pet WHERE [cond]'; protected $matchQuery = 'SELECT COUNT(1) FROM ?_pet WHERE [cond]';
@@ -44,19 +46,20 @@ class PetList extends BaseType
return $data; return $data;
} }
public function addGlobalsToJscript(&$refs) public function addGlobalsToJscript(&$template, $addMask = GLOBALINFO_ANY)
{ {
$gathered = [];
while ($this->iterate()) while ($this->iterate())
{
if ($addMask & GLOBALINFO_RELATED)
for ($i = 1; $i <= 4; $i++) for ($i = 1; $i <= 4; $i++)
if ($this->curTpl['spellId'.$i] > 0) if ($this->curTpl['spellId'.$i] > 0)
$gathered[] = (int)$this->curTpl['spellId'.$i]; $template->extendGlobalIds(TYPE_SPELL, $this->curTpl['spellId'.$i]);
if ($gathered) if ($addMask & GLOBALINFO_SELF)
(new SpellList(array(['s.id', $gathered])))->addGlobalsToJscript($refs); $template->extendGlobalData(self::$type, [$this->id => ['icon' => $this->curTpl['iconString']]]);
}
} }
public function addRewardsToJScript(&$ref) { }
public function renderTooltip() { } public function renderTooltip() { }
} }

View File

@@ -5,6 +5,8 @@ if (!defined('AOWOW_REVISION'))
class QuestList extends BaseType class QuestList extends BaseType
{ {
public static $type = TYPE_QUEST;
public $cat1 = 0; public $cat1 = 0;
public $cat2 = 0; public $cat2 = 0;
@@ -128,45 +130,6 @@ class QuestList extends BaseType
return $data; return $data;
} }
public function addRewardsToJscript(&$refs)
{
$items = [];
$spells = [];
$titles = [];
while ($this->iterate())
{
// items
for ($i = 1; $i < 5; $i++)
if ($this->curTpl['RewardItemId'.$i] > 0)
$items[] = $this->curTpl['RewardItemId'.$i];
for ($i = 1; $i < 7; $i++)
if ($this->curTpl['RewardChoiceItemId'.$i] > 0)
$items[] = $this->curTpl['RewardChoiceItemId'.$i];
// spells
if ($this->curTpl['RewardSpell'] > 0)
$spells[] = $this->curTpl['RewardSpell'];
if ($this->curTpl['RewardSpellCast'] > 0)
$spells[] = $this->curTpl['RewardSpellCast'];
// titles
if ($this->curTpl['RewardTitleId'] > 0)
$titles[] = $this->curTpl['RewardTitleId'];
}
if ($items)
(new ItemList(array(['i.entry', $items])))->addGlobalsToJscript($refs);
if ($spells)
(new SpellList(array(['s.id', $spells])))->addGlobalsToJscript($refs);
if ($titles)
(new TitleList(array(['id', $titles])))->addGlobalsToJscript($refs);
}
private function parseText($type = 'Objectives') private function parseText($type = 'Objectives')
{ {
$replace = array( $replace = array(
@@ -263,16 +226,35 @@ class QuestList extends BaseType
return $x; return $x;
} }
public function addGlobalsToJScript(&$refs) public function addGlobalsToJScript(&$template, $addMask = GLOBALINFO_ANY)
{ {
if (!isset($refs['gQuests']))
$refs['gQuests'] = [];
while ($this->iterate()) while ($this->iterate())
{ {
$refs['gQuests'][$this->id] = array( if ($addMask & GLOBALINFO_REWARDS)
'name' => $this->getField('Title', true) {
); // items
for ($i = 1; $i < 5; $i++)
if ($this->curTpl['RewardItemId'.$i] > 0)
$template->extendGlobalIds(TYPE_ITEM, $this->curTpl['RewardItemId'.$i]);
for ($i = 1; $i < 7; $i++)
if ($this->curTpl['RewardChoiceItemId'.$i] > 0)
$template->extendGlobalIds(TYPE_ITEM, $this->curTpl['RewardChoiceItemId'.$i]);
// spells
if ($this->curTpl['RewardSpell'] > 0)
$template->extendGlobalIds(TYPE_SPELL, $this->curTpl['RewardSpell']);
if ($this->curTpl['RewardSpellCast'] > 0)
$template->extendGlobalIds(TYPE_SPELL, $this->curTpl['RewardSpellCast']);
// titles
if ($this->curTpl['RewardTitleId'] > 0)
$template->extendGlobalIds(TYPE_TITLE, $this->curTpl['RewardTitleId']);
}
if ($addMask & GLOBALINFO_SELF)
$template->extendGlobalData(self::$type, [$this->id => ['name' => $this->getField('Title', true)]]);
} }
} }
} }

View File

@@ -6,6 +6,8 @@ if (!defined('AOWOW_REVISION'))
class SkillList extends BaseType class SkillList extends BaseType
{ {
public static $type = TYPE_SKILL;
public static function getName($id) public static function getName($id)
{ {
$n = DB::Aowow()->SelectRow(' $n = DB::Aowow()->SelectRow('
@@ -25,8 +27,7 @@ class SkillList extends BaseType
} }
public function getListviewData() { } public function getListviewData() { }
public function addGlobalsToJScript(&$refs) { } public function addGlobalsToJScript(&$template, $addMask = 0) { }
public function addRewardsToJScript(&$refs) { }
public function renderTooltip() { } public function renderTooltip() { }
} }

View File

@@ -13,6 +13,7 @@ class SpellList extends BaseType
public $relItems = null; public $relItems = null;
public $sources = []; public $sources = [];
public static $type = TYPE_SPELL;
public static $skillLines = array( public static $skillLines = array(
6 => [43, 44, 45, 46, 54, 55, 95, 118, 136, 160, 162, 172, 173, 176, 226, 228, 229, 473], // Weapons 6 => [43, 44, 45, 46, 54, 55, 95, 118, 136, 160, 162, 172, 173, 176, 226, 228, 229, 473], // Weapons
8 => [293, 413, 414, 415, 433], // Armor 8 => [293, 413, 414, 415, 433], // Armor
@@ -1625,48 +1626,40 @@ class SpellList extends BaseType
return $result; return $result;
} }
public function addGlobalsToJScript(&$refs) public function addGlobalsToJScript(&$template, $addMask = GLOBALINFO_ANY)
{ {
if ($this->relItems) if ($this->relItems && ($addMask & GLOBALINFO_RELATED))
{ {
$this->relItems->reset(); $this->relItems->reset();
$this->relItems->addGlobalsToJscript($refs); $this->relItems->addGlobalsToJscript($template);
} }
$classes = [];
$races = [];
if (!isset($refs['gSpells']))
$refs['gSpells'] = [];
while ($this->iterate()) while ($this->iterate())
{
if ($addMask & GLOBALINFO_RELATED)
{ {
if ($mask = $this->curTpl['reqClassMask']) if ($mask = $this->curTpl['reqClassMask'])
for ($i = 0; $i < 11; $i++) for ($i = 0; $i < 11; $i++)
if ($mask & (1 << $i)) if ($mask & (1 << $i))
$classes[] = $i + 1; $template->extendGlobalIds(TYPE_CLASS, $i + 1);
if ($mask = $this->curTpl['reqRaceMask']) if ($mask = $this->curTpl['reqRaceMask'])
for ($i = 0; $i < 11; $i++) for ($i = 0; $i < 11; $i++)
if ($mask & (1 << $i)) if ($mask & (1 << $i))
$races[] = $i + 1; $template->extendGlobalIds(TYPE_RACE, $i + 1);
}
if ($addMask & GLOBALINFO_SELF)
{
$iconString = $this->curTpl['iconStringAlt'] ? 'iconStringAlt' : 'iconString'; $iconString = $this->curTpl['iconStringAlt'] ? 'iconStringAlt' : 'iconString';
$refs['gSpells'][$this->id] = array( $template->extendGlobalData(self::$type, [$this->id => array(
'icon' => $this->curTpl[$iconString], 'icon' => $this->curTpl[$iconString],
'name' => $this->getField('name', true), 'name' => $this->getField('name', true),
); )]);
}
} }
if ($classes)
(new CharClassList(array(['id', $classes])))->addGlobalsToJScript($refs);
if ($races)
(new CharRaceList(array(['id', $races])))->addGlobalsToJScript($refs);
} }
public function addRewardsToJScript(&$refs) { }
} }

View File

@@ -7,6 +7,8 @@ class TitleList extends BaseType
{ {
use listviewHelper; use listviewHelper;
public static $type = TYPE_TITLE;
public $sources = []; public $sources = [];
protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_titles WHERE [cond] ORDER BY Id ASC'; protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_titles WHERE [cond] ORDER BY Id ASC';
@@ -59,18 +61,19 @@ class TitleList extends BaseType
return $data; return $data;
} }
public function addGlobalsToJscript(&$refs) public function addGlobalsToJscript(&$template, $addMask = 0)
{ {
if (!isset($refs['gTitles'])) $data = [];
$refs['gTitles'] = [];
while ($this->iterate()) while ($this->iterate())
{ {
$refs['gTitles'][$this->id]['name'] = Util::jsEscape($this->getField('male', true)); $data[$this->id]['name'] = Util::jsEscape($this->getField('male', true));
if ($_ = $this->getField('female', true)) if ($_ = $this->getField('female', true))
$refs['gTitles'][$this->id]['namefemale'] = $_; $data[$this->id]['namefemale'] = $_;
} }
$template->extendGlobalData(self::$type, $data);
} }
private function createSource() private function createSource()
@@ -143,7 +146,6 @@ class TitleList extends BaseType
return str_replace('%s', '<span class="q0">&lt;'.Lang::$main['name'].'&gt;</span>', $this->getField($field, true)); return str_replace('%s', '<span class="q0">&lt;'.Lang::$main['name'].'&gt;</span>', $this->getField($field, true));
} }
public function addRewardsToJScript(&$ref) { }
public function renderTooltip() { } public function renderTooltip() { }
private function faction2Side(&$faction) // thats weird.. and hopefully unique to titles private function faction2Side(&$faction) // thats weird.. and hopefully unique to titles

View File

@@ -5,33 +5,7 @@ if (!defined('AOWOW_REVISION'))
class WorldEventList extends BaseType class WorldEventList extends BaseType
{ {
private static $holidayIcons = [ public static $type = TYPE_WORLDEVENT;
141 => 'calendar_winterveilstart',
327 => 'calendar_lunarfestivalstart',
335 => 'calendar_loveintheairstart',
423 => 'calendar_loveintheairstart',
181 => 'calendar_noblegardenstart',
201 => 'calendar_childrensweekstart',
341 => 'calendar_midsummerstart',
62 => 'inv_misc_missilelarge_red',
321 => 'calendar_harvestfestivalstart',
398 => 'calendar_piratesdaystart',
372 => 'calendar_brewfeststart',
324 => 'calendar_hallowsendstart',
409 => 'calendar_dayofthedeadstart',
404 => 'calendar_harvestfestivalstart',
283 => 'inv_jewelry_necklace_21',
284 => 'inv_misc_rune_07',
400 => 'achievement_bg_winsoa',
420 => 'achievement_bg_winwsg',
285 => 'inv_jewelry_amulet_07',
353 => 'spell_nature_eyeofthestorm',
301 => 'calendar_fishingextravaganzastart',
424 => 'calendar_fishingextravaganzastart',
374 => 'calendar_darkmoonfaireelwynnstart',
375 => 'calendar_darkmoonfairemulgorestart',
376 => 'calendar_darkmoonfaireterokkarstart'
];
protected $setupQuery = 'SELECT *, -e.id AS ARRAY_KEY, -e.id as id FROM ?_events e LEFT JOIN ?_holidays h ON e.holidayId = h.id WHERE [cond] ORDER BY -e.id ASC'; protected $setupQuery = 'SELECT *, -e.id AS ARRAY_KEY, -e.id as id FROM ?_events e LEFT JOIN ?_holidays h ON e.holidayId = h.id WHERE [cond] ORDER BY -e.id ASC';
protected $matchQuery = 'SELECT COUNT(1) FROM ?_events e LEFT JOIN ?_holidays h ON e.holidayId = h.id WHERE [cond]'; protected $matchQuery = 'SELECT COUNT(1) FROM ?_events e LEFT JOIN ?_holidays h ON e.holidayId = h.id WHERE [cond]';
@@ -158,27 +132,17 @@ class WorldEventList extends BaseType
return $data; return $data;
} }
public function setup() public function addGlobalsToJScript(&$template, $addMask = 0)
{ {
foreach (self::$holidayIcons as $id => $s)
DB::Aowow()->Query('UPDATE ?_holidays SET iconString = ?s WHERE id = ?', $s, $id);
}
public function addGlobalsToJScript(&$refs)
{
if (!isset($refs['gHolidays']))
$refs['gHolidays'] = [];
while ($this->iterate()) while ($this->iterate())
{ {
$refs['gHolidays'][$this->id] = array( $template->extendGlobalData(self::$type, [$this->id => array(
'name' => $this->getField('name', true), 'name' => $this->getField('name', true),
'icon' => $this->curTpl['iconString'] 'icon' => $this->curTpl['iconString']
); )]);
} }
} }
public function addRewardsToJScript(&$ref) { }
public function renderTooltip() { } public function renderTooltip() { }
} }

View File

@@ -11,6 +11,8 @@ if (!defined('AOWOW_REVISION'))
class ZoneList extends BaseType class ZoneList extends BaseType
{ {
public static $type = TYPE_ZONE;
protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_zones z WHERE [cond] ORDER BY Id ASC'; protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_zones z WHERE [cond] ORDER BY Id ASC';
protected $matchQuery = 'SELECT COUNT(1) FROM ?_zones WHERE [cond]'; protected $matchQuery = 'SELECT COUNT(1) FROM ?_zones WHERE [cond]';
@@ -148,16 +150,12 @@ visibleCols: ['heroiclevel', 'players']
return $data; return $data;
} }
public function addGlobalsToJscript(&$refs) public function addGlobalsToJscript(&$template, $addMask = 0)
{ {
if (!isset($refs['gZones']))
$refs['gZones'] = [];
while ($this->iterate()) while ($this->iterate())
$refs['gZones'][$this->id]['name'] = Util::jsEscape($this->getField('name', true)); $template->extendGlobalData(self::$type, [$this->id => ['name' => Util::jsEscape($this->getField('name', true))]]);
} }
public function addRewardsToJScript(&$ref) { }
public function renderTooltip() { } public function renderTooltip() { }
} }

View File

@@ -87,7 +87,12 @@ define('LOCALE_DE', 3);
define('LOCALE_ES', 6); define('LOCALE_ES', 6);
define('LOCALE_RU', 8); define('LOCALE_RU', 8);
// conditional information in listviews // conditional information in template
define('GLOBALINFO_SELF', 0x1); // id, name, icon
define('GLOBALINFO_RELATED', 0x2); // spells used by pet, classes/races required by spell, ect
define('GLOBALINFO_REWARDS', 0x4); // items rewarded by achievement/quest, ect
define('GLOBALINFO_ANY', 0xF);
define('ITEMINFO_JSON', 0x1); define('ITEMINFO_JSON', 0x1);
define('ITEMINFO_SUBITEMS', 0x2); define('ITEMINFO_SUBITEMS', 0x2);
define('ITEMINFO_VENDOR', 0x4); define('ITEMINFO_VENDOR', 0x4);

View File

@@ -249,11 +249,7 @@ abstract class BaseType
abstract public function getListviewData(); abstract public function getListviewData();
// should return data to extend global js variables for a certain type (e.g. g_items) // should return data to extend global js variables for a certain type (e.g. g_items)
abstract public function addGlobalsToJScript(&$ref); abstract public function addGlobalsToJScript(&$smarty, $addMask = GLOBALINFO_ANY);
// should return data to extend global js variables for the rewards provided by this type (e.g. g_titles)
// rewards will not always be required and only by Achievement and Quest .. but yeah.. maybe it should be merged with addGlobalsToJScript
abstract public function addRewardsToJScript(&$ref);
// NPC, GO, Item, Quest, Spell, Achievement, Profile would require this // NPC, GO, Item, Quest, Spell, Achievement, Profile would require this
abstract public function renderTooltip(); abstract public function renderTooltip();
@@ -261,6 +257,33 @@ abstract class BaseType
trait listviewHelper trait listviewHelper
{ {
public function hasSetFields($fields)
{
if (!is_array($fields))
return 0x0;
$result = 0x0;
$this->reset();
while ($this->iterate())
{
foreach ($fields as $k => $str)
{
if ($this->getField($str))
{
$result |= 1 << $k;
unset($fields[$k]);
}
}
if (empty($fields)) // all set .. return early
return $result;
}
return $result;
}
public function hasDiffFields($fields) public function hasDiffFields($fields)
{ {
if (!is_array($fields)) if (!is_array($fields))
@@ -604,12 +627,15 @@ class Lang
class SmartyAoWoW extends Smarty class SmartyAoWoW extends Smarty
{ {
private $config = []; private $config = [];
private $jsGlobals = [];
public function __construct($config) public function __construct($config)
{ {
$cwd = str_replace("\\", "/", getcwd()); $cwd = str_replace("\\", "/", getcwd());
$this->Smarty(); $this->Smarty();
$this->assign('appName', $config['page']['name']);
$this->assign('AOWOW_REVISION', AOWOW_REVISION);
$this->config = $config; $this->config = $config;
$this->template_dir = $cwd.'/template/'; $this->template_dir = $cwd.'/template/';
$this->compile_dir = $cwd.'/cache/template/'; $this->compile_dir = $cwd.'/cache/template/';
@@ -619,8 +645,6 @@ class SmartyAoWoW extends Smarty
$this->left_delimiter = '{'; $this->left_delimiter = '{';
$this->right_delimiter = '}'; $this->right_delimiter = '}';
$this->caching = false; // Total Cache, this site does not work $this->caching = false; // Total Cache, this site does not work
$this->assign('appName', $config['page']['name']);
$this->assign('AOWOW_REVISION', AOWOW_REVISION);
$this->_tpl_vars['page'] = array( $this->_tpl_vars['page'] = array(
'reqJS' => [], // <[string]> path to required JSFile 'reqJS' => [], // <[string]> path to required JSFile
'reqCSS' => [], // <[string,string]> path to required CSSFile, IE condition 'reqCSS' => [], // <[string,string]> path to required CSSFile, IE condition
@@ -630,6 +654,7 @@ class SmartyAoWoW extends Smarty
'typeId' => null, // [int] entry to display 'typeId' => null, // [int] entry to display
'path' => '[]' // [string] (js:array) path to preselect in the menu 'path' => '[]' // [string] (js:array) path to preselect in the menu
); );
$this->_tpl_vars['jsGlobals'] = [];
} }
// using Smarty::assign would overwrite every pair and result in undefined indizes // using Smarty::assign would overwrite every pair and result in undefined indizes
@@ -658,33 +683,10 @@ class SmartyAoWoW extends Smarty
foreach ($globals as $glob) foreach ($globals as $glob)
{ {
if (!isset($_[$glob['type']])) if (!isset($this->jsGlobals[$glob['type']]))
$_[$glob['type']] = []; $this->jsGlobals[$glob['type']] = [];
$_[$glob['type']][] = $glob['typeId']; $this->jsGlobals[$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;
}
} }
} }
} }
@@ -704,9 +706,103 @@ class SmartyAoWoW extends Smarty
$this->_tpl_vars['announcements'] = $ann; $this->_tpl_vars['announcements'] = $ann;
} }
$this->applyGlobals();
$this->_tpl_vars['mysql'] = DB::Aowow()->getStatistics();
parent::display($tpl); parent::display($tpl);
} }
public function extendGlobalIds($type, $data)
{
if (!$type || !$data)
return false;
if (!isset($this->jsGlobals[$type]))
$this->jsGlobals[$type] = [];
if (is_array($data))
foreach ($data as $id)
$this->jsGlobals[$type][] = (int)$id;
else if (is_numeric($data))
$this->jsGlobals[$type][] = (int)$data;
else
return false;
return true;
}
public function extendGlobalData($type, $data)
{
$this->initJSGlobal($type);
$_ = &$this->_tpl_vars['jsGlobals'][$type][1]; // shorthand
foreach ($data as $id => $set)
if (!isset($_[$id]))
$_[$id] = $set;
}
private function initJSGlobal($type)
{
$jsg = &$this->_tpl_vars['jsGlobals']; // shortcut
if (isset($jsg[$type]))
return;
switch ($type)
{ // [brickFile, [data]]
case TYPE_NPC: $jsg[TYPE_NPC] = ['creatures', []]; break;
case TYPE_OBJECT: $jsg[TYPE_OBJECT] = ['objects', []]; break;
case TYPE_ITEM: $jsg[TYPE_ITEM] = ['items', []]; break;
case TYPE_QUEST: $jsg[TYPE_QUEST] = ['quests', []]; break;
case TYPE_SPELL: $jsg[TYPE_SPELL] = ['spells', []]; break;
case TYPE_ZONE: $jsg[TYPE_ZONE] = ['zones', []]; break;
case TYPE_FACTION: $jsg[TYPE_FACTION] = ['factions', []]; break;
case TYPE_PET: $jsg[TYPE_PET] = ['pets', []]; break;
case TYPE_ACHIEVEMENT: $jsg[TYPE_ACHIEVEMENT] = ['achievements', []]; break;
case TYPE_TITLE: $jsg[TYPE_TITLE] = ['titles', []]; break;
case TYPE_WORLDEVENT: $jsg[TYPE_WORLDEVENT] = ['holidays', []]; break;
case TYPE_CLASS: $jsg[TYPE_CLASS] = ['classes', []]; break;
case TYPE_RACE: $jsg[TYPE_RACE] = ['races', []]; break;
case TYPE_SKILL: $jsg[TYPE_SKILL] = ['skills', []]; break;
case TYPE_CURRENCY: $jsg[TYPE_CURRENCY] = ['curencies', []]; break;
}
}
private function applyGlobals()
{
foreach ($this->jsGlobals as $type => $ids)
{
if (!$ids)
continue;
$this->initJSGlobal($type);
foreach ($ids as $k => $id) // filter already generated data, maybe we can save a lookup or two
if (isset($this->_tpl_vars['jsGlobals'][$type][$id]))
unset($ids[$k]);
switch ($type)
{
case TYPE_NPC: (new CreatureList(array(['ct.entry', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break;
case TYPE_OBJECT: (new GameobjectList(array(['gt.entry', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break;
case TYPE_ITEM: (new ItemList(array(['i.entry', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break;
case TYPE_QUEST: (new QuestList(array(['qt.entry', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break;
case TYPE_SPELL: (new SpellList(array(['s.id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break;
case TYPE_ZONE: (new ZoneList(array(['z.id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break;
case TYPE_FACTION: (new FactionList(array(['id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break;
case TYPE_PET: (new PetList(array(['id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break;
case TYPE_ACHIEVEMENT: (new AchievementList(array(['id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break;
case TYPE_TITLE: (new TitleList(array(['id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break;
case TYPE_WORLDEVENT: (new WorldEventList(array(['id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break;
case TYPE_CLASS: (new CharClassList(array(['id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break;
case TYPE_RACE: (new CharRaceList(array(['id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break;
case TYPE_SKILL: (new SkillList(array(['id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break;
case TYPE_CURRENCY: (new CurrencyList(array(['id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break;
}
}
}
public function notFound($subject) public function notFound($subject)
{ {
$this->updatePageVars(array( $this->updatePageVars(array(
@@ -716,6 +812,7 @@ class SmartyAoWoW extends Smarty
)); ));
$this->assign('lang', Lang::$main); $this->assign('lang', Lang::$main);
$this->assign('mysql', DB::Aowow()->getStatistics());
$this->display('404.tpl'); $this->display('404.tpl');
exit(); exit();

View File

@@ -75,7 +75,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
array_unshift($pageData['title'], $acv->getField('name', true)); array_unshift($pageData['title'], $acv->getField('name', true));
$acv->addRewardsToJscript($pageData); $acv->addGlobalsToJscript($smarty, GLOBALINFO_REWARDS);
$pageData['page'] = $acv->getDetailedData()[$id]; $pageData['page'] = $acv->getDetailedData()[$id];
$acv->reset(); $acv->reset();
@@ -110,8 +110,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
'tabs' => '$tabsRelated' 'tabs' => '$tabsRelated'
); );
$saList->addRewardsToJscript($pageData); $saList->addGlobalsToJscript($smarty);
$saList->addGlobalsToJscript($pageData);
// listview: "criteria of" // listview: "criteria of"
$refs = DB::Aowow()->SelectCol('SELECT refAchievement FROM ?_achievementcriteria WHERE Type = ?d AND value1 = ?d', $refs = DB::Aowow()->SelectCol('SELECT refAchievement FROM ?_achievementcriteria WHERE Type = ?d AND value1 = ?d',
@@ -129,8 +128,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
'tabs' => '$tabsRelated' 'tabs' => '$tabsRelated'
); );
$coList->addRewardsToJscript($pageData); $coList->addGlobalsToJscript($smarty);
$coList->addGlobalsToJscript($pageData);
} }
// create rewards // create rewards
@@ -259,8 +257,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
'type' => 'g_achievements', 'type' => 'g_achievements',
'id' => $obj, 'id' => $obj,
); );
if ($crtAcv = new AchievementList(array(['id', $obj]))) $smarty->extendGlobalIds(TYPE_ACHIEVEMENT, $obj);
$crtAcv->addGlobalsToJscript($pageData);
break; break;
// link to quest // link to quest
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST: case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST:
@@ -276,13 +273,12 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL: case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL:
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL: case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL:
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2: case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2:
$crtSpl = new SpellList(array(['s.id', $obj])); $text = !empty($crtName) ? $crtName : SpellList::getName($obj);
$text = !empty($crtName) ? $crtName : $crtSpl->getField('name', true);
$tmp['link'] = array( $tmp['link'] = array(
'href' => '?spell='.$obj, 'href' => '?spell='.$obj,
'text' => $text 'text' => $text
); );
$crtSpl->addGlobalsToJscript($pageData); $smarty->extendGlobalIds(TYPE_SPELL, $obj);
$tmp['icon'] = $iconId; $tmp['icon'] = $iconId;
$pageData['page']['icons'][] = array( $pageData['page']['icons'][] = array(
'itr' => $iconId++, 'itr' => $iconId++,
@@ -303,7 +299,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
'quality' => $crtItm->getField('Quality'), 'quality' => $crtItm->getField('Quality'),
'count' => $qty, 'count' => $qty,
); );
$crtItm->addGlobalsToJscript($pageData); $crtItm->addGlobalsToJscript($smarty);
$tmp['icon'] = $iconId; $tmp['icon'] = $iconId;
$pageData['page']['icons'][] = array( $pageData['page']['icons'][] = array(
'itr' => $iconId++, 'itr' => $iconId++,
@@ -405,9 +401,6 @@ $smarty->assign('community', CommunityContent::getAll(TYPE_ACHIEVEMENT, $id));
$smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$achievement)); $smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$achievement));
$smarty->assign('lvData', $pageData); $smarty->assign('lvData', $pageData);
// Mysql query execution statistics
$smarty->assign('mysql', DB::Aowow()->getStatistics());
// load the page // load the page
$smarty->display('achievement.tpl'); $smarty->display('achievement.tpl');

View File

@@ -82,8 +82,7 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter))
); );
// fill g_items, g_titles, g_achievements // fill g_items, g_titles, g_achievements
$acvList->addGlobalsToJscript($pageData); $acvList->addGlobalsToJscript($smarty);
$acvList->addRewardsToJScript($pageData);
// if we are have different cats display field // if we are have different cats display field
if ($acvList->hasDiffFields(['category'])) if ($acvList->hasDiffFields(['category']))
@@ -118,7 +117,6 @@ asort(Lang::$game['si']);
$smarty->updatePageVars($page); $smarty->updatePageVars($page);
$smarty->assign('filter', $filter); $smarty->assign('filter', $filter);
$smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$achievement)); $smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$achievement));
$smarty->assign('mysql', DB::Aowow()->getStatistics());
$smarty->assign('lvData', $pageData); $smarty->assign('lvData', $pageData);
$smarty->display('achievements.tpl'); $smarty->display('achievements.tpl');

View File

@@ -28,7 +28,6 @@ $page = array(
$smarty->updatePageVars($page); $smarty->updatePageVars($page);
$smarty->assign('lang', Lang::$main); $smarty->assign('lang', Lang::$main);
$smarty->assign('mysql', DB::Aowow()->getStatistics());
$smarty->assign('lvData', $pageData); $smarty->assign('lvData', $pageData);
$smarty->display('generic-no-filter.tpl'); $smarty->display('generic-no-filter.tpl');

View File

@@ -70,7 +70,6 @@ $smarty->updatePageVars(array(
)); ));
$smarty->assign('lvData', $pageData); $smarty->assign('lvData', $pageData);
$smarty->assign('lang', array_merge(Lang::$main, Lang::$compare)); $smarty->assign('lang', array_merge(Lang::$main, Lang::$compare));
$smarty->assign('mysql', DB::Aowow()->getStatistics());
$smarty->display('compare.tpl'); $smarty->display('compare.tpl');
?> ?>

View File

@@ -29,7 +29,7 @@ if (!$smarty->loadCache($cacheKey, $pageData))
'params' => [] 'params' => []
); );
$money->addGlobalsToJscript($pageData); $money->addGlobalsToJscript($smarty);
$smarty->saveCache($cacheKey, $pageData); $smarty->saveCache($cacheKey, $pageData);
} }
@@ -43,7 +43,6 @@ $page = array(
$smarty->updatePageVars($page); $smarty->updatePageVars($page);
$smarty->assign('lang', Lang::$main); $smarty->assign('lang', Lang::$main);
$smarty->assign('mysql', DB::Aowow()->getStatistics());
$smarty->assign('lvData', $pageData); $smarty->assign('lvData', $pageData);
$smarty->display('generic-no-filter.tpl'); $smarty->display('generic-no-filter.tpl');

View File

@@ -57,7 +57,7 @@ if (!$smarty->loadCache($cacheKey, $pageData))
) )
); );
$events->addGlobalsToJScript($pageData); $events->addGlobalsToJScript($smarty);
$smarty->saveCache($cacheKey, $pageData); $smarty->saveCache($cacheKey, $pageData);
} }
@@ -86,7 +86,6 @@ $page = array(
$smarty->updatePageVars($page); $smarty->updatePageVars($page);
$smarty->assign('lang', Lang::$main); $smarty->assign('lang', Lang::$main);
$smarty->assign('mysql', DB::Aowow()->getStatistics());
$smarty->assign('lvData', $pageData); $smarty->assign('lvData', $pageData);
$smarty->display('generic-no-filter.tpl'); $smarty->display('generic-no-filter.tpl');

View File

@@ -824,9 +824,6 @@ $smarty->assign('community', CommunityContent::getAll(TYPE_ITEM, $id));
$smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$item, ['colon' => Lang::$colon])); $smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$item, ['colon' => Lang::$colon]));
$smarty->assign('lvData', $pageData); $smarty->assign('lvData', $pageData);
// Mysql query execution statistics
$smarty->assign('mysql', $DB->getStatistics());
// load the page // load the page
$smarty->display('item.tpl'); $smarty->display('item.tpl');

View File

@@ -181,7 +181,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
) )
); );
$iSet->addGlobalsToJscript($pageData); $iSet->addGlobalsToJscript($smarty, GLOBALINFO_RELATED);
// related sets (priority: 1: similar tag + class; 2: has event; 3: no tag + similar type, 4: similar type + profession) // related sets (priority: 1: similar tag + class; 2: has event; 3: no tag + similar type, 4: similar type + profession)
$rel = []; $rel = [];
@@ -230,7 +230,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
if (!$mask) if (!$mask)
$pageData['related']['params']['hiddenCols'] = "$['classes']"; $pageData['related']['params']['hiddenCols'] = "$['classes']";
$relSets->addGlobalsToJscript($pageData); $relSets->addGlobalsToJscript($smarty);
} }
} }
@@ -253,7 +253,6 @@ $smarty->updatePageVars(array(
$smarty->assign('community', CommunityContent::getAll(TYPE_ITEMSET, $id)); // comments, screenshots, videos $smarty->assign('community', CommunityContent::getAll(TYPE_ITEMSET, $id)); // comments, screenshots, videos
$smarty->assign('lang', array_merge(Lang::$main, Lang::$itemset)); $smarty->assign('lang', array_merge(Lang::$main, Lang::$itemset));
$smarty->assign('lvData', $pageData); $smarty->assign('lvData', $pageData);
$smarty->assign('mysql', DB::Aowow()->getStatistics());
$smarty->display('itemset.tpl'); $smarty->display('itemset.tpl');
?> ?>

View File

@@ -20,7 +20,7 @@ if (!$smarty->loadCache($cacheKey, $pageData))
'params' => [] 'params' => []
); );
$itemsets->addGlobalsToJscript($pageData); $itemsets->addGlobalsToJscript($smarty);
// recreate form selection // recreate form selection
$filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : NULL; $filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : NULL;
@@ -62,7 +62,6 @@ asort(Lang::$game['cl']);
$smarty->updatePageVars($page); $smarty->updatePageVars($page);
$smarty->assign('filter', $filter); $smarty->assign('filter', $filter);
$smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$itemset, Lang::$item)); $smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$itemset, Lang::$item));
$smarty->assign('mysql', DB::Aowow()->getStatistics());
$smarty->assign('lvData', $pageData); $smarty->assign('lvData', $pageData);
$smarty->display('itemsets.tpl'); $smarty->display('itemsets.tpl');

View File

@@ -22,7 +22,6 @@ $page = array(
$smarty->updatePageVars($page); $smarty->updatePageVars($page);
$smarty->assign('lang', array_merge(Lang::$main, Lang::$maps)); $smarty->assign('lang', array_merge(Lang::$main, Lang::$maps));
$smarty->assign('mysql', DB::Aowow()->getStatistics());
$smarty->display('maps.tpl'); $smarty->display('maps.tpl');
?> ?>

View File

@@ -482,9 +482,6 @@ $smarty->assign('community', CommunityContent::getAll(TYPE_NPC, $id)); /
$smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$npc, ['colon' => Lang::$colon])); $smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$npc, ['colon' => Lang::$colon]));
$smarty->assign('lvData', $pageData); $smarty->assign('lvData', $pageData);
// Mysql query execution statistics
$smarty->assign('mysql', $DB->getStatistics());
// load the page // load the page
$smarty->display('npc.tpl'); $smarty->display('npc.tpl');

View File

@@ -18,7 +18,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
if ($pet->error) if ($pet->error)
$smarty->notFound(Lang::$game['pet']); $smarty->notFound(Lang::$game['pet']);
$pet->addGlobalsToJscript($pageData); // $pet->addGlobalsToJscript($smarty);
$pet->reset(); $pet->reset();
$infobox = []; $infobox = [];
@@ -83,7 +83,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$list[] = $i; $list[] = $i;
$food = new ItemList(array(['i.subClass', [5, 8]], ['i.FoodType', $list])); $food = new ItemList(array(['i.subClass', [5, 8]], ['i.FoodType', $list]));
$food->addGlobalsToJscript($pageData); $food->addGlobalsToJscript($smarty);
$pageData['diet'] = array( $pageData['diet'] = array(
'data' => $food->getListviewData(), 'data' => $food->getListviewData(),
@@ -126,7 +126,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$spells = new SpellList($conditions); $spells = new SpellList($conditions);
$spells->addGlobalsToJscript($pageData); $spells->addGlobalsToJscript($smarty, GLOBALINFO_SELF);
$pageData['abilities'] = array( $pageData['abilities'] = array(
'data' => $spells->getListviewData(), 'data' => $spells->getListviewData(),
@@ -148,7 +148,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
} }
$talents = new SpellList($conditions); $talents = new SpellList($conditions);
$talents->addGlobalsToJscript($pageData); $talents->addGlobalsToJscript($smarty, GLOBALINFO_SELF);
$pageData['talents'] = array( $pageData['talents'] = array(
'data' => $talents->getListviewData(), 'data' => $talents->getListviewData(),
@@ -180,7 +180,6 @@ $smarty->updatePageVars(array(
$smarty->assign('community', CommunityContent::getAll(TYPE_PET, $id)); // comments, screenshots, videos $smarty->assign('community', CommunityContent::getAll(TYPE_PET, $id)); // comments, screenshots, videos
$smarty->assign('lang', array_merge(Lang::$main, Lang::$game)); $smarty->assign('lang', array_merge(Lang::$main, Lang::$game));
$smarty->assign('lvData', $pageData); $smarty->assign('lvData', $pageData);
$smarty->assign('mysql', DB::Aowow()->getStatistics());
$smarty->display('pet.tpl'); $smarty->display('pet.tpl');
?> ?>

View File

@@ -34,7 +34,7 @@ if (!$smarty->loadCache($cacheKey, $pageData))
$pageData['params']['hiddenCols'] = "$['type']"; $pageData['params']['hiddenCols'] = "$['type']";
$pets->reset(); $pets->reset();
$pets->addGlobalsToJscript($pageData); $pets->addGlobalsToJscript($smarty, GLOBALINFO_RELATED);
$smarty->saveCache($cacheKey, $pageData); $smarty->saveCache($cacheKey, $pageData);
} }
@@ -49,7 +49,6 @@ $page = array(
$smarty->updatePageVars($page); $smarty->updatePageVars($page);
$smarty->assign('lang', Lang::$main); $smarty->assign('lang', Lang::$main);
$smarty->assign('lvData', $pageData); $smarty->assign('lvData', $pageData);
$smarty->assign('mysql', DB::Aowow()->getStatistics());
$smarty->display('generic-no-filter.tpl'); $smarty->display('generic-no-filter.tpl');
?> ?>

View File

@@ -613,9 +613,6 @@ $smarty->assign('community', CommunityContent::getAll(TYPE_QUEST, $id));
$smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$quest, ['colon' => Lang::$colon])); $smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$quest, ['colon' => Lang::$colon]));
$smarty->assign('lvData', $pageData); $smarty->assign('lvData', $pageData);
// Mysql query execution statistics
$smarty->assign('mysql', $DB->getStatistics());
// load the page // load the page
$smarty->display('quest.tpl'); $smarty->display('quest.tpl');

View File

@@ -28,7 +28,6 @@ $page = array(
$smarty->updatePageVars($page); $smarty->updatePageVars($page);
$smarty->assign('lang', Lang::$main); $smarty->assign('lang', Lang::$main);
$smarty->assign('mysql', DB::Aowow()->getStatistics());
$smarty->assign('lvData', $pageData); $smarty->assign('lvData', $pageData);
$smarty->display('generic-no-filter.tpl'); $smarty->display('generic-no-filter.tpl');

View File

@@ -187,7 +187,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$pageData['title'] = [$spell->getField('name', true), Util::ucFirst(Lang::$game['spell'])]; $pageData['title'] = [$spell->getField('name', true), Util::ucFirst(Lang::$game['spell'])];
// js-globals // js-globals
$spell->addGlobalsToJScript($pageData); $spell->addGlobalsToJScript($smarty, GLOBALINFO_RELATED);
// prepare Tools // prepare Tools
foreach ($pageData['page']['tools'] as $k => $tool) foreach ($pageData['page']['tools'] as $k => $tool)
@@ -273,7 +273,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
'count' => 0 'count' => 0
); );
$trig->addGlobalsToJScript($pageData); $trig->addGlobalsToJScript($smarty);
} }
// Effect Name // Effect Name
@@ -604,8 +604,8 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
] ]
); );
$modSpells->addGlobalsToJScript($pageData); $modSpells->addGlobalsToJScript($smarty);
if(!$modSpells->hasDiffFields(['skillLines'])) if(!$modSpells->hasSetFields(['skillLines']))
$pageData['modifies']['params']['hiddenCols'] = "$['skill']"; $pageData['modifies']['params']['hiddenCols'] = "$['skill']";
} }
} }
@@ -653,8 +653,8 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
] ]
); );
$modsSpell->addGlobalsToJScript($pageData); $modsSpell->addGlobalsToJScript($smarty);
if(!$modsSpell->hasDiffFields(['skillLines'])) if(!$modsSpell->hasSetFields(['skillLines']))
$pageData['modifiedBy']['params']['hiddenCols'] = "$['skill']"; $pageData['modifiedBy']['params']['hiddenCols'] = "$['skill']";
} }
} }
@@ -682,8 +682,8 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
] ]
); );
$saSpells->addGlobalsToJScript($pageData); $saSpells->addGlobalsToJScript($smarty);
if(!$saSpells->hasDiffFields(['skillLines'])) if(!$saSpells->hasSetFields(['skillLines']))
$pageData['seeAlso']['params']['hiddenCols'] = "$['skill']"; $pageData['seeAlso']['params']['hiddenCols'] = "$['skill']";
} }
@@ -706,7 +706,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
] ]
); );
$ubSets->addGlobalsToJScript($pageData); $ubSets->addGlobalsToJScript($smarty);
} }
@@ -732,7 +732,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
] ]
); );
$ubItems->addGlobalsToJScript($pageData); $ubItems->addGlobalsToJScript($smarty);
} }
// criteria of // criteria of
@@ -751,7 +751,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
] ]
); );
$coAchievemnts->addGlobalsToJScript($pageData); $coAchievemnts->addGlobalsToJScript($smarty);
} }
} }
@@ -771,7 +771,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
{ {
// todo (high): generic loot-processing function // todo (high): generic loot-processing function
$slItems = new ItemList(array(['i.entry', $ids])); $slItems = new ItemList(array(['i.entry', $ids]));
$slItems->addGlobalsToJscript($pageData); $slItems->addGlobalsToJscript($smarty);
$lv += $slItems->getListviewData(); $lv += $slItems->getListviewData();
$equal = true; $equal = true;
@@ -803,11 +803,10 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
{ {
if (($bar = $spell->getField('effect'.$i.'CreateItemId')) && isset($foo[$bar])) if (($bar = $spell->getField('effect'.$i.'CreateItemId')) && isset($foo[$bar]))
{ {
$reqSpec = new SpellList(array(['s.id', (int)$extraItem['requiredSpecialization']]));
$lv[$bar] = $foo[$bar]; $lv[$bar] = $foo[$bar];
$lv[$bar]['percent'] = $extraItem['additionalCreateChance']; $lv[$bar]['percent'] = $extraItem['additionalCreateChance'];
$lv[$bar]['condition'] = json_encode(['type' => TYPE_SPELL, 'typeId' => $reqSpec->id, 'status' => 2], JSON_NUMERIC_CHECK); $lv[$bar]['condition'] = json_encode(['type' => TYPE_SPELL, 'typeId' => $extraItem['requiredSpecialization'], 'status' => 2], JSON_NUMERIC_CHECK);
$reqSpec->addGlobalsToJscript($pageData); $smarty->extendGlobalIds(TYPE_SPELL, $extraItem['requiredSpecialization']);
$extraCols[] = 'Listview.extraCols.condition'; $extraCols[] = 'Listview.extraCols.condition';
if ($max = $extraItem['additionalMaxNum']) if ($max = $extraItem['additionalMaxNum'])
@@ -939,9 +938,6 @@ $smarty->assign('community', CommunityContent::getAll(TYPE_SPELL, $id));
$smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$spell, ['colon' => Lang::$colon])); $smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$spell, ['colon' => Lang::$colon]));
$smarty->assign('lvData', $pageData); $smarty->assign('lvData', $pageData);
// Mysql query execution statistics
$smarty->assign('mysql', DB::Aowow()->getStatistics());
// load the page // load the page
$smarty->display('spell.tpl'); $smarty->display('spell.tpl');

View File

@@ -381,7 +381,7 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter))
$pageData['data'] = $spells->getListviewData(); $pageData['data'] = $spells->getListviewData();
$spells->addGlobalsToJscript($pageData); $spells->addGlobalsToJscript($smarty, GLOBALINFO_SELF);
// create note if search limit was exceeded; overwriting 'note' is intentional // create note if search limit was exceeded; overwriting 'note' is intentional
if ($spells->getMatches() > $AoWoWconf['sqlLimit']) if ($spells->getMatches() > $AoWoWconf['sqlLimit'])
@@ -393,7 +393,7 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter))
if ($spells->filterGetError()) if ($spells->filterGetError())
$pageData['params']['_errors'] = '$1'; $pageData['params']['_errors'] = '$1';
$mask = $spells->hasDiffFields(['reagent1', 'skillLines', 'trainingCost']); $mask = $spells->hasSetFields(['reagent1', 'skillLines', 'trainingCost']);
if ($mask & 0x1) if ($mask & 0x1)
$visibleCols[] = 'reagents'; $visibleCols[] = 'reagents';
@@ -444,7 +444,6 @@ Lang::$game['race'] = Util::ucFirst(Lang::$game['race']);
$smarty->updatePageVars($page); $smarty->updatePageVars($page);
$smarty->assign('filter', $filter); $smarty->assign('filter', $filter);
$smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$achievement)); $smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$achievement));
$smarty->assign('mysql', DB::Aowow()->getStatistics());
$smarty->assign('lvData', $pageData); $smarty->assign('lvData', $pageData);
$smarty->display('spells.tpl'); $smarty->display('spells.tpl');

View File

@@ -35,7 +35,6 @@ if ($petCalc)
$smarty->updatePageVars($page); $smarty->updatePageVars($page);
$smarty->assign('tcType', $petCalc ? 'pc' : 'tc'); $smarty->assign('tcType', $petCalc ? 'pc' : 'tc');
$smarty->assign('lang', array_merge(Lang::$main, Lang::$talent)); $smarty->assign('lang', array_merge(Lang::$main, Lang::$talent));
$smarty->assign('mysql', DB::Aowow()->getStatistics());
$smarty->display('talent.tpl'); $smarty->display('talent.tpl');
?> ?>

View File

@@ -16,11 +16,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
if ($title->error) if ($title->error)
$smarty->notFound(Lang::$game['title']); $smarty->notFound(Lang::$game['title']);
$title->addGlobalsToJscript($pageData);
$title->reset();
$infobox = []; $infobox = [];
if ($title->getField('side') == SIDE_ALLIANCE) if ($title->getField('side') == SIDE_ALLIANCE)
$infobox[] = Lang::$main['side'].Lang::$colon.'[span class=alliance-icon]'.Lang::$game['si'][SIDE_ALLIANCE].'[/span]'; $infobox[] = Lang::$main['side'].Lang::$colon.'[span class=alliance-icon]'.Lang::$game['si'][SIDE_ALLIANCE].'[/span]';
else if ($title->getField('side') == SIDE_HORDE) else if ($title->getField('side') == SIDE_HORDE)
@@ -51,7 +47,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
{ {
case 4: case 4:
$quests = new QuestList(array(['id', $entries])); $quests = new QuestList(array(['id', $entries]));
$quests->addRewardsToJscript($pageData); $quests->addGlobalsToJscript($smarty, GLOBALINFO_REWARDS);
$pageData['page']['questReward'] = $quests->getListviewData(); $pageData['page']['questReward'] = $quests->getListviewData();
$pageData['page']['questParams'] = array( $pageData['page']['questParams'] = array(
@@ -64,8 +60,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
break; break;
case 12: case 12:
$acvs = new AchievementList(array(['id', $entries])); $acvs = new AchievementList(array(['id', $entries]));
$acvs->addGlobalsToJscript($pageData); $acvs->addGlobalsToJscript($smarty);
$acvs->addRewardsToJscript($pageData);
$pageData['page']['acvReward'] = $acvs->getListviewData(); $pageData['page']['acvReward'] = $acvs->getListviewData();
$pageData['page']['acvParams'] = array( $pageData['page']['acvParams'] = array(
@@ -100,7 +95,6 @@ $smarty->updatePageVars(array(
$smarty->assign('community', CommunityContent::getAll(TYPE_TITLE, $id)); // comments, screenshots, videos $smarty->assign('community', CommunityContent::getAll(TYPE_TITLE, $id)); // comments, screenshots, videos
$smarty->assign('lang', array_merge(Lang::$main)); $smarty->assign('lang', array_merge(Lang::$main));
$smarty->assign('lvData', $pageData); $smarty->assign('lvData', $pageData);
$smarty->assign('mysql', DB::Aowow()->getStatistics());
$smarty->display('title.tpl'); $smarty->display('title.tpl');
?> ?>

View File

@@ -47,7 +47,6 @@ $page = array(
$smarty->updatePageVars($page); $smarty->updatePageVars($page);
$smarty->assign('lang', Lang::$main); $smarty->assign('lang', Lang::$main);
$smarty->assign('lvData', $pageData); $smarty->assign('lvData', $pageData);
$smarty->assign('mysql', DB::Aowow()->getStatistics());
$smarty->display('generic-no-filter.tpl'); $smarty->display('generic-no-filter.tpl');
?> ?>

View File

@@ -138,7 +138,6 @@ $page = array(
$smarty->updatePageVars($page); $smarty->updatePageVars($page);
$smarty->assign('lang', Lang::$main); $smarty->assign('lang', Lang::$main);
$smarty->assign('mysql', DB::Aowow()->getStatistics());
$smarty->assign('lvData', $pageData); $smarty->assign('lvData', $pageData);
$smarty->display('generic-no-filter.tpl'); $smarty->display('generic-no-filter.tpl');

View File

@@ -87,7 +87,6 @@ if (strlen($query) < 3 || !($searchMask & SEARCH_MASK_ALL))
// insufficient queries throw an error // insufficient queries throw an error
$smarty->assign('lang', array_merge(Lang::$main, Lang::$search)); $smarty->assign('lang', array_merge(Lang::$main, Lang::$search));
$smarty->assign('found', []); $smarty->assign('found', []);
$smarty->assign('mysql', DB::Aowow()->getStatistics());
$smarty->assign('search', $query); $smarty->assign('search', $query);
$smarty->display('search.tpl'); $smarty->display('search.tpl');
@@ -124,6 +123,7 @@ if ($searchMask & 0x1)
'type' => TYPE_CLASS, 'type' => TYPE_CLASS,
'appendix' => ' (Class)', 'appendix' => ' (Class)',
'matches' => $classes->getMatches(), 'matches' => $classes->getMatches(),
'file' => 'class',
'data' => $data, 'data' => $data,
'params' => ['tabs' => '$myTabs'] 'params' => ['tabs' => '$myTabs']
); );
@@ -156,6 +156,7 @@ if ($searchMask & 0x2)
'type' => TYPE_RACE, 'type' => TYPE_RACE,
'appendix' => ' (Race)', 'appendix' => ' (Race)',
'matches' => $races->getMatches(), 'matches' => $races->getMatches(),
'file' => 'race',
'data' => $data, 'data' => $data,
'params' => ['tabs' => '$myTabs'] 'params' => ['tabs' => '$myTabs']
); );
@@ -200,6 +201,7 @@ if ($searchMask & 0x4)
'type' => TYPE_TITLE, 'type' => TYPE_TITLE,
'appendix' => ' (Title)', 'appendix' => ' (Title)',
'matches' => $titles->getMatches(), 'matches' => $titles->getMatches(),
'file' => 'title',
'data' => $data, 'data' => $data,
'params' => ['tabs' => '$myTabs'] 'params' => ['tabs' => '$myTabs']
); );
@@ -230,7 +232,7 @@ if ($searchMask & 0x8)
if ($data = $wEvents->getListviewData()) if ($data = $wEvents->getListviewData())
{ {
$wEvents->addGlobalsToJscript($jsGlobals); $wEvents->addGlobalsToJscript($smarty);
foreach ($data as &$d) foreach ($data as &$d)
{ {
@@ -243,6 +245,7 @@ if ($searchMask & 0x8)
'type' => TYPE_WORLDEVENT, 'type' => TYPE_WORLDEVENT,
'appendix' => ' (World Event)', 'appendix' => ' (World Event)',
'matches' => $wEvents->getMatches(), 'matches' => $wEvents->getMatches(),
'file' => 'event',
'data' => $data, 'data' => $data,
'params' => ['tabs' => '$myTabs'] 'params' => ['tabs' => '$myTabs']
); );
@@ -269,6 +272,7 @@ if ($searchMask & 0x10)
'type' => TYPE_CURRENCY, 'type' => TYPE_CURRENCY,
'appendix' => ' (Currency)', 'appendix' => ' (Currency)',
'matches' => $money->getMatches(), 'matches' => $money->getMatches(),
'file' => 'currency',
'data' => $data, 'data' => $data,
'params' => ['tabs' => '$myTabs'] 'params' => ['tabs' => '$myTabs']
); );
@@ -294,7 +298,7 @@ if ($searchMask & 0x20)
if ($data = $sets->getListviewData()) if ($data = $sets->getListviewData())
{ {
$sets->addGlobalsToJscript($jsGlobals); $sets->addGlobalsToJscript($smarty, GLOBALINFO_SELF);
while ($sets->iterate()) while ($sets->iterate())
$data[$sets->id]['param1'] = $sets->getField('quality'); $data[$sets->id]['param1'] = $sets->getField('quality');
@@ -303,6 +307,7 @@ if ($searchMask & 0x20)
'type' => TYPE_ITEMSET, 'type' => TYPE_ITEMSET,
'appendix' => ' (Item Set)', 'appendix' => ' (Item Set)',
'matches' => $sets->getMatches(), 'matches' => $sets->getMatches(),
'file' => 'itemset',
'data' => $data, 'data' => $data,
'params' => ['tabs' => '$myTabs'], 'params' => ['tabs' => '$myTabs'],
'pcsToSet' => $sets->pieceToSet 'pcsToSet' => $sets->pieceToSet
@@ -330,7 +335,7 @@ if ($searchMask & 0x40)
if ($data = $items->getListviewData($searchMask & SEARCH_TYPE_JSON ? (ITEMINFO_SUBITEMS | ITEMINFO_JSON) : 0)) if ($data = $items->getListviewData($searchMask & SEARCH_TYPE_JSON ? (ITEMINFO_SUBITEMS | ITEMINFO_JSON) : 0))
{ {
$items->addGlobalsToJscript($jsGlobals); $items->addGlobalsToJscript($smarty);
while ($items->iterate()) while ($items->iterate())
{ {
@@ -345,8 +350,9 @@ if ($searchMask & 0x40)
'type' => TYPE_ITEM, 'type' => TYPE_ITEM,
'appendix' => ' (Item)', 'appendix' => ' (Item)',
'matches' => $items->getMatches(), 'matches' => $items->getMatches(),
'params' => ['tabs' => '$myTabs'], 'file' => 'item',
'data' => $data, 'data' => $data,
'params' => ['tabs' => '$myTabs']
); );
if ($items->getMatches() > $maxResults) if ($items->getMatches() > $maxResults)
@@ -372,11 +378,10 @@ if ($searchMask & 0x80)
if ($data = $abilities->getListviewData()) if ($data = $abilities->getListviewData())
{ {
$abilities->addGlobalsToJscript($jsGlobals); $abilities->addGlobalsToJscript($smarty);
$vis = ['level', 'singleclass', 'schools']; $vis = ['level', 'singleclass', 'schools'];
if ($abilities->hasSetFields(['reagent1']))
if ($abilities->hasDiffFields(['reagent1']))
$vis[] = 'reagents'; $vis[] = 'reagents';
while ($abilities->iterate()) while ($abilities->iterate())
@@ -389,6 +394,7 @@ if ($searchMask & 0x80)
'type' => TYPE_SPELL, 'type' => TYPE_SPELL,
'appendix' => ' (Ability)', 'appendix' => ' (Ability)',
'matches' => $abilities->getMatches(), 'matches' => $abilities->getMatches(),
'file' => 'spell',
'data' => $data, 'data' => $data,
'params' => [ 'params' => [
'id' => 'abilities', 'id' => 'abilities',
@@ -419,7 +425,11 @@ if ($searchMask & 0x100)
if ($data = $talents->getListviewData()) if ($data = $talents->getListviewData())
{ {
$talents->addGlobalsToJscript($jsGlobals); $talents->addGlobalsToJscript($smarty);
$vis = ['level', 'singleclass', 'schools'];
if ($abilities->hasSetFields(['reagent1']))
$vis[] = 'reagents';
while ($talents->iterate()) while ($talents->iterate())
{ {
@@ -431,12 +441,13 @@ if ($searchMask & 0x100)
'type' => TYPE_SPELL, 'type' => TYPE_SPELL,
'appendix' => ' (Talent)', 'appendix' => ' (Talent)',
'matches' => $talents->getMatches(), 'matches' => $talents->getMatches(),
'file' => 'spell',
'data' => $data, 'data' => $data,
'params' => [ 'params' => [
'id' => 'talents', 'id' => 'talents',
'tabs' => '$myTabs', 'tabs' => '$myTabs',
'name' => '$LANG.tab_talents', 'name' => '$LANG.tab_talents',
'visibleCols' => "$['level', 'singleclass', 'schools']" 'visibleCols' => '$'.json_encode($vis)
] ]
); );
@@ -461,7 +472,7 @@ if ($searchMask & 0x200)
if ($data = $glyphs->getListviewData()) if ($data = $glyphs->getListviewData())
{ {
$glyphs->addGlobalsToJscript($jsGlobals); $glyphs->addGlobalsToJscript($smarty, GLOBALINFO_SELF);
while ($glyphs->iterate()) while ($glyphs->iterate())
$data[$glyphs->id]['param1'] = '"'.strToLower($glyphs->getField('iconString')).'"'; $data[$glyphs->id]['param1'] = '"'.strToLower($glyphs->getField('iconString')).'"';
@@ -470,6 +481,7 @@ if ($searchMask & 0x200)
'type' => TYPE_SPELL, 'type' => TYPE_SPELL,
'appendix' => ' (Glyph)', 'appendix' => ' (Glyph)',
'matches' => $glyphs->getMatches(), 'matches' => $glyphs->getMatches(),
'file' => 'spell',
'data' => $data, 'data' => $data,
'params' => [ 'params' => [
'id' => 'glyphs', 'id' => 'glyphs',
@@ -500,7 +512,7 @@ if ($searchMask & 0x400)
if ($data = $prof->getListviewData()) if ($data = $prof->getListviewData())
{ {
$prof->addGlobalsToJscript($jsGlobals); $prof->addGlobalsToJscript($smarty, GLOBALINFO_SELF);
while ($prof->iterate()) while ($prof->iterate())
$data[$prof->id]['param1'] = '"'.strToLower($prof->getField('iconString')).'"'; $data[$prof->id]['param1'] = '"'.strToLower($prof->getField('iconString')).'"';
@@ -509,6 +521,7 @@ if ($searchMask & 0x400)
'type' => TYPE_SPELL, 'type' => TYPE_SPELL,
'appendix' => ' (Proficiency)', 'appendix' => ' (Proficiency)',
'matches' => $prof->getMatches(), 'matches' => $prof->getMatches(),
'file' => 'spell',
'data' => $data, 'data' => $data,
'params' => [ 'params' => [
'id' => 'proficiencies', 'id' => 'proficiencies',
@@ -539,7 +552,7 @@ if ($searchMask & 0x800)
if ($data = $prof->getListviewData()) if ($data = $prof->getListviewData())
{ {
$prof->addGlobalsToJscript($jsGlobals); $prof->addGlobalsToJscript($smarty);
while ($prof->iterate()) while ($prof->iterate())
$data[$prof->id]['param1'] = '"'.strToLower($prof->getField('iconString')).'"'; $data[$prof->id]['param1'] = '"'.strToLower($prof->getField('iconString')).'"';
@@ -548,6 +561,7 @@ if ($searchMask & 0x800)
'type' => TYPE_SPELL, 'type' => TYPE_SPELL,
'appendix' => ' (Profession)', 'appendix' => ' (Profession)',
'matches' => $prof->getMatches(), 'matches' => $prof->getMatches(),
'file' => 'spell',
'data' => $data, 'data' => $data,
'params' => [ 'params' => [
'id' => 'professions', 'id' => 'professions',
@@ -579,7 +593,7 @@ if ($searchMask & 0x1000)
if ($data = $vPets->getListviewData()) if ($data = $vPets->getListviewData())
{ {
$vPets->addGlobalsToJscript($jsGlobals); $vPets->addGlobalsToJscript($smarty);
while ($vPets->iterate()) while ($vPets->iterate())
$data[$vPets->id]['param1'] = '"'.strToLower($vPets->getField('iconString')).'"'; $data[$vPets->id]['param1'] = '"'.strToLower($vPets->getField('iconString')).'"';
@@ -588,6 +602,7 @@ if ($searchMask & 0x1000)
'type' => TYPE_SPELL, 'type' => TYPE_SPELL,
'appendix' => ' (Companion)', 'appendix' => ' (Companion)',
'matches' => $vPets->getMatches(), 'matches' => $vPets->getMatches(),
'file' => 'spell',
'data' => $data, 'data' => $data,
'params' => [ 'params' => [
'id' => 'companions', 'id' => 'companions',
@@ -618,7 +633,7 @@ if ($searchMask & 0x2000)
if ($data = $mounts->getListviewData()) if ($data = $mounts->getListviewData())
{ {
$mounts->addGlobalsToJscript($jsGlobals); $mounts->addGlobalsToJscript($smarty, GLOBALINFO_SELF);
while ($mounts->iterate()) while ($mounts->iterate())
$data[$mounts->id]['param1'] = '"'.strToLower($mounts->getField('iconString')).'"'; $data[$mounts->id]['param1'] = '"'.strToLower($mounts->getField('iconString')).'"';
@@ -627,6 +642,7 @@ if ($searchMask & 0x2000)
'type' => TYPE_SPELL, 'type' => TYPE_SPELL,
'appendix' => ' (Mount)', 'appendix' => ' (Mount)',
'matches' => $mounts->getMatches(), 'matches' => $mounts->getMatches(),
'file' => 'spell',
'data' => $data, 'data' => $data,
'params' => [ 'params' => [
'id' => 'mounts', 'id' => 'mounts',
@@ -644,7 +660,42 @@ if ($searchMask & 0x2000)
} }
// 15 NPCs // 15 NPCs
// if ($searchMask & 0x4000) if ($searchMask & 0x4000)
{
$conditions = array(
[
'OR',
['name_loc'.User::$localeId, $query],
['subname_loc'.User::$localeId, $query]
],
// [['cuFlags', MASKE, '&'], 0], // todo (med): exclude trigger creatures and difficulty entries
$maxResults
);
$npcs = new CreatureList($conditions);
if ($data = $npcs->getListviewData())
{
$found['npc'] = array(
'type' => TYPE_NPC,
'appendix' => ' (NPC)',
'matches' => $npcs->getMatches(),
'file' => 'creature',
'data' => $data,
'params' => [
'id' => 'npcs',
'tabs' => '$myTabs',
'name' => '$LANG.tab_npcs',
]
);
if ($npcs->getMatches() > $maxResults)
{
$found['npc']['params']['note'] = '$'.sprintf(Util::$narrowResultString, 'LANG.lvnote_npcsfound', $npcs->getMatches(), $maxResults);
$found['npc']['params']['_truncated'] = 1;
}
}
}
// 16 Quests // 16 Quests
// if ($searchMask & 0x8000) // if ($searchMask & 0x8000)
@@ -662,8 +713,7 @@ if ($searchMask & 0x10000)
if ($data = $acvs->getListviewData()) if ($data = $acvs->getListviewData())
{ {
$acvs->addGlobalsToJScript($jsGlobals); $acvs->addGlobalsToJScript($smarty);
$acvs->addRewardsToJScript($jsGlobals);
while ($acvs->iterate()) while ($acvs->iterate())
$data[$acvs->id]['param1'] = '"'.strToLower($acvs->getField('iconString')).'"'; $data[$acvs->id]['param1'] = '"'.strToLower($acvs->getField('iconString')).'"';
@@ -672,6 +722,7 @@ if ($searchMask & 0x10000)
'type' => TYPE_ACHIEVEMENT, 'type' => TYPE_ACHIEVEMENT,
'appendix' => ' (Achievement)', 'appendix' => ' (Achievement)',
'matches' => $acvs->getMatches(), 'matches' => $acvs->getMatches(),
'file' => 'achievement',
'data' => $data, 'data' => $data,
'params' => [ 'params' => [
'tabs' => '$myTabs', 'tabs' => '$myTabs',
@@ -700,12 +751,12 @@ if ($searchMask & 0x20000)
if ($data = $stats->getListviewData()) if ($data = $stats->getListviewData())
{ {
$stats->addGlobalsToJScript($jsGlobals); $stats->addGlobalsToJScript($smarty, GLOBALINFO_SELF);
$stats->addRewardsToJScript($jsGlobals);
$found['statistic'] = array( $found['statistic'] = array(
'type' => TYPE_ACHIEVEMENT, 'type' => TYPE_ACHIEVEMENT,
'matches' => $stats->getMatches(), 'matches' => $stats->getMatches(),
'file' => 'achievement',
'data' => $data, 'data' => $data,
'params' => [ 'params' => [
'tabs' => '$myTabs', 'tabs' => '$myTabs',
@@ -743,8 +794,6 @@ if ($searchMask & 0x400000)
if ($data = $pets->getListviewData()) if ($data = $pets->getListviewData())
{ {
$pets->addGlobalsToJScript($jsGlobals);
while ($pets->iterate()) while ($pets->iterate())
$data[$pets->id]['param1'] = '"'.$pets->getField('iconString').'"'; $data[$pets->id]['param1'] = '"'.$pets->getField('iconString').'"';
@@ -752,6 +801,7 @@ if ($searchMask & 0x400000)
'type' => TYPE_PET, 'type' => TYPE_PET,
'appendix' => ' (Pet)', 'appendix' => ' (Pet)',
'matches' => $pets->getMatches(), 'matches' => $pets->getMatches(),
'file' => 'pet',
'data' => $data, 'data' => $data,
'params' => [ 'params' => [
'tabs' => '$myTabs', 'tabs' => '$myTabs',
@@ -779,7 +829,7 @@ if ($searchMask & 0x800000)
if ($data = $npcAbilities->getListviewData()) if ($data = $npcAbilities->getListviewData())
{ {
$npcAbilities->addGlobalsToJscript($jsGlobals); $npcAbilities->addGlobalsToJscript($smarty, GLOBALINFO_SELF);
while ($npcAbilities->iterate()) while ($npcAbilities->iterate())
$data[$npcAbilities->id]['param1'] = '"'.strToLower($npcAbilities->getField('iconString')).'"'; $data[$npcAbilities->id]['param1'] = '"'.strToLower($npcAbilities->getField('iconString')).'"';
@@ -788,6 +838,7 @@ if ($searchMask & 0x800000)
'type' => TYPE_SPELL, 'type' => TYPE_SPELL,
'appendix' => ' (Spell)', 'appendix' => ' (Spell)',
'matches' => $npcAbilities->getMatches(), 'matches' => $npcAbilities->getMatches(),
'file' => 'spell',
'data' => $data, 'data' => $data,
'params' => [ 'params' => [
'id' => 'npc-abilities', 'id' => 'npc-abilities',
@@ -819,7 +870,7 @@ if ($searchMask & 0x1000000)
if ($data = $misc->getListviewData()) if ($data = $misc->getListviewData())
{ {
$misc->addGlobalsToJscript($jsGlobals); $misc->addGlobalsToJscript($smarty, GLOBALINFO_SELF);
while ($misc->iterate()) while ($misc->iterate())
$data[$misc->id]['param1'] = '"'.strToLower($misc->getField('iconString')).'"'; $data[$misc->id]['param1'] = '"'.strToLower($misc->getField('iconString')).'"';
@@ -828,6 +879,7 @@ if ($searchMask & 0x1000000)
'type' => TYPE_SPELL, 'type' => TYPE_SPELL,
'appendix' => ' (Spell)', 'appendix' => ' (Spell)',
'matches' => $misc->getMatches(), 'matches' => $misc->getMatches(),
'file' => 'spell',
'data' => $data, 'data' => $data,
'params' => [ 'params' => [
'tabs' => '$myTabs', 'tabs' => '$myTabs',
@@ -979,7 +1031,6 @@ else /* if ($searchMask & SEARCH_TYPE_REGULAR) */
$smarty->assign('found', $found); $smarty->assign('found', $found);
$smarty->assign('lvData', $jsGlobals); $smarty->assign('lvData', $jsGlobals);
$smarty->assign('search', $search); $smarty->assign('search', $search);
$smarty->assign('mysql', DB::Aowow()->getStatistics());
$smarty->display('search.tpl'); $smarty->display('search.tpl');
} }

View File

@@ -27,7 +27,7 @@
{/if} {/if}
react:{$curr.react}, react:{$curr.react},
location:{$curr.location}, location:{$curr.location},
{if $curr.skin} {if isset($curr.skin)}
skin: '{$curr.skin}', skin: '{$curr.skin}',
{/if} {/if}
{if isset($curr.percent)} {if isset($curr.percent)}

View File

@@ -31,15 +31,7 @@
{strip}<script type="text/javascript"> {strip}<script type="text/javascript">
g_initHeader({$page.tab}); g_initHeader({$page.tab});
LiveSearch.attach(ge('livesearch-generic')); LiveSearch.attach(ge('livesearch-generic'));
{if isset($lvData.gAchievements)} { include file='bricks/globals/achievements.tpl' data=$lvData.gAchievements }{/if} {foreach from=$jsGlobals item="glob"}
{if isset($lvData.gClasses)} { include file='bricks/globals/classes.tpl' data=$lvData.gClasses }{/if} {include file="bricks/globals/`$glob[0]`.tpl" data=$glob[1]}
{if isset($lvData.gCurrencies)} { include file='bricks/globals/currencies.tpl' data=$lvData.gCurrencies }{/if} {/foreach}
{if isset($lvData.gHolidays)} { include file='bricks/globals/holidays.tpl' data=$lvData.gHolidays }{/if}
{if isset($lvData.gItems)} { include file='bricks/globals/items.tpl' data=$lvData.gItems }{/if}
{if isset($lvData.gRaces)} { include file='bricks/globals/races.tpl' data=$lvData.gRaces }{/if}
{if isset($lvData.gSpells)} { include file='bricks/globals/spells.tpl' data=$lvData.gSpells }{/if}
{if isset($lvData.gTitles)} { include file='bricks/globals/titles.tpl' data=$lvData.gTitles }{/if}
{if isset($lvData.gCreatures)} { include file='bricks/globals/creatures.tpl' data=$lvData.gCreatures }{/if}
{if isset($lvData.gQuests)} { include file='bricks/globals/quests.tpl' data=$lvData.gQuests }{/if}
{* TODO: Factions, Objects, g_gatheredzones(?) *}
</script>{/strip} </script>{/strip}

View File

@@ -17,32 +17,9 @@
<div id="listview-generic" class="listview"></div> <div id="listview-generic" class="listview"></div>
<script type="text/javascript"> <script type="text/javascript">
var myTabs = new Tabs({ldelim}parent: ge('tabs-generic'){rdelim}); var myTabs = new Tabs({ldelim}parent: ge('tabs-generic'){rdelim});
{if isset($found.class)} {include file='bricks/listviews/class.tpl' data=$found.class.data params=$found.class.params } {/if} {foreach from=$found item="f"}
{if isset($found.race)} {include file='bricks/listviews/race.tpl' data=$found.race.data params=$found.race.params } {/if} {include file="bricks/listviews/`$f.file`.tpl" data=$f.data params=$f.params}
{if isset($found.title)} {include file='bricks/listviews/title.tpl' data=$found.title.data params=$found.title.params } {/if} {/foreach}
{if isset($found.npc)} {include file='bricks/listviews/creature.tpl' data=$found.npc.data params=$found.npc.params } {/if}
{if isset($found.object)} {include file='bricks/listviews/object.tpl' data=$found.object.data params=$found.object.params } {/if}
{if isset($found.itemset)} {include file='bricks/listviews/itemset.tpl' data=$found.itemset.data params=$found.itemset.params } {/if}
{if isset($found.item)} {include file='bricks/listviews/item.tpl' data=$found.item.data params=$found.item.params } {/if}
{if isset($found.quest)} {include file='bricks/listviews/quest.tpl' data=$found.quest.data params=$found.quest.params } {/if}
{if isset($found.ability)} {include file='bricks/listviews/spell.tpl' data=$found.ability.data params=$found.ability.params } {/if}
{if isset($found.talent)} {include file='bricks/listviews/spell.tpl' data=$found.talent.data params=$found.talent.params } {/if}
{if isset($found.glyph)} {include file='bricks/listviews/spell.tpl' data=$found.glyph.data params=$found.glyph.params } {/if}
{if isset($found.proficiency)} {include file='bricks/listviews/spell.tpl' data=$found.proficiency.data params=$found.proficiency.params} {/if}
{if isset($found.profession)} {include file='bricks/listviews/spell.tpl' data=$found.profession.data params=$found.profession.params } {/if}
{if isset($found.companion)} {include file='bricks/listviews/spell.tpl' data=$found.companion.data params=$found.companion.params } {/if}
{if isset($found.mount)} {include file='bricks/listviews/spell.tpl' data=$found.mount.data params=$found.mount.params } {/if}
{if isset($found.npcSpell)} {include file='bricks/listviews/spell.tpl' data=$found.npcSpell.data params=$found.npcSpell.params } {/if}
{if isset($found.spell)} {include file='bricks/listviews/spell.tpl' data=$found.spell.data params=$found.spell.params } {/if}
{if isset($found.unkSpell)} {include file='bricks/listviews/spell.tpl' data=$found.unkSpell.data params=$found.unkSpell.params } {/if}
{if isset($found.zone)} {include file='bricks/listviews/zone.tpl' data=$found.zone.data params=$found.zone.params } {/if}
{if isset($found.faction)} {include file='bricks/listviews/faction.tpl' data=$found.faction.data params=$found.faction.params } {/if}
{if isset($found.pet)} {include file='bricks/listviews/pet.tpl' data=$found.pet.data params=$found.pet.params } {/if}
{if isset($found.achievement)} {include file='bricks/listviews/achievement.tpl' data=$found.achievement.data params=$found.achievement.params} {/if}
{if isset($found.statistic)} {include file='bricks/listviews/achievement.tpl' data=$found.statistic.data params=$found.statistic.params } {/if}
{if isset($found.event)} {include file='bricks/listviews/event.tpl' data=$found.event.data params=$found.event.params } {/if}
{if isset($found.skill)} {include file='bricks/listviews/skill.tpl' data=$found.skill.data params=$found.skill.params } {/if}
{if isset($found.currency)} {include file='bricks/listviews/currency.tpl' data=$found.currency.data params=$found.currency.params } {/if}
myTabs.flush(); myTabs.flush();
</script> </script>
{else} {else}