mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
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:
@@ -7,6 +7,8 @@ class AchievementList extends BaseType
|
||||
{
|
||||
use listviewHelper;
|
||||
|
||||
public static $type = TYPE_ACHIEVEMENT;
|
||||
|
||||
public $criteria = [];
|
||||
public $tooltip = [];
|
||||
|
||||
@@ -42,38 +44,24 @@ class AchievementList extends BaseType
|
||||
$this->reset(); // restore 'iterator'
|
||||
}
|
||||
|
||||
public function addRewardsToJScript(&$refs)
|
||||
public function addGlobalsToJscript(&$template, $addMask = GLOBALINFO_ANY)
|
||||
{
|
||||
$items = [];
|
||||
$titles = [];
|
||||
|
||||
while ($this->iterate())
|
||||
{
|
||||
foreach ($this->curTpl['rewards'][TYPE_ITEM] as $_)
|
||||
$items[] = $_;
|
||||
|
||||
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(
|
||||
if ($addMask & GLOBALINFO_SELF)
|
||||
$template->extendGlobalData(self::$type, [$this->id => array(
|
||||
'icon' => $this->curTpl['iconString'],
|
||||
'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, $_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ if (!defined('AOWOW_REVISION'))
|
||||
|
||||
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 $matchQuery = 'SELECT COUNT(1) FROM ?_classes WHERE [cond]';
|
||||
|
||||
@@ -24,7 +26,7 @@ class CharClassList extends BaseType
|
||||
'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;
|
||||
|
||||
if ($this->curTpl['expansion'])
|
||||
@@ -34,13 +36,10 @@ class CharClassList extends BaseType
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function addGlobalsToJscript(&$refs)
|
||||
public function addGlobalsToJscript(&$template, $addMask = 0)
|
||||
{
|
||||
if (!isset($refs['gClasses']))
|
||||
$refs['gClasses'] = [];
|
||||
|
||||
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) { }
|
||||
|
||||
@@ -5,6 +5,8 @@ if (!defined('AOWOW_REVISION'))
|
||||
|
||||
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 $matchQuery = 'SELECT COUNT(1) FROM ?_races WHERE [cond]';
|
||||
|
||||
@@ -31,13 +33,10 @@ class CharRaceList extends BaseType
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function addGlobalsToJscript(&$refs)
|
||||
public function addGlobalsToJscript(&$template, $addMask = 0)
|
||||
{
|
||||
if (!isset($refs['gRaces']))
|
||||
$refs['gRaces'] = [];
|
||||
|
||||
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) { }
|
||||
|
||||
@@ -8,6 +8,8 @@ class CreatureList extends BaseType
|
||||
{
|
||||
use spawnHelper;
|
||||
|
||||
public static $type = TYPE_NPC;
|
||||
|
||||
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]';
|
||||
@@ -151,16 +153,12 @@ class CreatureList extends BaseType
|
||||
'location' => json_encode($this->getSpawns(SPAWNINFO_ZONES), JSON_NUMERIC_CHECK),
|
||||
'name' => $this->getField('name', 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)
|
||||
{
|
||||
// only first skin of first model ... we're omitting potentially 11 skins here .. but the lv accepts only one .. w/e
|
||||
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
|
||||
$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;
|
||||
}
|
||||
|
||||
public function addGlobalsToJScript(&$refs)
|
||||
public function addGlobalsToJScript(&$template, $addMask = 0)
|
||||
{
|
||||
if (!isset($refs['gCreatures']))
|
||||
$refs['gCreatures'] = [];
|
||||
|
||||
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) { }
|
||||
|
||||
@@ -5,6 +5,8 @@ if (!defined('AOWOW_REVISION'))
|
||||
|
||||
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 $matchQuery = 'SELECT COUNT(1) FROM ?_currencies WHERE [cond]';
|
||||
|
||||
@@ -25,25 +27,17 @@ class CurrencyList extends BaseType
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function addGlobalsToJscript(&$refs)
|
||||
public function addGlobalsToJscript(&$template, $addMask = 0)
|
||||
{
|
||||
if (!isset($refs['gCurrencies']))
|
||||
$refs['gCurrencies'] = [];
|
||||
|
||||
$data = [];
|
||||
|
||||
while ($this->iterate())
|
||||
{
|
||||
$refs['gCurrencies'][$this->id] = array(
|
||||
$template->extendGlobalData(self::$type, [$this->id => array(
|
||||
'name' => $this->getField('name', true),
|
||||
'icon' => $this->curTpl['iconString']
|
||||
);
|
||||
)]);
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function addRewardsToJScript(&$ref) { }
|
||||
public function renderTooltip() { }
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ if (!defined('AOWOW_REVISION'))
|
||||
|
||||
class FactionList extends BaseType
|
||||
{
|
||||
public static $type = TYPE_FACTION;
|
||||
|
||||
public static function getName($id)
|
||||
{
|
||||
$n = DB::Aowow()->SelectRow('
|
||||
@@ -35,8 +37,7 @@ class FactionList extends BaseType
|
||||
}
|
||||
|
||||
public function getListviewData() { }
|
||||
public function addGlobalsToJScript(&$refs) { }
|
||||
public function addRewardsToJScript(&$refs) { }
|
||||
public function addGlobalsToJScript(&$template, $addMask = 0) { }
|
||||
public function renderTooltip() { }
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ if (!defined('AOWOW_REVISION'))
|
||||
|
||||
class GameObjectList extends BaseType
|
||||
{
|
||||
public static $type = TYPE_OBJECT;
|
||||
|
||||
public static function getName($id)
|
||||
{
|
||||
$n = DB::Aowow()->SelectRow('
|
||||
@@ -29,8 +31,7 @@ class GameObjectList extends BaseType
|
||||
}
|
||||
|
||||
public function getListviewData() { }
|
||||
public function addGlobalsToJScript(&$refs) { }
|
||||
public function addRewardsToJScript(&$refs) { }
|
||||
public function addGlobalsToJScript(&$template, $addMask = 0) { }
|
||||
public function renderTooltip() { }
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ if (!defined('AOWOW_REVISION'))
|
||||
|
||||
class ItemList extends BaseType
|
||||
{
|
||||
public static $type = TYPE_ITEM;
|
||||
|
||||
public $tooltip = '';
|
||||
public $json = [];
|
||||
public $itemMods = [];
|
||||
@@ -148,7 +150,7 @@ class ItemList extends BaseType
|
||||
{"source":[5],"sourcemore":[{"n":"Commander Oxheart","t":1,"ti":64606,"z":5842}],
|
||||
|
||||
cost:[] format unk 0:copper, 1:[items]? 2, 3, 4, 5
|
||||
stack [unk, unk]
|
||||
stack [min, max] // when looting
|
||||
avail unk
|
||||
rel unk
|
||||
glyph major | minor (as id)
|
||||
@@ -159,18 +161,15 @@ class ItemList extends BaseType
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function addGlobalsToJscript(&$refs)
|
||||
public function addGlobalsToJscript(&$template, $addMask = 0)
|
||||
{
|
||||
if (!isset($refs['gItems']))
|
||||
$refs['gItems'] = [];
|
||||
|
||||
while ($this->iterate())
|
||||
{
|
||||
$refs['gItems'][$this->id] = array(
|
||||
$template->extendGlobalData(self::$type, [$this->id => array(
|
||||
'name' => $this->getField('name', true),
|
||||
'quality' => $this->curTpl['Quality'],
|
||||
'icon' => $this->curTpl['icon'],
|
||||
);
|
||||
'icon' => $this->curTpl['icon']
|
||||
)]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,10 @@ class ItemsetList extends BaseType
|
||||
{
|
||||
use ListviewHelper;
|
||||
|
||||
private $classes = []; // used to build g_classes
|
||||
public static $type = TYPE_ITEMSET;
|
||||
|
||||
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 $matchQuery = 'SELECT COUNT(1) FROM ?_itemset WHERE [filter] [cond]';
|
||||
@@ -71,16 +73,15 @@ class ItemsetList extends BaseType
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function addGlobalsToJscript(&$refs)
|
||||
public function addGlobalsToJscript(&$template, $addMask = GLOBALINFO_ANY)
|
||||
{
|
||||
if ($this->classes)
|
||||
(new CharClassList(array(['id', $this->classes])))->addGlobalsToJscript($refs);
|
||||
if ($this->classes && ($addMask & GLOBALINFO_RELATED))
|
||||
$template->extendGlobalIds(TYPE_CLASS, $this->classes);
|
||||
|
||||
if ($this->pieceToSet)
|
||||
(new ItemList(array(['i.entry', array_keys($this->pieceToSet)], 0)))->addGlobalsToJscript($refs);
|
||||
if ($this->pieceToSet && ($addMask & GLOBALINFO_SELF))
|
||||
$template->extendGlobalIds(TYPE_ITEM, array_keys($this->pieceToSet));
|
||||
}
|
||||
|
||||
public function addRewardsToJScript(&$ref) { }
|
||||
public function renderTooltip() { }
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ class PetList extends BaseType
|
||||
{
|
||||
use ListviewHelper;
|
||||
|
||||
public static $type = TYPE_PET;
|
||||
|
||||
protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_pet WHERE [cond] ORDER BY Id ASC';
|
||||
protected $matchQuery = 'SELECT COUNT(1) FROM ?_pet WHERE [cond]';
|
||||
|
||||
@@ -44,19 +46,20 @@ class PetList extends BaseType
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function addGlobalsToJscript(&$refs)
|
||||
public function addGlobalsToJscript(&$template, $addMask = GLOBALINFO_ANY)
|
||||
{
|
||||
$gathered = [];
|
||||
while ($this->iterate())
|
||||
{
|
||||
if ($addMask & GLOBALINFO_RELATED)
|
||||
for ($i = 1; $i <= 4; $i++)
|
||||
if ($this->curTpl['spellId'.$i] > 0)
|
||||
$gathered[] = (int)$this->curTpl['spellId'.$i];
|
||||
$template->extendGlobalIds(TYPE_SPELL, $this->curTpl['spellId'.$i]);
|
||||
|
||||
if ($gathered)
|
||||
(new SpellList(array(['s.id', $gathered])))->addGlobalsToJscript($refs);
|
||||
if ($addMask & GLOBALINFO_SELF)
|
||||
$template->extendGlobalData(self::$type, [$this->id => ['icon' => $this->curTpl['iconString']]]);
|
||||
}
|
||||
}
|
||||
|
||||
public function addRewardsToJScript(&$ref) { }
|
||||
public function renderTooltip() { }
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ if (!defined('AOWOW_REVISION'))
|
||||
|
||||
class QuestList extends BaseType
|
||||
{
|
||||
public static $type = TYPE_QUEST;
|
||||
|
||||
public $cat1 = 0;
|
||||
public $cat2 = 0;
|
||||
|
||||
@@ -128,45 +130,6 @@ class QuestList extends BaseType
|
||||
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')
|
||||
{
|
||||
$replace = array(
|
||||
@@ -263,16 +226,35 @@ class QuestList extends BaseType
|
||||
return $x;
|
||||
}
|
||||
|
||||
public function addGlobalsToJScript(&$refs)
|
||||
public function addGlobalsToJScript(&$template, $addMask = GLOBALINFO_ANY)
|
||||
{
|
||||
if (!isset($refs['gQuests']))
|
||||
$refs['gQuests'] = [];
|
||||
|
||||
while ($this->iterate())
|
||||
{
|
||||
$refs['gQuests'][$this->id] = array(
|
||||
'name' => $this->getField('Title', true)
|
||||
);
|
||||
if ($addMask & GLOBALINFO_REWARDS)
|
||||
{
|
||||
// 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)]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ if (!defined('AOWOW_REVISION'))
|
||||
|
||||
class SkillList extends BaseType
|
||||
{
|
||||
public static $type = TYPE_SKILL;
|
||||
|
||||
public static function getName($id)
|
||||
{
|
||||
$n = DB::Aowow()->SelectRow('
|
||||
@@ -25,8 +27,7 @@ class SkillList extends BaseType
|
||||
}
|
||||
|
||||
public function getListviewData() { }
|
||||
public function addGlobalsToJScript(&$refs) { }
|
||||
public function addRewardsToJScript(&$refs) { }
|
||||
public function addGlobalsToJScript(&$template, $addMask = 0) { }
|
||||
public function renderTooltip() { }
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ class SpellList extends BaseType
|
||||
public $relItems = null;
|
||||
public $sources = [];
|
||||
|
||||
public static $type = TYPE_SPELL;
|
||||
public static $skillLines = array(
|
||||
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
|
||||
@@ -1625,48 +1626,40 @@ class SpellList extends BaseType
|
||||
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->addGlobalsToJscript($refs);
|
||||
$this->relItems->addGlobalsToJscript($template);
|
||||
}
|
||||
|
||||
$classes = [];
|
||||
$races = [];
|
||||
|
||||
if (!isset($refs['gSpells']))
|
||||
$refs['gSpells'] = [];
|
||||
|
||||
while ($this->iterate())
|
||||
{
|
||||
if ($addMask & GLOBALINFO_RELATED)
|
||||
{
|
||||
if ($mask = $this->curTpl['reqClassMask'])
|
||||
for ($i = 0; $i < 11; $i++)
|
||||
if ($mask & (1 << $i))
|
||||
$classes[] = $i + 1;
|
||||
$template->extendGlobalIds(TYPE_CLASS, $i + 1);
|
||||
|
||||
if ($mask = $this->curTpl['reqRaceMask'])
|
||||
for ($i = 0; $i < 11; $i++)
|
||||
if ($mask & (1 << $i))
|
||||
$races[] = $i + 1;
|
||||
$template->extendGlobalIds(TYPE_RACE, $i + 1);
|
||||
}
|
||||
|
||||
if ($addMask & GLOBALINFO_SELF)
|
||||
{
|
||||
$iconString = $this->curTpl['iconStringAlt'] ? 'iconStringAlt' : 'iconString';
|
||||
|
||||
$refs['gSpells'][$this->id] = array(
|
||||
$template->extendGlobalData(self::$type, [$this->id => array(
|
||||
'icon' => $this->curTpl[$iconString],
|
||||
'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) { }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ class TitleList extends BaseType
|
||||
{
|
||||
use listviewHelper;
|
||||
|
||||
public static $type = TYPE_TITLE;
|
||||
|
||||
public $sources = [];
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public function addGlobalsToJscript(&$refs)
|
||||
public function addGlobalsToJscript(&$template, $addMask = 0)
|
||||
{
|
||||
if (!isset($refs['gTitles']))
|
||||
$refs['gTitles'] = [];
|
||||
$data = [];
|
||||
|
||||
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))
|
||||
$refs['gTitles'][$this->id]['namefemale'] = $_;
|
||||
$data[$this->id]['namefemale'] = $_;
|
||||
}
|
||||
|
||||
$template->extendGlobalData(self::$type, $data);
|
||||
}
|
||||
|
||||
private function createSource()
|
||||
@@ -143,7 +146,6 @@ class TitleList extends BaseType
|
||||
return str_replace('%s', '<span class="q0"><'.Lang::$main['name'].'></span>', $this->getField($field, true));
|
||||
}
|
||||
|
||||
public function addRewardsToJScript(&$ref) { }
|
||||
public function renderTooltip() { }
|
||||
|
||||
private function faction2Side(&$faction) // thats weird.. and hopefully unique to titles
|
||||
|
||||
@@ -5,33 +5,7 @@ if (!defined('AOWOW_REVISION'))
|
||||
|
||||
class WorldEventList extends BaseType
|
||||
{
|
||||
private static $holidayIcons = [
|
||||
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'
|
||||
];
|
||||
public static $type = TYPE_WORLDEVENT;
|
||||
|
||||
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]';
|
||||
@@ -158,27 +132,17 @@ class WorldEventList extends BaseType
|
||||
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())
|
||||
{
|
||||
$refs['gHolidays'][$this->id] = array(
|
||||
$template->extendGlobalData(self::$type, [$this->id => array(
|
||||
'name' => $this->getField('name', true),
|
||||
'icon' => $this->curTpl['iconString']
|
||||
);
|
||||
)]);
|
||||
}
|
||||
}
|
||||
|
||||
public function addRewardsToJScript(&$ref) { }
|
||||
public function renderTooltip() { }
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@ if (!defined('AOWOW_REVISION'))
|
||||
|
||||
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 $matchQuery = 'SELECT COUNT(1) FROM ?_zones WHERE [cond]';
|
||||
|
||||
@@ -148,16 +150,12 @@ visibleCols: ['heroiclevel', 'players']
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function addGlobalsToJscript(&$refs)
|
||||
public function addGlobalsToJscript(&$template, $addMask = 0)
|
||||
{
|
||||
if (!isset($refs['gZones']))
|
||||
$refs['gZones'] = [];
|
||||
|
||||
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() { }
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,12 @@ define('LOCALE_DE', 3);
|
||||
define('LOCALE_ES', 6);
|
||||
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_SUBITEMS', 0x2);
|
||||
define('ITEMINFO_VENDOR', 0x4);
|
||||
|
||||
@@ -249,11 +249,7 @@ abstract class BaseType
|
||||
abstract public function getListviewData();
|
||||
|
||||
// should return data to extend global js variables for a certain type (e.g. g_items)
|
||||
abstract public function addGlobalsToJScript(&$ref);
|
||||
|
||||
// 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);
|
||||
abstract public function addGlobalsToJScript(&$smarty, $addMask = GLOBALINFO_ANY);
|
||||
|
||||
// NPC, GO, Item, Quest, Spell, Achievement, Profile would require this
|
||||
abstract public function renderTooltip();
|
||||
@@ -261,6 +257,33 @@ abstract class BaseType
|
||||
|
||||
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)
|
||||
{
|
||||
if (!is_array($fields))
|
||||
@@ -604,12 +627,15 @@ class Lang
|
||||
class SmartyAoWoW extends Smarty
|
||||
{
|
||||
private $config = [];
|
||||
private $jsGlobals = [];
|
||||
|
||||
public function __construct($config)
|
||||
{
|
||||
$cwd = str_replace("\\", "/", getcwd());
|
||||
|
||||
$this->Smarty();
|
||||
$this->assign('appName', $config['page']['name']);
|
||||
$this->assign('AOWOW_REVISION', AOWOW_REVISION);
|
||||
$this->config = $config;
|
||||
$this->template_dir = $cwd.'/template/';
|
||||
$this->compile_dir = $cwd.'/cache/template/';
|
||||
@@ -619,8 +645,6 @@ class SmartyAoWoW extends Smarty
|
||||
$this->left_delimiter = '{';
|
||||
$this->right_delimiter = '}';
|
||||
$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(
|
||||
'reqJS' => [], // <[string]> path to required JSFile
|
||||
'reqCSS' => [], // <[string,string]> path to required CSSFile, IE condition
|
||||
@@ -630,6 +654,7 @@ class SmartyAoWoW extends Smarty
|
||||
'typeId' => null, // [int] entry to display
|
||||
'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
|
||||
@@ -658,33 +683,10 @@ class SmartyAoWoW extends Smarty
|
||||
|
||||
foreach ($globals as $glob)
|
||||
{
|
||||
if (!isset($_[$glob['type']]))
|
||||
$_[$glob['type']] = [];
|
||||
if (!isset($this->jsGlobals[$glob['type']]))
|
||||
$this->jsGlobals[$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;
|
||||
}
|
||||
$this->jsGlobals[$glob['type']][] = $glob['typeId'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -704,9 +706,103 @@ class SmartyAoWoW extends Smarty
|
||||
$this->_tpl_vars['announcements'] = $ann;
|
||||
}
|
||||
|
||||
$this->applyGlobals();
|
||||
|
||||
$this->_tpl_vars['mysql'] = DB::Aowow()->getStatistics();
|
||||
|
||||
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)
|
||||
{
|
||||
$this->updatePageVars(array(
|
||||
@@ -716,6 +812,7 @@ class SmartyAoWoW extends Smarty
|
||||
));
|
||||
|
||||
$this->assign('lang', Lang::$main);
|
||||
$this->assign('mysql', DB::Aowow()->getStatistics());
|
||||
|
||||
$this->display('404.tpl');
|
||||
exit();
|
||||
|
||||
@@ -75,7 +75,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
|
||||
array_unshift($pageData['title'], $acv->getField('name', true));
|
||||
|
||||
$acv->addRewardsToJscript($pageData);
|
||||
$acv->addGlobalsToJscript($smarty, GLOBALINFO_REWARDS);
|
||||
$pageData['page'] = $acv->getDetailedData()[$id];
|
||||
$acv->reset();
|
||||
|
||||
@@ -110,8 +110,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
'tabs' => '$tabsRelated'
|
||||
);
|
||||
|
||||
$saList->addRewardsToJscript($pageData);
|
||||
$saList->addGlobalsToJscript($pageData);
|
||||
$saList->addGlobalsToJscript($smarty);
|
||||
|
||||
// listview: "criteria of"
|
||||
$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'
|
||||
);
|
||||
|
||||
$coList->addRewardsToJscript($pageData);
|
||||
$coList->addGlobalsToJscript($pageData);
|
||||
$coList->addGlobalsToJscript($smarty);
|
||||
}
|
||||
|
||||
// create rewards
|
||||
@@ -259,8 +257,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
'type' => 'g_achievements',
|
||||
'id' => $obj,
|
||||
);
|
||||
if ($crtAcv = new AchievementList(array(['id', $obj])))
|
||||
$crtAcv->addGlobalsToJscript($pageData);
|
||||
$smarty->extendGlobalIds(TYPE_ACHIEVEMENT, $obj);
|
||||
break;
|
||||
// link to 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_LEARN_SPELL:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2:
|
||||
$crtSpl = new SpellList(array(['s.id', $obj]));
|
||||
$text = !empty($crtName) ? $crtName : $crtSpl->getField('name', true);
|
||||
$text = !empty($crtName) ? $crtName : SpellList::getName($obj);
|
||||
$tmp['link'] = array(
|
||||
'href' => '?spell='.$obj,
|
||||
'text' => $text
|
||||
);
|
||||
$crtSpl->addGlobalsToJscript($pageData);
|
||||
$smarty->extendGlobalIds(TYPE_SPELL, $obj);
|
||||
$tmp['icon'] = $iconId;
|
||||
$pageData['page']['icons'][] = array(
|
||||
'itr' => $iconId++,
|
||||
@@ -303,7 +299,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
'quality' => $crtItm->getField('Quality'),
|
||||
'count' => $qty,
|
||||
);
|
||||
$crtItm->addGlobalsToJscript($pageData);
|
||||
$crtItm->addGlobalsToJscript($smarty);
|
||||
$tmp['icon'] = $iconId;
|
||||
$pageData['page']['icons'][] = array(
|
||||
'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('lvData', $pageData);
|
||||
|
||||
// Mysql query execution statistics
|
||||
$smarty->assign('mysql', DB::Aowow()->getStatistics());
|
||||
|
||||
// load the page
|
||||
$smarty->display('achievement.tpl');
|
||||
|
||||
|
||||
@@ -82,8 +82,7 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter))
|
||||
);
|
||||
|
||||
// fill g_items, g_titles, g_achievements
|
||||
$acvList->addGlobalsToJscript($pageData);
|
||||
$acvList->addRewardsToJScript($pageData);
|
||||
$acvList->addGlobalsToJscript($smarty);
|
||||
|
||||
// if we are have different cats display field
|
||||
if ($acvList->hasDiffFields(['category']))
|
||||
@@ -118,7 +117,6 @@ asort(Lang::$game['si']);
|
||||
$smarty->updatePageVars($page);
|
||||
$smarty->assign('filter', $filter);
|
||||
$smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$achievement));
|
||||
$smarty->assign('mysql', DB::Aowow()->getStatistics());
|
||||
$smarty->assign('lvData', $pageData);
|
||||
$smarty->display('achievements.tpl');
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ $page = array(
|
||||
|
||||
$smarty->updatePageVars($page);
|
||||
$smarty->assign('lang', Lang::$main);
|
||||
$smarty->assign('mysql', DB::Aowow()->getStatistics());
|
||||
$smarty->assign('lvData', $pageData);
|
||||
$smarty->display('generic-no-filter.tpl');
|
||||
|
||||
|
||||
@@ -70,7 +70,6 @@ $smarty->updatePageVars(array(
|
||||
));
|
||||
$smarty->assign('lvData', $pageData);
|
||||
$smarty->assign('lang', array_merge(Lang::$main, Lang::$compare));
|
||||
$smarty->assign('mysql', DB::Aowow()->getStatistics());
|
||||
$smarty->display('compare.tpl');
|
||||
|
||||
?>
|
||||
|
||||
@@ -29,7 +29,7 @@ if (!$smarty->loadCache($cacheKey, $pageData))
|
||||
'params' => []
|
||||
);
|
||||
|
||||
$money->addGlobalsToJscript($pageData);
|
||||
$money->addGlobalsToJscript($smarty);
|
||||
|
||||
$smarty->saveCache($cacheKey, $pageData);
|
||||
}
|
||||
@@ -43,7 +43,6 @@ $page = array(
|
||||
|
||||
$smarty->updatePageVars($page);
|
||||
$smarty->assign('lang', Lang::$main);
|
||||
$smarty->assign('mysql', DB::Aowow()->getStatistics());
|
||||
$smarty->assign('lvData', $pageData);
|
||||
$smarty->display('generic-no-filter.tpl');
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ if (!$smarty->loadCache($cacheKey, $pageData))
|
||||
)
|
||||
);
|
||||
|
||||
$events->addGlobalsToJScript($pageData);
|
||||
$events->addGlobalsToJScript($smarty);
|
||||
|
||||
$smarty->saveCache($cacheKey, $pageData);
|
||||
}
|
||||
@@ -86,7 +86,6 @@ $page = array(
|
||||
|
||||
$smarty->updatePageVars($page);
|
||||
$smarty->assign('lang', Lang::$main);
|
||||
$smarty->assign('mysql', DB::Aowow()->getStatistics());
|
||||
$smarty->assign('lvData', $pageData);
|
||||
$smarty->display('generic-no-filter.tpl');
|
||||
|
||||
|
||||
@@ -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('lvData', $pageData);
|
||||
|
||||
// Mysql query execution statistics
|
||||
$smarty->assign('mysql', $DB->getStatistics());
|
||||
|
||||
// load the page
|
||||
$smarty->display('item.tpl');
|
||||
|
||||
|
||||
@@ -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)
|
||||
$rel = [];
|
||||
@@ -230,7 +230,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
if (!$mask)
|
||||
$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('lang', array_merge(Lang::$main, Lang::$itemset));
|
||||
$smarty->assign('lvData', $pageData);
|
||||
$smarty->assign('mysql', DB::Aowow()->getStatistics());
|
||||
$smarty->display('itemset.tpl');
|
||||
|
||||
?>
|
||||
|
||||
@@ -20,7 +20,7 @@ if (!$smarty->loadCache($cacheKey, $pageData))
|
||||
'params' => []
|
||||
);
|
||||
|
||||
$itemsets->addGlobalsToJscript($pageData);
|
||||
$itemsets->addGlobalsToJscript($smarty);
|
||||
|
||||
// recreate form selection
|
||||
$filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : NULL;
|
||||
@@ -62,7 +62,6 @@ asort(Lang::$game['cl']);
|
||||
$smarty->updatePageVars($page);
|
||||
$smarty->assign('filter', $filter);
|
||||
$smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$itemset, Lang::$item));
|
||||
$smarty->assign('mysql', DB::Aowow()->getStatistics());
|
||||
$smarty->assign('lvData', $pageData);
|
||||
$smarty->display('itemsets.tpl');
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ $page = array(
|
||||
|
||||
$smarty->updatePageVars($page);
|
||||
$smarty->assign('lang', array_merge(Lang::$main, Lang::$maps));
|
||||
$smarty->assign('mysql', DB::Aowow()->getStatistics());
|
||||
$smarty->display('maps.tpl');
|
||||
|
||||
?>
|
||||
|
||||
@@ -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('lvData', $pageData);
|
||||
|
||||
// Mysql query execution statistics
|
||||
$smarty->assign('mysql', $DB->getStatistics());
|
||||
|
||||
// load the page
|
||||
$smarty->display('npc.tpl');
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
if ($pet->error)
|
||||
$smarty->notFound(Lang::$game['pet']);
|
||||
|
||||
$pet->addGlobalsToJscript($pageData);
|
||||
// $pet->addGlobalsToJscript($smarty);
|
||||
$pet->reset();
|
||||
|
||||
$infobox = [];
|
||||
@@ -83,7 +83,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
$list[] = $i;
|
||||
|
||||
$food = new ItemList(array(['i.subClass', [5, 8]], ['i.FoodType', $list]));
|
||||
$food->addGlobalsToJscript($pageData);
|
||||
$food->addGlobalsToJscript($smarty);
|
||||
|
||||
$pageData['diet'] = array(
|
||||
'data' => $food->getListviewData(),
|
||||
@@ -126,7 +126,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
|
||||
|
||||
$spells = new SpellList($conditions);
|
||||
$spells->addGlobalsToJscript($pageData);
|
||||
$spells->addGlobalsToJscript($smarty, GLOBALINFO_SELF);
|
||||
|
||||
$pageData['abilities'] = array(
|
||||
'data' => $spells->getListviewData(),
|
||||
@@ -148,7 +148,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
}
|
||||
|
||||
$talents = new SpellList($conditions);
|
||||
$talents->addGlobalsToJscript($pageData);
|
||||
$talents->addGlobalsToJscript($smarty, GLOBALINFO_SELF);
|
||||
|
||||
$pageData['talents'] = array(
|
||||
'data' => $talents->getListviewData(),
|
||||
@@ -180,7 +180,6 @@ $smarty->updatePageVars(array(
|
||||
$smarty->assign('community', CommunityContent::getAll(TYPE_PET, $id)); // comments, screenshots, videos
|
||||
$smarty->assign('lang', array_merge(Lang::$main, Lang::$game));
|
||||
$smarty->assign('lvData', $pageData);
|
||||
$smarty->assign('mysql', DB::Aowow()->getStatistics());
|
||||
$smarty->display('pet.tpl');
|
||||
|
||||
?>
|
||||
|
||||
@@ -34,7 +34,7 @@ if (!$smarty->loadCache($cacheKey, $pageData))
|
||||
$pageData['params']['hiddenCols'] = "$['type']";
|
||||
|
||||
$pets->reset();
|
||||
$pets->addGlobalsToJscript($pageData);
|
||||
$pets->addGlobalsToJscript($smarty, GLOBALINFO_RELATED);
|
||||
|
||||
$smarty->saveCache($cacheKey, $pageData);
|
||||
}
|
||||
@@ -49,7 +49,6 @@ $page = array(
|
||||
$smarty->updatePageVars($page);
|
||||
$smarty->assign('lang', Lang::$main);
|
||||
$smarty->assign('lvData', $pageData);
|
||||
$smarty->assign('mysql', DB::Aowow()->getStatistics());
|
||||
$smarty->display('generic-no-filter.tpl');
|
||||
|
||||
?>
|
||||
|
||||
@@ -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('lvData', $pageData);
|
||||
|
||||
// Mysql query execution statistics
|
||||
$smarty->assign('mysql', $DB->getStatistics());
|
||||
|
||||
// load the page
|
||||
$smarty->display('quest.tpl');
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ $page = array(
|
||||
|
||||
$smarty->updatePageVars($page);
|
||||
$smarty->assign('lang', Lang::$main);
|
||||
$smarty->assign('mysql', DB::Aowow()->getStatistics());
|
||||
$smarty->assign('lvData', $pageData);
|
||||
$smarty->display('generic-no-filter.tpl');
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
$pageData['title'] = [$spell->getField('name', true), Util::ucFirst(Lang::$game['spell'])];
|
||||
|
||||
// js-globals
|
||||
$spell->addGlobalsToJScript($pageData);
|
||||
$spell->addGlobalsToJScript($smarty, GLOBALINFO_RELATED);
|
||||
|
||||
// prepare Tools
|
||||
foreach ($pageData['page']['tools'] as $k => $tool)
|
||||
@@ -273,7 +273,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
'count' => 0
|
||||
);
|
||||
|
||||
$trig->addGlobalsToJScript($pageData);
|
||||
$trig->addGlobalsToJScript($smarty);
|
||||
}
|
||||
|
||||
// Effect Name
|
||||
@@ -604,8 +604,8 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
]
|
||||
);
|
||||
|
||||
$modSpells->addGlobalsToJScript($pageData);
|
||||
if(!$modSpells->hasDiffFields(['skillLines']))
|
||||
$modSpells->addGlobalsToJScript($smarty);
|
||||
if(!$modSpells->hasSetFields(['skillLines']))
|
||||
$pageData['modifies']['params']['hiddenCols'] = "$['skill']";
|
||||
}
|
||||
}
|
||||
@@ -653,8 +653,8 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
]
|
||||
);
|
||||
|
||||
$modsSpell->addGlobalsToJScript($pageData);
|
||||
if(!$modsSpell->hasDiffFields(['skillLines']))
|
||||
$modsSpell->addGlobalsToJScript($smarty);
|
||||
if(!$modsSpell->hasSetFields(['skillLines']))
|
||||
$pageData['modifiedBy']['params']['hiddenCols'] = "$['skill']";
|
||||
}
|
||||
}
|
||||
@@ -682,8 +682,8 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
]
|
||||
);
|
||||
|
||||
$saSpells->addGlobalsToJScript($pageData);
|
||||
if(!$saSpells->hasDiffFields(['skillLines']))
|
||||
$saSpells->addGlobalsToJScript($smarty);
|
||||
if(!$saSpells->hasSetFields(['skillLines']))
|
||||
$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
|
||||
@@ -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
|
||||
$slItems = new ItemList(array(['i.entry', $ids]));
|
||||
$slItems->addGlobalsToJscript($pageData);
|
||||
$slItems->addGlobalsToJscript($smarty);
|
||||
$lv += $slItems->getListviewData();
|
||||
|
||||
$equal = true;
|
||||
@@ -803,11 +803,10 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
{
|
||||
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]['percent'] = $extraItem['additionalCreateChance'];
|
||||
$lv[$bar]['condition'] = json_encode(['type' => TYPE_SPELL, 'typeId' => $reqSpec->id, 'status' => 2], JSON_NUMERIC_CHECK);
|
||||
$reqSpec->addGlobalsToJscript($pageData);
|
||||
$lv[$bar]['condition'] = json_encode(['type' => TYPE_SPELL, 'typeId' => $extraItem['requiredSpecialization'], 'status' => 2], JSON_NUMERIC_CHECK);
|
||||
$smarty->extendGlobalIds(TYPE_SPELL, $extraItem['requiredSpecialization']);
|
||||
|
||||
$extraCols[] = 'Listview.extraCols.condition';
|
||||
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('lvData', $pageData);
|
||||
|
||||
// Mysql query execution statistics
|
||||
$smarty->assign('mysql', DB::Aowow()->getStatistics());
|
||||
|
||||
// load the page
|
||||
$smarty->display('spell.tpl');
|
||||
|
||||
|
||||
@@ -381,7 +381,7 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter))
|
||||
|
||||
$pageData['data'] = $spells->getListviewData();
|
||||
|
||||
$spells->addGlobalsToJscript($pageData);
|
||||
$spells->addGlobalsToJscript($smarty, GLOBALINFO_SELF);
|
||||
|
||||
// create note if search limit was exceeded; overwriting 'note' is intentional
|
||||
if ($spells->getMatches() > $AoWoWconf['sqlLimit'])
|
||||
@@ -393,7 +393,7 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter))
|
||||
if ($spells->filterGetError())
|
||||
$pageData['params']['_errors'] = '$1';
|
||||
|
||||
$mask = $spells->hasDiffFields(['reagent1', 'skillLines', 'trainingCost']);
|
||||
$mask = $spells->hasSetFields(['reagent1', 'skillLines', 'trainingCost']);
|
||||
|
||||
if ($mask & 0x1)
|
||||
$visibleCols[] = 'reagents';
|
||||
@@ -444,7 +444,6 @@ Lang::$game['race'] = Util::ucFirst(Lang::$game['race']);
|
||||
$smarty->updatePageVars($page);
|
||||
$smarty->assign('filter', $filter);
|
||||
$smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$achievement));
|
||||
$smarty->assign('mysql', DB::Aowow()->getStatistics());
|
||||
$smarty->assign('lvData', $pageData);
|
||||
$smarty->display('spells.tpl');
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ if ($petCalc)
|
||||
$smarty->updatePageVars($page);
|
||||
$smarty->assign('tcType', $petCalc ? 'pc' : 'tc');
|
||||
$smarty->assign('lang', array_merge(Lang::$main, Lang::$talent));
|
||||
$smarty->assign('mysql', DB::Aowow()->getStatistics());
|
||||
$smarty->display('talent.tpl');
|
||||
|
||||
?>
|
||||
|
||||
@@ -16,11 +16,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
if ($title->error)
|
||||
$smarty->notFound(Lang::$game['title']);
|
||||
|
||||
$title->addGlobalsToJscript($pageData);
|
||||
$title->reset();
|
||||
|
||||
$infobox = [];
|
||||
|
||||
if ($title->getField('side') == SIDE_ALLIANCE)
|
||||
$infobox[] = Lang::$main['side'].Lang::$colon.'[span class=alliance-icon]'.Lang::$game['si'][SIDE_ALLIANCE].'[/span]';
|
||||
else if ($title->getField('side') == SIDE_HORDE)
|
||||
@@ -51,7 +47,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
{
|
||||
case 4:
|
||||
$quests = new QuestList(array(['id', $entries]));
|
||||
$quests->addRewardsToJscript($pageData);
|
||||
$quests->addGlobalsToJscript($smarty, GLOBALINFO_REWARDS);
|
||||
|
||||
$pageData['page']['questReward'] = $quests->getListviewData();
|
||||
$pageData['page']['questParams'] = array(
|
||||
@@ -64,8 +60,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
break;
|
||||
case 12:
|
||||
$acvs = new AchievementList(array(['id', $entries]));
|
||||
$acvs->addGlobalsToJscript($pageData);
|
||||
$acvs->addRewardsToJscript($pageData);
|
||||
$acvs->addGlobalsToJscript($smarty);
|
||||
|
||||
$pageData['page']['acvReward'] = $acvs->getListviewData();
|
||||
$pageData['page']['acvParams'] = array(
|
||||
@@ -100,7 +95,6 @@ $smarty->updatePageVars(array(
|
||||
$smarty->assign('community', CommunityContent::getAll(TYPE_TITLE, $id)); // comments, screenshots, videos
|
||||
$smarty->assign('lang', array_merge(Lang::$main));
|
||||
$smarty->assign('lvData', $pageData);
|
||||
$smarty->assign('mysql', DB::Aowow()->getStatistics());
|
||||
$smarty->display('title.tpl');
|
||||
|
||||
?>
|
||||
|
||||
@@ -47,7 +47,6 @@ $page = array(
|
||||
$smarty->updatePageVars($page);
|
||||
$smarty->assign('lang', Lang::$main);
|
||||
$smarty->assign('lvData', $pageData);
|
||||
$smarty->assign('mysql', DB::Aowow()->getStatistics());
|
||||
$smarty->display('generic-no-filter.tpl');
|
||||
|
||||
?>
|
||||
|
||||
@@ -138,7 +138,6 @@ $page = array(
|
||||
|
||||
$smarty->updatePageVars($page);
|
||||
$smarty->assign('lang', Lang::$main);
|
||||
$smarty->assign('mysql', DB::Aowow()->getStatistics());
|
||||
$smarty->assign('lvData', $pageData);
|
||||
$smarty->display('generic-no-filter.tpl');
|
||||
|
||||
|
||||
101
search.php
101
search.php
@@ -87,7 +87,6 @@ if (strlen($query) < 3 || !($searchMask & SEARCH_MASK_ALL))
|
||||
// insufficient queries throw an error
|
||||
$smarty->assign('lang', array_merge(Lang::$main, Lang::$search));
|
||||
$smarty->assign('found', []);
|
||||
$smarty->assign('mysql', DB::Aowow()->getStatistics());
|
||||
$smarty->assign('search', $query);
|
||||
|
||||
$smarty->display('search.tpl');
|
||||
@@ -124,6 +123,7 @@ if ($searchMask & 0x1)
|
||||
'type' => TYPE_CLASS,
|
||||
'appendix' => ' (Class)',
|
||||
'matches' => $classes->getMatches(),
|
||||
'file' => 'class',
|
||||
'data' => $data,
|
||||
'params' => ['tabs' => '$myTabs']
|
||||
);
|
||||
@@ -156,6 +156,7 @@ if ($searchMask & 0x2)
|
||||
'type' => TYPE_RACE,
|
||||
'appendix' => ' (Race)',
|
||||
'matches' => $races->getMatches(),
|
||||
'file' => 'race',
|
||||
'data' => $data,
|
||||
'params' => ['tabs' => '$myTabs']
|
||||
);
|
||||
@@ -200,6 +201,7 @@ if ($searchMask & 0x4)
|
||||
'type' => TYPE_TITLE,
|
||||
'appendix' => ' (Title)',
|
||||
'matches' => $titles->getMatches(),
|
||||
'file' => 'title',
|
||||
'data' => $data,
|
||||
'params' => ['tabs' => '$myTabs']
|
||||
);
|
||||
@@ -230,7 +232,7 @@ if ($searchMask & 0x8)
|
||||
|
||||
if ($data = $wEvents->getListviewData())
|
||||
{
|
||||
$wEvents->addGlobalsToJscript($jsGlobals);
|
||||
$wEvents->addGlobalsToJscript($smarty);
|
||||
|
||||
foreach ($data as &$d)
|
||||
{
|
||||
@@ -243,6 +245,7 @@ if ($searchMask & 0x8)
|
||||
'type' => TYPE_WORLDEVENT,
|
||||
'appendix' => ' (World Event)',
|
||||
'matches' => $wEvents->getMatches(),
|
||||
'file' => 'event',
|
||||
'data' => $data,
|
||||
'params' => ['tabs' => '$myTabs']
|
||||
);
|
||||
@@ -269,6 +272,7 @@ if ($searchMask & 0x10)
|
||||
'type' => TYPE_CURRENCY,
|
||||
'appendix' => ' (Currency)',
|
||||
'matches' => $money->getMatches(),
|
||||
'file' => 'currency',
|
||||
'data' => $data,
|
||||
'params' => ['tabs' => '$myTabs']
|
||||
);
|
||||
@@ -294,7 +298,7 @@ if ($searchMask & 0x20)
|
||||
|
||||
if ($data = $sets->getListviewData())
|
||||
{
|
||||
$sets->addGlobalsToJscript($jsGlobals);
|
||||
$sets->addGlobalsToJscript($smarty, GLOBALINFO_SELF);
|
||||
|
||||
while ($sets->iterate())
|
||||
$data[$sets->id]['param1'] = $sets->getField('quality');
|
||||
@@ -303,6 +307,7 @@ if ($searchMask & 0x20)
|
||||
'type' => TYPE_ITEMSET,
|
||||
'appendix' => ' (Item Set)',
|
||||
'matches' => $sets->getMatches(),
|
||||
'file' => 'itemset',
|
||||
'data' => $data,
|
||||
'params' => ['tabs' => '$myTabs'],
|
||||
'pcsToSet' => $sets->pieceToSet
|
||||
@@ -330,7 +335,7 @@ if ($searchMask & 0x40)
|
||||
|
||||
if ($data = $items->getListviewData($searchMask & SEARCH_TYPE_JSON ? (ITEMINFO_SUBITEMS | ITEMINFO_JSON) : 0))
|
||||
{
|
||||
$items->addGlobalsToJscript($jsGlobals);
|
||||
$items->addGlobalsToJscript($smarty);
|
||||
|
||||
while ($items->iterate())
|
||||
{
|
||||
@@ -345,8 +350,9 @@ if ($searchMask & 0x40)
|
||||
'type' => TYPE_ITEM,
|
||||
'appendix' => ' (Item)',
|
||||
'matches' => $items->getMatches(),
|
||||
'params' => ['tabs' => '$myTabs'],
|
||||
'file' => 'item',
|
||||
'data' => $data,
|
||||
'params' => ['tabs' => '$myTabs']
|
||||
);
|
||||
|
||||
if ($items->getMatches() > $maxResults)
|
||||
@@ -372,11 +378,10 @@ if ($searchMask & 0x80)
|
||||
|
||||
if ($data = $abilities->getListviewData())
|
||||
{
|
||||
$abilities->addGlobalsToJscript($jsGlobals);
|
||||
$abilities->addGlobalsToJscript($smarty);
|
||||
|
||||
$vis = ['level', 'singleclass', 'schools'];
|
||||
|
||||
if ($abilities->hasDiffFields(['reagent1']))
|
||||
if ($abilities->hasSetFields(['reagent1']))
|
||||
$vis[] = 'reagents';
|
||||
|
||||
while ($abilities->iterate())
|
||||
@@ -389,6 +394,7 @@ if ($searchMask & 0x80)
|
||||
'type' => TYPE_SPELL,
|
||||
'appendix' => ' (Ability)',
|
||||
'matches' => $abilities->getMatches(),
|
||||
'file' => 'spell',
|
||||
'data' => $data,
|
||||
'params' => [
|
||||
'id' => 'abilities',
|
||||
@@ -419,7 +425,11 @@ if ($searchMask & 0x100)
|
||||
|
||||
if ($data = $talents->getListviewData())
|
||||
{
|
||||
$talents->addGlobalsToJscript($jsGlobals);
|
||||
$talents->addGlobalsToJscript($smarty);
|
||||
|
||||
$vis = ['level', 'singleclass', 'schools'];
|
||||
if ($abilities->hasSetFields(['reagent1']))
|
||||
$vis[] = 'reagents';
|
||||
|
||||
while ($talents->iterate())
|
||||
{
|
||||
@@ -431,12 +441,13 @@ if ($searchMask & 0x100)
|
||||
'type' => TYPE_SPELL,
|
||||
'appendix' => ' (Talent)',
|
||||
'matches' => $talents->getMatches(),
|
||||
'file' => 'spell',
|
||||
'data' => $data,
|
||||
'params' => [
|
||||
'id' => 'talents',
|
||||
'tabs' => '$myTabs',
|
||||
'name' => '$LANG.tab_talents',
|
||||
'visibleCols' => "$['level', 'singleclass', 'schools']"
|
||||
'visibleCols' => '$'.json_encode($vis)
|
||||
]
|
||||
);
|
||||
|
||||
@@ -461,7 +472,7 @@ if ($searchMask & 0x200)
|
||||
|
||||
if ($data = $glyphs->getListviewData())
|
||||
{
|
||||
$glyphs->addGlobalsToJscript($jsGlobals);
|
||||
$glyphs->addGlobalsToJscript($smarty, GLOBALINFO_SELF);
|
||||
|
||||
while ($glyphs->iterate())
|
||||
$data[$glyphs->id]['param1'] = '"'.strToLower($glyphs->getField('iconString')).'"';
|
||||
@@ -470,6 +481,7 @@ if ($searchMask & 0x200)
|
||||
'type' => TYPE_SPELL,
|
||||
'appendix' => ' (Glyph)',
|
||||
'matches' => $glyphs->getMatches(),
|
||||
'file' => 'spell',
|
||||
'data' => $data,
|
||||
'params' => [
|
||||
'id' => 'glyphs',
|
||||
@@ -500,7 +512,7 @@ if ($searchMask & 0x400)
|
||||
|
||||
if ($data = $prof->getListviewData())
|
||||
{
|
||||
$prof->addGlobalsToJscript($jsGlobals);
|
||||
$prof->addGlobalsToJscript($smarty, GLOBALINFO_SELF);
|
||||
|
||||
while ($prof->iterate())
|
||||
$data[$prof->id]['param1'] = '"'.strToLower($prof->getField('iconString')).'"';
|
||||
@@ -509,6 +521,7 @@ if ($searchMask & 0x400)
|
||||
'type' => TYPE_SPELL,
|
||||
'appendix' => ' (Proficiency)',
|
||||
'matches' => $prof->getMatches(),
|
||||
'file' => 'spell',
|
||||
'data' => $data,
|
||||
'params' => [
|
||||
'id' => 'proficiencies',
|
||||
@@ -539,7 +552,7 @@ if ($searchMask & 0x800)
|
||||
|
||||
if ($data = $prof->getListviewData())
|
||||
{
|
||||
$prof->addGlobalsToJscript($jsGlobals);
|
||||
$prof->addGlobalsToJscript($smarty);
|
||||
|
||||
while ($prof->iterate())
|
||||
$data[$prof->id]['param1'] = '"'.strToLower($prof->getField('iconString')).'"';
|
||||
@@ -548,6 +561,7 @@ if ($searchMask & 0x800)
|
||||
'type' => TYPE_SPELL,
|
||||
'appendix' => ' (Profession)',
|
||||
'matches' => $prof->getMatches(),
|
||||
'file' => 'spell',
|
||||
'data' => $data,
|
||||
'params' => [
|
||||
'id' => 'professions',
|
||||
@@ -579,7 +593,7 @@ if ($searchMask & 0x1000)
|
||||
|
||||
if ($data = $vPets->getListviewData())
|
||||
{
|
||||
$vPets->addGlobalsToJscript($jsGlobals);
|
||||
$vPets->addGlobalsToJscript($smarty);
|
||||
|
||||
while ($vPets->iterate())
|
||||
$data[$vPets->id]['param1'] = '"'.strToLower($vPets->getField('iconString')).'"';
|
||||
@@ -588,6 +602,7 @@ if ($searchMask & 0x1000)
|
||||
'type' => TYPE_SPELL,
|
||||
'appendix' => ' (Companion)',
|
||||
'matches' => $vPets->getMatches(),
|
||||
'file' => 'spell',
|
||||
'data' => $data,
|
||||
'params' => [
|
||||
'id' => 'companions',
|
||||
@@ -618,7 +633,7 @@ if ($searchMask & 0x2000)
|
||||
|
||||
if ($data = $mounts->getListviewData())
|
||||
{
|
||||
$mounts->addGlobalsToJscript($jsGlobals);
|
||||
$mounts->addGlobalsToJscript($smarty, GLOBALINFO_SELF);
|
||||
|
||||
while ($mounts->iterate())
|
||||
$data[$mounts->id]['param1'] = '"'.strToLower($mounts->getField('iconString')).'"';
|
||||
@@ -627,6 +642,7 @@ if ($searchMask & 0x2000)
|
||||
'type' => TYPE_SPELL,
|
||||
'appendix' => ' (Mount)',
|
||||
'matches' => $mounts->getMatches(),
|
||||
'file' => 'spell',
|
||||
'data' => $data,
|
||||
'params' => [
|
||||
'id' => 'mounts',
|
||||
@@ -644,7 +660,42 @@ if ($searchMask & 0x2000)
|
||||
}
|
||||
|
||||
// 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
|
||||
// if ($searchMask & 0x8000)
|
||||
@@ -662,8 +713,7 @@ if ($searchMask & 0x10000)
|
||||
|
||||
if ($data = $acvs->getListviewData())
|
||||
{
|
||||
$acvs->addGlobalsToJScript($jsGlobals);
|
||||
$acvs->addRewardsToJScript($jsGlobals);
|
||||
$acvs->addGlobalsToJScript($smarty);
|
||||
|
||||
while ($acvs->iterate())
|
||||
$data[$acvs->id]['param1'] = '"'.strToLower($acvs->getField('iconString')).'"';
|
||||
@@ -672,6 +722,7 @@ if ($searchMask & 0x10000)
|
||||
'type' => TYPE_ACHIEVEMENT,
|
||||
'appendix' => ' (Achievement)',
|
||||
'matches' => $acvs->getMatches(),
|
||||
'file' => 'achievement',
|
||||
'data' => $data,
|
||||
'params' => [
|
||||
'tabs' => '$myTabs',
|
||||
@@ -700,12 +751,12 @@ if ($searchMask & 0x20000)
|
||||
|
||||
if ($data = $stats->getListviewData())
|
||||
{
|
||||
$stats->addGlobalsToJScript($jsGlobals);
|
||||
$stats->addRewardsToJScript($jsGlobals);
|
||||
$stats->addGlobalsToJScript($smarty, GLOBALINFO_SELF);
|
||||
|
||||
$found['statistic'] = array(
|
||||
'type' => TYPE_ACHIEVEMENT,
|
||||
'matches' => $stats->getMatches(),
|
||||
'file' => 'achievement',
|
||||
'data' => $data,
|
||||
'params' => [
|
||||
'tabs' => '$myTabs',
|
||||
@@ -743,8 +794,6 @@ if ($searchMask & 0x400000)
|
||||
|
||||
if ($data = $pets->getListviewData())
|
||||
{
|
||||
$pets->addGlobalsToJScript($jsGlobals);
|
||||
|
||||
while ($pets->iterate())
|
||||
$data[$pets->id]['param1'] = '"'.$pets->getField('iconString').'"';
|
||||
|
||||
@@ -752,6 +801,7 @@ if ($searchMask & 0x400000)
|
||||
'type' => TYPE_PET,
|
||||
'appendix' => ' (Pet)',
|
||||
'matches' => $pets->getMatches(),
|
||||
'file' => 'pet',
|
||||
'data' => $data,
|
||||
'params' => [
|
||||
'tabs' => '$myTabs',
|
||||
@@ -779,7 +829,7 @@ if ($searchMask & 0x800000)
|
||||
|
||||
if ($data = $npcAbilities->getListviewData())
|
||||
{
|
||||
$npcAbilities->addGlobalsToJscript($jsGlobals);
|
||||
$npcAbilities->addGlobalsToJscript($smarty, GLOBALINFO_SELF);
|
||||
|
||||
while ($npcAbilities->iterate())
|
||||
$data[$npcAbilities->id]['param1'] = '"'.strToLower($npcAbilities->getField('iconString')).'"';
|
||||
@@ -788,6 +838,7 @@ if ($searchMask & 0x800000)
|
||||
'type' => TYPE_SPELL,
|
||||
'appendix' => ' (Spell)',
|
||||
'matches' => $npcAbilities->getMatches(),
|
||||
'file' => 'spell',
|
||||
'data' => $data,
|
||||
'params' => [
|
||||
'id' => 'npc-abilities',
|
||||
@@ -819,7 +870,7 @@ if ($searchMask & 0x1000000)
|
||||
|
||||
if ($data = $misc->getListviewData())
|
||||
{
|
||||
$misc->addGlobalsToJscript($jsGlobals);
|
||||
$misc->addGlobalsToJscript($smarty, GLOBALINFO_SELF);
|
||||
|
||||
while ($misc->iterate())
|
||||
$data[$misc->id]['param1'] = '"'.strToLower($misc->getField('iconString')).'"';
|
||||
@@ -828,6 +879,7 @@ if ($searchMask & 0x1000000)
|
||||
'type' => TYPE_SPELL,
|
||||
'appendix' => ' (Spell)',
|
||||
'matches' => $misc->getMatches(),
|
||||
'file' => 'spell',
|
||||
'data' => $data,
|
||||
'params' => [
|
||||
'tabs' => '$myTabs',
|
||||
@@ -979,7 +1031,6 @@ else /* if ($searchMask & SEARCH_TYPE_REGULAR) */
|
||||
$smarty->assign('found', $found);
|
||||
$smarty->assign('lvData', $jsGlobals);
|
||||
$smarty->assign('search', $search);
|
||||
$smarty->assign('mysql', DB::Aowow()->getStatistics());
|
||||
|
||||
$smarty->display('search.tpl');
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
{/if}
|
||||
react:{$curr.react},
|
||||
location:{$curr.location},
|
||||
{if $curr.skin}
|
||||
{if isset($curr.skin)}
|
||||
skin: '{$curr.skin}',
|
||||
{/if}
|
||||
{if isset($curr.percent)}
|
||||
|
||||
@@ -31,15 +31,7 @@
|
||||
{strip}<script type="text/javascript">
|
||||
g_initHeader({$page.tab});
|
||||
LiveSearch.attach(ge('livesearch-generic'));
|
||||
{if isset($lvData.gAchievements)} { include file='bricks/globals/achievements.tpl' data=$lvData.gAchievements }{/if}
|
||||
{if isset($lvData.gClasses)} { include file='bricks/globals/classes.tpl' data=$lvData.gClasses }{/if}
|
||||
{if isset($lvData.gCurrencies)} { include file='bricks/globals/currencies.tpl' data=$lvData.gCurrencies }{/if}
|
||||
{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(?) *}
|
||||
{foreach from=$jsGlobals item="glob"}
|
||||
{include file="bricks/globals/`$glob[0]`.tpl" data=$glob[1]}
|
||||
{/foreach}
|
||||
</script>{/strip}
|
||||
|
||||
@@ -17,32 +17,9 @@
|
||||
<div id="listview-generic" class="listview"></div>
|
||||
<script type="text/javascript">
|
||||
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}
|
||||
{if isset($found.race)} {include file='bricks/listviews/race.tpl' data=$found.race.data params=$found.race.params } {/if}
|
||||
{if isset($found.title)} {include file='bricks/listviews/title.tpl' data=$found.title.data params=$found.title.params } {/if}
|
||||
{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}
|
||||
{foreach from=$found item="f"}
|
||||
{include file="bricks/listviews/`$f.file`.tpl" data=$f.data params=$f.params}
|
||||
{/foreach}
|
||||
myTabs.flush();
|
||||
</script>
|
||||
{else}
|
||||
|
||||
Reference in New Issue
Block a user