BaseTypes:

- rewrote BaseType::iterate() to be a generator and yield references (requires php 5.5)
- reduced usage of bandaid BaseType::reset()
- removed Util::getIdFieldName() which was even more of a bandaid
- discovered DBSimple::selectPage() and consequently removed $matchQuery as they are now obsoloete

Util:
- added trainerTemplate lists for future use with trainers and trained spells

misc. forgotten and/or broken stuff here and there
This commit is contained in:
Sarjuuk
2013-08-18 13:40:12 +02:00
parent 0b0fa39ff4
commit 73cdce784e
34 changed files with 361 additions and 395 deletions

View File

@@ -13,45 +13,41 @@ class AchievementList extends BaseType
public $tooltip = [];
protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_achievement WHERE [filter] [cond] GROUP BY Id ORDER BY `orderInGroup` ASC';
protected $matchQuery = 'SELECT COUNT(1) FROM ?_achievement WHERE [filter] [cond]';
public function __construct($conditions, $applyFilter = false)
{
parent::__construct($conditions, $applyFilter);
// post processing
while ($this->iterate())
foreach ($this->iterate() as &$_curTpl)
{
if (!$this->curTpl['iconString'])
$this->templates[$this->id]['iconString'] = 'INV_Misc_QuestionMark';
if (!$_curTpl['iconString'])
$_curTpl['iconString'] = 'INV_Misc_QuestionMark';
//"rewards":[[11,137],[3,138]] [type, typeId]
$rewards = [TYPE_ITEM => [], TYPE_TITLE => []];
if (!empty($this->curTpl['rewardIds']))
$_curTpl['rewards'] = [TYPE_ITEM => [], TYPE_TITLE => []];
if (!empty($_curTpl['rewardIds']))
{
$rewIds = explode(" ", $this->curTpl['rewardIds']);
$rewIds = explode(" ", $_curTpl['rewardIds']);
foreach ($rewIds as $rewId)
{
if ($rewId > 0)
$rewards[TYPE_ITEM][] = $rewId;
$_curTpl['rewards'][TYPE_ITEM][] = $rewId;
else if ($rewId < 0)
$rewards[TYPE_TITLE][] = -$rewId;
$_curTpl['rewards'][TYPE_TITLE][] = -$rewId;
}
}
$this->templates[$this->id]['rewards'] = $rewards;
}
$this->reset(); // restore 'iterator'
}
public function addGlobalsToJscript(&$template, $addMask = GLOBALINFO_ANY)
{
while ($this->iterate())
foreach ($this->iterate() as $__)
{
if ($addMask & GLOBALINFO_SELF)
$template->extendGlobalData(self::$type, [$this->id => array(
'icon' => $this->curTpl['iconString'],
'name' => Util::localizedString($this->curTpl, 'name')
'name' => $this->getField('name', true)
)]);
if ($addMask & GLOBALINFO_REWARDS)
@@ -69,16 +65,16 @@ class AchievementList extends BaseType
{
$data = [];
while ($this->iterate())
foreach ($this->iterate() as $__)
{
$data[$this->id] = array(
'id' => $this->id,
'name' => Util::localizedString($this->curTpl, 'name'),
'description' => Util::localizedString($this->curTpl, 'description'),
'points' => $this->curTpl['points'],
'faction' => $this->curTpl['faction'],
'category' => $this->curTpl['category'],
'parentCat' => $this->curTpl['parentCat'],
'id' => $this->id,
'name' => $this->getField('name', true),
'description' => $this->getField('description', true),
'points' => $this->curTpl['points'],
'faction' => $this->curTpl['faction'],
'category' => $this->curTpl['category'],
'parentCat' => $this->curTpl['parentCat'],
);
// going out on a limb here: type = 1 if in level 3 of statistics tree, so, IF (statistic AND parentCat NOT statistic (1)) i guess
@@ -93,7 +89,7 @@ class AchievementList extends BaseType
if ($rewards)
$data[$this->id]['rewards'] = '['.implode(',', $rewards).']';
else if (!empty($this->curTpl['reward']))
$data[$this->id]['reward'] = Util::localizedString($this->curTpl, 'reward');
$data[$this->id]['reward'] = $this->getField('reward', true);
}
return $data;
@@ -104,16 +100,16 @@ class AchievementList extends BaseType
{
$data = [];
while ($this->iterate())
foreach ($this->iterate() as $__)
{
$data[$this->id] = array(
'id' => $this->id,
'name' => Util::localizedString($this->curTpl, 'name'),
'description' => Util::localizedString($this->curTpl, 'description'),
'points' => $this->curTpl['points'],
'iconname' => $this->curTpl['iconString'],
'count' => $this->curTpl['reqCriteriaCount'],
'reward' => empty($this->curTpl['reward_loc'.User::$localeId]) ? NULL : Util::localizedString($this->curTpl, 'reward')
'id' => $this->id,
'name' => $this->getField('name', true),
'description' => $this->getField('description', true),
'points' => $this->curTpl['points'],
'iconname' => $this->curTpl['iconString'],
'count' => $this->curTpl['reqCriteriaCount'],
'reward' => $this->getField('reward', true)
);
}
@@ -123,7 +119,7 @@ class AchievementList extends BaseType
// only for current template
public function getCriteria($idx = -1)
{
if (empty($this->criteria))
foreach ($this->iterate() as $__)
{
$result = DB::Aowow()->Select('SELECT * FROM ?_achievementcriteria WHERE `refAchievement` = ? ORDER BY `order` ASC', $this->id);
if (!$result)
@@ -160,8 +156,8 @@ class AchievementList extends BaseType
if ($tmp)
$rows = array_merge($rows, $tmp);
$description = Util::localizedString($this->curTpl, 'description');
$name = Util::localizedString($this->curTpl, 'name');
$description = $this->getField('description', true);
$name = $this->getField('name', true);
$criteria = '';
$i = 0;
@@ -232,10 +228,10 @@ class AchievementList extends BaseType
{
$data = [];
while ($this->iterate())
foreach ($this->iterate() as $__)
{
$data[$this->id] = array(
"n" => Util::localizedString($this->curTpl, 'name'),
"n" => $this->getField('name', true),
"s" => $this->curTpl['faction'],
"t" => TYPE_ACHIEVEMENT,
"ti" => $this->id

View File

@@ -8,13 +8,12 @@ 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]';
public function getListviewData()
{
$data = [];
while ($this->iterate())
foreach ($this->iterate() as $__)
{
$data[$this->id] = array(
'id' => $this->id,
@@ -38,7 +37,7 @@ class CharClassList extends BaseType
public function addGlobalsToJscript(&$template, $addMask = 0)
{
while ($this->iterate())
foreach ($this->iterate() as $__)
$template->extendGlobalData(self::$type, [$this->id => ['name' => $this->getField('name', true)]]);
}

View File

@@ -8,13 +8,12 @@ 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]';
public function getListviewData()
{
$data = [];
while ($this->iterate())
foreach ($this->iterate() as $__)
{
$data[$this->id] = array(
'id' => $this->id,
@@ -35,7 +34,7 @@ class CharRaceList extends BaseType
public function addGlobalsToJscript(&$template, $addMask = 0)
{
while ($this->iterate())
foreach ($this->iterate() as $__)
$template->extendGlobalData(self::$type, [$this->id => ['name' => $this->getField('name', true)]]);
}

View File

@@ -13,7 +13,6 @@ class CreatureList extends BaseType
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 $matchQuery = 'SELECT COUNT(*) FROM ?_creature ct WHERE [filter] [cond]';
public static function getName($id)
{
@@ -114,7 +113,7 @@ class CreatureList extends BaseType
$data = [];
while ($this->iterate())
foreach ($this->iterate() as $__)
{
if ($addInfoMask & NPCINFO_MODEL)
{
@@ -168,7 +167,7 @@ class CreatureList extends BaseType
public function addGlobalsToJScript(&$template, $addMask = 0)
{
while ($this->iterate())
foreach ($this->iterate() as $__)
$template->extendGlobalData(TYPE_NPC, [$this->id => ['name' => $this->getField('name', true)]]);
}

View File

@@ -8,19 +8,18 @@ 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]';
public function getListviewData()
{
$data = [];
while ($this->iterate())
foreach ($this->iterate() as $__)
{
$data[$this->id] = array(
'id' => $this->id,
'category' => $this->curTpl['category'],
'name' => $this->getField('name', true),
'icon' => $this->curTpl['iconString']
'id' => $this->id,
'category' => $this->curTpl['category'],
'name' => $this->getField('name', true),
'icon' => $this->curTpl['iconString']
);
}
@@ -29,7 +28,7 @@ class CurrencyList extends BaseType
public function addGlobalsToJscript(&$template, $addMask = 0)
{
while ($this->iterate())
foreach ($this->iterate() as $__)
{
$template->extendGlobalData(self::$type, [$this->id => array(
'name' => $this->getField('name', true),

View File

@@ -509,11 +509,11 @@ class ItemsetListFilter extends Filter
// reqLevel min
if (isset($vl['minrl']))
$parts[] = 'i.reqLevel <= '.intVal($vl['minle']);
$parts[] = 'reqLevel <= '.intVal($vl['minrl']);
// reqLevel max
if (isset($vl['maxrl']))
$parts[] = 'i.reqLevel <= '.intVal($vl['maxle']);
$parts[] = 'reqLevel <= '.intVal($vl['maxrl']);
// class
if (isset($vl['cl']))

View File

@@ -18,10 +18,8 @@ class ItemList extends BaseType
private $ssd = [];
private $weightQuery = 'SELECT i.*, iX.*, l.*, i.entry AS ARRAY_KEY, [weightsA] AS sum FROM item_template i LEFT JOIN ?_item_template_addon iX ON i.entry = iX.id LEFT JOIN locales_item l ON i.entry = l.entry JOIN ?_item_stats ais ON ais.id = i.entry WHERE [weightsB] AND [cond] ORDER BY sum DESC';
private $weightMatch = 'SELECT COUNT(1) FROM item_template i LEFT JOIN ?_item_template_addon iX ON i.entry = iX.id LEFT JOIN locales_item l ON i.entry = l.entry JOIN ?_item_stats ais ON ais.id = i.entry WHERE [cond]';
protected $setupQuery = 'SELECT *, i.entry AS ARRAY_KEY FROM item_template i LEFT JOIN ?_item_template_addon iX ON i.entry = iX.id LEFT JOIN locales_item l ON i.entry = l.entry WHERE [filter] [cond] ORDER BY i.Quality DESC';
protected $matchQuery = 'SELECT COUNT(1) FROM item_template i LEFT JOIN ?_item_template_addon iX ON i.entry = iX.id LEFT JOIN locales_item l ON i.entry = l.entry WHERE [filter] [cond]';
public function __construct($conditions, $miscData = null)
{
@@ -45,19 +43,15 @@ class ItemList extends BaseType
$wtA = $wtA ? '('.implode(' + ', $wtA).')' : 1;
$wtB = $wtB ? '('.implode(' AND ', $wtB).')' : 1;
$this->setupQuery = $this->weightQuery;
$this->matchQuery = $this->weightMatch;
$this->setupQuery = strtr($this->setupQuery, ['[weightsA]' => $wtA, '[weightsB]' => $wtB]);
$this->matchQuery = strtr($this->matchQuery, ['[weightsA]' => $wtA, '[weightsB]' => $wtB]);
$this->setupQuery = strtr($this->weightQuery, ['[weightsA]' => $wtA, '[weightsB]' => $wtB]);
}
parent::__construct($conditions);
while ($this->iterate())
foreach ($this->iterate() as &$_curTpl)
{
// item is scaling; overwrite other values
if ($this->curTpl['ScalingStatDistribution'] > 0 && $this->curTpl['ScalingStatValue'] > 0)
if ($_curTpl['ScalingStatDistribution'] > 0 && $_curTpl['ScalingStatValue'] > 0)
$this->initScalingStats();
$this->initJsonStats();
@@ -67,16 +61,14 @@ class ItemList extends BaseType
$this->json[$this->id]['itemset'] = $miscData['pcsToSet'][$this->id];
// unify those pesky masks
$_ = $this->curTpl['AllowableClass'];
$_ = &$_curTpl['AllowableClass'];
if ($_ < 0 || ($_ & CLASS_MASK_ALL) == CLASS_MASK_ALL)
$this->templates[$this->id]['AllowableClass'] = 0;
$_ = 0;
$_ = $this->curTpl['AllowableRace'];
$_ = &$_curTpl['AllowableRace'];
if ($_ < 0 || ($_ & RACE_MASK_ALL) == RACE_MASK_ALL)
$this->templates[$this->id]['AllowableRace'] = 0;
$_ = 0;
}
$this->reset(); // restore 'iterator'
}
// use if you JUST need the name
@@ -126,7 +118,7 @@ class ItemList extends BaseType
*/
$data = [];
while ($this->iterate())
foreach ($this->iterate() as $__)
{
// random item is random
if ($this->curTpl['RandomProperty'] > 0 || $this->curTpl['RandomSuffix'] > 0)
@@ -205,7 +197,7 @@ class ItemList extends BaseType
public function addGlobalsToJscript(&$template, $addMask = 0)
{
while ($this->iterate())
foreach ($this->iterate() as $__)
{
$template->extendGlobalData(self::$type, [$this->id => array(
'name' => $this->getField('name', true),
@@ -585,7 +577,7 @@ class ItemList extends BaseType
if ($itemSpellsAndTrigger)
{
$itemSpells = new SpellList(array(['s.id', array_keys($itemSpellsAndTrigger)]));
while ($itemSpells->iterate())
foreach ($itemSpells->iterate() as $__)
if ($parsed = $itemSpells->parseText('description', $this->curTpl['RequiredLevel'])[0])
$green[] = Lang::$item['trigger'][$itemSpellsAndTrigger[$itemSpells->id]] . ($interactive ? '<a href="?spell='.$itemSpells->id.'">'.$parsed.'</a>' : $parsed);
}
@@ -650,7 +642,7 @@ class ItemList extends BaseType
if ($setSpellsAndIdx)
{
$boni = new SpellList(array(['s.id', array_keys($setSpellsAndIdx)]));
while ($boni->iterate())
foreach ($boni->iterate() as $__)
{
$itemset['spells'][] = array(
'tooltip' => $boni->parseText('description', $this->curTpl['RequiredLevel'])[0],
@@ -694,11 +686,11 @@ class ItemList extends BaseType
$reagents = new ItemList(array(['i.entry', array_keys($reagentItems)]));
$reqReag = [];
$x .= '<span class="q2">'.Lang::$item['trigger'][0].' <a href="?spell='.$this->curTpl['spellid_2'].'">'.Util::localizedString($this->curTpl, 'description').'</a></span><br />';
$x .= '<span class="q2">'.Lang::$item['trigger'][0].' <a href="?spell='.$this->curTpl['spellid_2'].'">'.$this->getField('description', true).'</a></span><br />';
$xCraft = '<div><br />'.$craftItem->renderTooltip(null, $interactive).'</div><br />';
while ($reagents->iterate())
foreach ($reagents->iterate() as $__)
$reqReag[] = '<a href="?item='.$reagents->id.'">'.$reagents->getField('name', true).'</a> ('.$reagentItems[$reagents->id].')';
$xCraft .= '<span class="q1">'.Lang::$game['requires2']." ".implode(", ", $reqReag).'</span>';
@@ -714,7 +706,7 @@ class ItemList extends BaseType
// funny, yellow text at the bottom, omit if we have a recipe
if ($this->curTpl['description'] && !isset($xCraft))
$xMisc[] = '<span class="q">"'.Util::localizedString($this->curTpl, 'description').'"</span>';
$xMisc[] = '<span class="q">"'.$this->getField('description', true).'"</span>';
// readable
if ($this->curTpl['PageText'])

View File

@@ -13,37 +13,34 @@ class ItemsetList extends BaseType
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]';
public function __construct($data, $applyFilter = false)
{
parent::__construct($data, $applyFilter);
// post processing
while ($this->iterate())
foreach ($this->iterate() as &$_curTpl)
{
$this->templates[$this->id]['classes'] = [];
$this->templates[$this->id]['pieces'] = [];
$_curTpl['classes'] = [];
$_curTpl['pieces'] = [];
for ($i = 1; $i < 12; $i++)
{
if ($this->curTpl['classMask'] & (1 << ($i - 1)))
if ($_curTpl['classMask'] & (1 << ($i - 1)))
{
$this->classes[] = $i;
$this->templates[$this->id]['classes'][] = $i;
$_curTpl['classes'][] = $i;
}
}
for ($i = 1; $i < 10; $i++)
{
if ($piece = $this->curTpl['item'.$i])
if ($piece = $_curTpl['item'.$i])
{
$this->templates[$this->id]['pieces'][] = $piece;
$_curTpl['pieces'][] = $piece;
$this->pieceToSet[$piece] = $this->id;
}
}
}
$this->reset();
$this->classes = array_unique($this->classes);
}
@@ -51,7 +48,7 @@ class ItemsetList extends BaseType
{
$data = [];
while ($this->iterate())
foreach ($this->iterate() as $__)
{
$data[$this->id] = array(
'id' => $this->id,

View File

@@ -10,27 +10,26 @@ class PetList extends BaseType
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]';
public function getListviewData()
{
$data = [];
while ($this->iterate())
foreach ($this->iterate() as $__)
{
$data[$this->id] = array(
'armor' => $this->curTpl['armor'],
'damage' => $this->curTpl['damage'],
'health' => $this->curTpl['health'],
'diet' => $this->curTpl['foodMask'],
'icon' => $this->curTpl['iconString'],
'id' => $this->id,
'maxlevel' => $this->curTpl['maxLevel'],
'minlevel' => $this->curTpl['minLevel'],
'name' => $this->getField('name', true),
'type' => $this->curTpl['type'],
'exotic' => $this->curTpl['exotic'],
'spells' => []
'armor' => $this->curTpl['armor'],
'damage' => $this->curTpl['damage'],
'health' => $this->curTpl['health'],
'diet' => $this->curTpl['foodMask'],
'icon' => $this->curTpl['iconString'],
'id' => $this->id,
'maxlevel' => $this->curTpl['maxLevel'],
'minlevel' => $this->curTpl['minLevel'],
'name' => $this->getField('name', true),
'type' => $this->curTpl['type'],
'exotic' => $this->curTpl['exotic'],
'spells' => []
);
if ($this->curTpl['expansion'] > 0)
@@ -48,7 +47,7 @@ class PetList extends BaseType
public function addGlobalsToJscript(&$template, $addMask = GLOBALINFO_ANY)
{
while ($this->iterate())
foreach ($this->iterate() as $__)
{
if ($addMask & GLOBALINFO_RELATED)
for ($i = 1; $i <= 4; $i++)

View File

@@ -7,37 +7,27 @@ class QuestList extends BaseType
{
public static $type = TYPE_QUEST;
public $cat1 = 0;
public $cat2 = 0;
protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM quest_template qt LEFT JOIN locales_quest lq ON qt.Id = lq.entry WHERE [filter] [cond] ORDER BY Id ASC';
protected $matchQuery = 'SELECT COUNT(1) FROM quest_template qt LEFT JOIN locales_quest lq ON qt.Id = lq.entry WHERE [filter] [cond]';
// parent::__construct does the job
public function iterate($qty = 1)
public function __construct($conditions)
{
$r = parent::iterate($qty);
parent::__construct($conditions);
if (!$this->id)
// post processing
foreach ($this->iterate() as &$_curTpl)
{
$this->cat1 = 0;
$this->cat2 = 0;
}
else
{
$this->cat1 = $this->curTpl['ZoneOrSort']; // should probably be in a method...
$_curTpl['cat1'] = $_curTpl['ZoneOrSort']; // should probably be in a method...
$_curTpl['cat2'] = 0;
foreach (Util::$questClasses as $k => $arr)
{
if (in_array($this->cat1, $arr))
if (in_array($_curTpl['cat1'], $arr))
{
$this->cat2 = $k;
$_curTpl['cat2'] = $k;
break;
}
}
}
return $r;
}
// static use START
@@ -77,14 +67,14 @@ class QuestList extends BaseType
{
$data = [];
while ($this->iterate())
foreach ($this->iterate() as $__)
{
$data[$this->id] = array(
"n" => $this->getField('Title', true),
"t" => TYPE_QUEST,
"ti" => $this->id,
"c" => $this->cat1,
"c2" => $this->cat2
"c" => $this->curTpl['cat1'],
"c2" => $this->curTpl['cat2']
);
}
@@ -95,11 +85,11 @@ class QuestList extends BaseType
{
$data = [];
while ($this->iterate())
foreach ($this->iterate() as $__)
{
$data[$this->id] = array(
'category' => $this->cat1,
'category2' => $this->cat2,
'category' => $this->curTpl['cat1'],
'category2' => $this->curTpl['cat2'],
'id' => $this->id,
'level' => $this->curTpl['Level'],
'reqlevel' => $this->curTpl['MinLevel'],
@@ -134,8 +124,9 @@ class QuestList extends BaseType
if ($_ = $this->curTpl['RequiredClasses'])
$data[$this->id]['reqclass'] = $_;
if ($_ = $this->curTpl['RequiredRaces'])
$data[$this->id]['reqrace'] = $_;
if ($_ = ($this->curTpl['RequiredRaces'] & RACE_MASK_ALL))
if ((($_ & RACE_MASK_ALLIANCE) != RACE_MASK_ALLIANCE) && (($_ & RACE_MASK_HORDE) != RACE_MASK_HORDE))
$data[$this->id]['reqrace'] = $_;
if ($_ = $this->curTpl['RewardOrRequiredMoney'])
if ($_ > 0)
@@ -261,7 +252,7 @@ class QuestList extends BaseType
public function addGlobalsToJScript(&$template, $addMask = GLOBALINFO_ANY)
{
while ($this->iterate())
foreach ($this->iterate() as $__)
{
if ($addMask & GLOBALINFO_REWARDS)
{

View File

@@ -9,16 +9,15 @@ class SkillList extends BaseType
public static $type = TYPE_SKILL;
protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_skillLine sl WHERE [cond] ORDER BY id ASC';
protected $matchQuery = 'SELECT COUNT(1) FROM ?_skillLine sl WHERE [cond]';
public function __construct($data)
{
parent::__construct($data);
// post processing
while ($this->iterate())
foreach ($this->iterate() as &$_curTpl)
{
$_ = &$this->curTpl['specializations']; // shorthand
$_ = &$_curTpl['specializations']; // shorthand
if (!$_)
$_ = [0, 0, 0, 0, 0];
else
@@ -27,11 +26,7 @@ class SkillList extends BaseType
while (count($_) < 5)
$_[] = 0;
}
$this->templates[$this->id] = $this->curTpl;
}
$this->reset(); // push first element back for instant use
}
public static function getName($id)
@@ -56,8 +51,9 @@ class SkillList extends BaseType
{
$data = [];
while ($this->iterate())
foreach ($this->iterate() as $__)
{
$data[$this->id] = array(
'category' => $this->curTpl['typeCat'],
'categorybak' => $this->curTpl['categoryId'],
@@ -75,7 +71,7 @@ class SkillList extends BaseType
public function addGlobalsToJScript(&$template, $addMask = 0)
{
while ($this->iterate())
foreach ($this->iterate() as $__)
{
$template->extendGlobalData(self::$type, [
$this->id => [

View File

@@ -35,7 +35,6 @@ class SpellList extends BaseType
private $charLevel = MAX_LEVEL;
protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_spell s WHERE [filter] [cond]';
protected $matchQuery = 'SELECT COUNT(*) FROM ?_spell s WHERE [filter] [cond]';
public function __construct($conditions, $applyFilter = false)
{
@@ -46,28 +45,28 @@ class SpellList extends BaseType
// post processing
$foo = [];
while ($this->iterate())
foreach ($this->iterate() as &$_curTpl)
{
// required for globals
for ($i = 1; $i <= 3; $i++)
if ($this->canCreateItem())
$foo[] = (int)$this->curTpl['effect'.$i.'CreateItemId'];
$foo[] = (int)$_curTpl['effect'.$i.'CreateItemId'];
for ($i = 1; $i <= 8; $i++)
if ($this->curTpl['reagent'.$i] > 0)
$foo[] = (int)$this->curTpl['reagent'.$i];
if ($_curTpl['reagent'.$i] > 0)
$foo[] = (int)$_curTpl['reagent'.$i];
for ($i = 1; $i <= 2; $i++)
if ($this->curTpl['tool'.$i] > 0)
$foo[] = (int)$this->curTpl['tool'.$i];
if ($_curTpl['tool'.$i] > 0)
$foo[] = (int)$_curTpl['tool'.$i];
// ranks
$this->ranks[$this->id] = Util::localizedString($this->curTpl, 'rank');
$this->ranks[$this->id] = $this->getField('rank', true);
// sources
if (!empty($this->curTpl['source']))
if (!empty($_curTpl['source']))
{
$sources = explode(' ', $this->curTpl['source']);
$sources = explode(' ', $_curTpl['source']);
foreach ($sources as $src)
{
$src = explode(':', $src);
@@ -76,34 +75,39 @@ class SpellList extends BaseType
}
}
// set full masks to 0
$_curTpl['reqClassMask'] &= CLASS_MASK_ALL;
if ($_curTpl['reqClassMask'] == CLASS_MASK_ALL)
$_curTpl['reqClassMask'] = 0;
$_curTpl['reqRaceMask'] &= RACE_MASK_ALL;
if ($_curTpl['reqRaceMask'] == RACE_MASK_ALL)
$_curTpl['reqRaceMask'] = 0;
// unpack skillLines
$this->curTpl['skillLines'] = [];
if ($this->curTpl['skillLine1'] < 0)
$_curTpl['skillLines'] = [];
if ($_curTpl['skillLine1'] < 0)
{
foreach (Util::$skillLineMask[$this->curTpl['skillLine1']] as $idx => $pair)
if ($this->curTpl['skillLine2OrMask'] & (1 << $idx))
$this->curTpl['skillLines'][] = $pair[1];
foreach (Util::$skillLineMask[$_curTpl['skillLine1']] as $idx => $pair)
if ($_curTpl['skillLine2OrMask'] & (1 << $idx))
$_curTpl['skillLines'][] = $pair[1];
}
else if ($sec = $this->curTpl['skillLine2OrMask'])
else if ($sec = $_curTpl['skillLine2OrMask'])
{
if ($this->id == 818) // and another hack .. basic Campfire (818) has deprecated skill Survival (142) as first skillLine
$this->curTpl['skillLines'] = [$sec, $this->curTpl['skillLine1']];
$_curTpl['skillLines'] = [$sec, $_curTpl['skillLine1']];
else
$this->curTpl['skillLines'] = [$this->curTpl['skillLine1'], $sec];
$_curTpl['skillLines'] = [$_curTpl['skillLine1'], $sec];
}
else if ($prim = $this->curTpl['skillLine1'])
$this->curTpl['skillLines'] = [$prim];
unset($this->curTpl['skillLine1']);
unset($this->curTpl['skillLine2OrMask']);
$this->templates[$this->id] = $this->curTpl;
else if ($prim = $_curTpl['skillLine1'])
$_curTpl['skillLines'] = [$prim];
unset($_curTpl['skillLine1']);
unset($_curTpl['skillLine2OrMask']);
}
if ($foo)
$this->relItems = new ItemList(array(['i.entry', array_unique($foo)], 0));
$this->reset(); // restore 'iterator'
}
// use if you JUST need the name
@@ -119,7 +123,7 @@ class SpellList extends BaseType
{
$data = [];
while ($this->iterate())
foreach ($this->iterate() as $__)
{
$stats = [];
@@ -199,7 +203,6 @@ class SpellList extends BaseType
case 135: // healing splpwr (healing & any) .. not as a mask..
{
@$stats[ITEM_MOD_SPELL_HEALING_DONE] += $bp;
break;
}
case 35: // ModPower - MiscVal:type see defined Powers only energy/mana in use
@@ -310,16 +313,21 @@ class SpellList extends BaseType
for ($i = 1; $i <= 2; $i++)
{
// Tools
if ($_ = $this->curTpl['tool'.$i])
if (!$this->curTpl['tool'.$i])
continue;
foreach ($this->relItems->iterate() as $relId => $__)
{
while ($this->relItems->id != $_)
$this->relItems->iterate();
if ($relId != $this->curTpl['tool'.$i])
continue;
$tools[$i-1] = array(
'itemId' => $_,
'itemId' => $relId,
'name' => $this->relItems->getField('name', true),
'quality' => $this->relItems->getField('quality')
);
break;
}
// TotemCategory
@@ -1017,9 +1025,9 @@ class SpellList extends BaseType
$this->charLevel = $level;
// step 0: get text
$data = Util::localizedString($this->curTpl, $type);
$data = $this->getField($type, true);
if (empty($data) || $data == "[]") // empty tooltip shouldn't be displayed anyway
return array();
return array("", []);
// step 1: if the text is supplemented with text-variables, get and replace them
if (empty($this->spellVars[$this->id]) && $this->curTpl['spellDescriptionVariableId'] > 0)
@@ -1237,7 +1245,7 @@ Lasts 5 min. $?$gte($pl,68)[][Cannot be used on items level 138 and higher.]
return $this->buffs[$this->id];
// doesn't have a buff
if (!Util::localizedString($this->curTpl, 'buff'))
if (!$this->getField('buff', true))
return array();
$this->interactive = $interactive;
@@ -1245,7 +1253,7 @@ Lasts 5 min. $?$gte($pl,68)[][Cannot be used on items level 138 and higher.]
$x = '<table><tr>';
// spellName
$x .= '<td><b class="q">'.Util::localizedString($this->curTpl, 'name').'</b></td>';
$x .= '<td><b class="q">'.$this->getField('name', true).'</b></td>';
// dispelType (if applicable)
if ($dispel = Lang::$game['dt'][$this->curTpl['dispelType']])
@@ -1415,13 +1423,13 @@ Lasts 5 min. $?$gte($pl,68)[][Cannot be used on items level 138 and higher.]
if ($reqItems)
$xTmp[] = Lang::$game['requires2'].' '.$reqItems;
if ($desc)
if ($desc[0])
$xTmp[] = '<span class="q">'.$desc[0].'</span>';
if ($createItem)
$xTmp[] = '<br />'.$createItem;
$xTmp[] = $createItem;
if ($tools || $reagents || $reqItems || $desc || $createItem)
if ($xTmp)
$x .= '<table><tr><td>'.implode('<br />', $xTmp).'</td></tr></table>';
$this->tooltips[$this->id] = array($x, $desc ? $desc[1] : null);
@@ -1487,7 +1495,7 @@ Lasts 5 min. $?$gte($pl,68)[][Cannot be used on items level 138 and higher.]
public function getListviewData()
{
$data = [];
while ($this->iterate())
foreach ($this->iterate() as $__)
{
$quality = ($this->curTpl['cuFlags'] & SPELL_CU_QUALITY_MASK) >> 8;
$talent = $this->curTpl['cuFlags'] & (SPELL_CU_TALENT | SPELL_CU_TALENTSPELL) && $this->curTpl['spellLevel'] <= 1;
@@ -1549,22 +1557,14 @@ Lasts 5 min. $?$gte($pl,68)[][Cannot be used on items level 138 and higher.]
if ($this->curTpl['typeCat'] == -13)
$data[$this->id]['glyphtype'] = $this->curTpl['cuFlags'] & SPELL_CU_GLYPH_MAJOR ? 1 : 2;
if ($r = Util::localizedString($this->curTpl, 'rank'))
if ($r = $this->getField('rank', true))
$data[$this->id]['rank'] = $r;
if (!empty($this->curTpl['reqClassMask']))
{
$mask = $this->curTpl['reqClassMask'] & CLASS_MASK_ALL;
if ($mask && $mask != CLASS_MASK_ALL)
$data[$this->id]['reqclass'] = $mask;
}
if ($mask = $this->curTpl['reqClassMask'])
$data[$this->id]['reqclass'] = $mask;
if (!empty($this->curTpl['reqRaceMask']))
{
$mask = $this->curTpl['reqRaceMask'] & RACE_MASK_ALL;
if ($mask && $mask != RACE_MASK_ALL)
$data[$this->id]['reqrace'] = $mask;
}
if ($mask = $this->curTpl['reqRaceMask'])
$data[$this->id]['reqrace'] = $mask;
}
return $data;
@@ -1644,12 +1644,9 @@ Lasts 5 min. $?$gte($pl,68)[][Cannot be used on items level 138 and higher.]
public function addGlobalsToJScript(&$template, $addMask = GLOBALINFO_ANY)
{
if ($this->relItems && ($addMask & GLOBALINFO_RELATED))
{
$this->relItems->reset();
$this->relItems->addGlobalsToJscript($template);
}
while ($this->iterate())
foreach ($this->iterate() as $__)
{
if ($addMask & GLOBALINFO_RELATED)
{
@@ -1675,7 +1672,6 @@ Lasts 5 min. $?$gte($pl,68)[][Cannot be used on items level 138 and higher.]
}
}
}
}
?>

View File

@@ -12,14 +12,13 @@ class TitleList extends BaseType
public $sources = [];
protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_titles WHERE [cond] ORDER BY Id ASC';
protected $matchQuery = 'SELECT COUNT(1) FROM ?_titles WHERE [cond]';
public function __construct($data)
{
parent::__construct($data);
// post processing
while ($this->iterate())
foreach ($this->iterate() as $__)
{
// preparse sources
if (!empty($this->curTpl['source']))
@@ -32,7 +31,6 @@ class TitleList extends BaseType
}
}
}
$this->reset(); // push first element back for instant use
}
public function getListviewData()
@@ -40,7 +38,7 @@ class TitleList extends BaseType
$data = [];
$this->createSource();
while ($this->iterate())
foreach ($this->iterate() as $__)
{
$data[$this->id] = array(
'id' => $this->id,
@@ -56,7 +54,7 @@ class TitleList extends BaseType
}
if ($_ = $this->getField('female', true))
$data['namefemale'] = $_;
$data[$this->id]['namefemale'] = $_;
return $data;
}
@@ -65,7 +63,7 @@ class TitleList extends BaseType
{
$data = [];
while ($this->iterate())
foreach ($this->iterate() as $__)
{
$data[$this->id]['name'] = Util::jsEscape($this->getField('male', true));
@@ -84,7 +82,7 @@ class TitleList extends BaseType
13 => [] // simple text
);
while ($this->iterate())
foreach ($this->iterate() as $__)
{
if (empty($this->sources[$this->id]))
continue;

View File

@@ -8,7 +8,6 @@ class WorldEventList extends BaseType
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]';
public function __construct($data)
{
@@ -18,7 +17,7 @@ class WorldEventList extends BaseType
$replace = [];
// post processing
while ($this->iterate())
foreach ($this->iterate() as $__)
{
// emulate category
$sT = $this->curTpl['scheduleType'];
@@ -58,7 +57,6 @@ class WorldEventList extends BaseType
unset($this->templates[$old]);
$this->templates[$data['id']] = $data;
}
$this->reset();
}
public static function getName($id)
@@ -117,7 +115,7 @@ class WorldEventList extends BaseType
{
$data = [];
while ($this->iterate())
foreach ($this->iterate() as $__)
{
$data[$this->id] = array(
'category' => $this->curTpl['category'],
@@ -134,7 +132,7 @@ class WorldEventList extends BaseType
public function addGlobalsToJScript(&$template, $addMask = 0)
{
while ($this->iterate())
foreach ($this->iterate() as $__)
{
$template->extendGlobalData(self::$type, [$this->id => array(
'name' => $this->getField('name', true),

View File

@@ -14,28 +14,6 @@ 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]';
// public function __construct($data)
// {
// parent::__construct($data);
// // post processing
// while ($this->iterate())
// {
// // preparse sources
// if (!empty($this->curTpl['source']))
// {
// $sources = explode(' ', $this->curTpl['source']);
// foreach ($sources as $src)
// {
// $src = explode(':', $src);
// $this->sources[$this->id][$src[0]][] = $src[1];
// }
// }
// }
// $this->reset(); // push first element back for instant use
// }
public function getListviewData()
{
@@ -117,7 +95,7 @@ visibleCols: ['heroiclevel', 'players']
"minlevel":80, // lfgDungeons.levelMax
"name":"Abyssal Maw: Throne of the Tides", // areaTable.name_X
*/
while ($this->iterate())
foreach ($this->iterate() as $__)
{
$data[$this->id] = array(
'id' => $this->id,
@@ -152,7 +130,7 @@ visibleCols: ['heroiclevel', 'players']
public function addGlobalsToJscript(&$template, $addMask = 0)
{
while ($this->iterate())
foreach ($this->iterate() as $__)
$template->extendGlobalData(self::$type, [$this->id => ['name' => Util::jsEscape($this->getField('name', true))]]);
}

View File

@@ -14,7 +14,6 @@ abstract class BaseType
protected $matches = null; // total matches unaffected by sqlLimit in config
protected $setupQuery = '';
protected $matchQuery = '';
/*
* condition as array [expression, value, operator]
@@ -56,7 +55,7 @@ abstract class BaseType
$limit = ' LIMIT '.$AoWoWconf['sqlLimit'];
$className = get_class($this);
if (!$this->setupQuery || !$this->matchQuery)
if (!$this->setupQuery)
return;
// may be called without filtering
@@ -155,48 +154,53 @@ abstract class BaseType
}
foreach ($conditions as $c)
if ($x = $resolveCondition($c, $linking))
$sql[] = $x;
if ($c)
if ($x = $resolveCondition($c, $linking))
$sql[] = $x;
// todo: add strings propperly without them being escaped by simpleDB..?
$this->setupQuery = str_replace('[filter]', $this->filter && $this->filter->buildQuery() ? $this->filter->getQuery().' AND ' : NULL, $this->setupQuery);
$this->setupQuery = str_replace('[cond]', empty($sql) ? '1' : '('.implode($linking, $sql).')', $this->setupQuery);
$this->setupQuery .= $limit;
$this->matchQuery = str_replace('[filter]', $this->filter && $this->filter->buildQuery() ? $this->filter->getQuery().' AND ' : NULL, $this->matchQuery);
$this->matchQuery = str_replace('[cond]', empty($sql) ? '1' : '('.implode($linking, $sql).')', $this->matchQuery);
$rows = DB::Aowow()->Select($this->setupQuery);
$rows = DB::Aowow()->SelectPage($cnt, $this->setupQuery);
if (!$rows)
return;
$this->matches = $cnt;
foreach ($rows as $k => $tpl)
$this->templates[$k] = $tpl;
$this->curTpl = reset($this->templates);
$this->id = key($this->templates);
$this->error = false;
}
public function &iterate()
{
// reset on __construct
$this->reset();
$this->error = false;
while (list($id, $tpl) = each($this->templates))
{
$this->id = $id;
$this->curTpl = &$this->templates[$id]; // do not use $tpl as we want to be referenceable
yield $id => $this->curTpl;
unset($this->curTpl); // kill reference or it will 'bleed' into the next iteration
}
// reset on __destruct .. Generator, Y U NO HAVE __destruct ?!
$this->reset();
}
public function iterate($qty = 1)
{
if (!$this->curTpl) // exceeded end of line .. array .. in last iteration
reset($this->templates);
$this->curTpl = current($this->templates);
$field = $this->curTpl ? Util::getIdFieldName($this->curTpl) : null;
$this->id = $this->curTpl ? (int)$this->curTpl[$field] : 0;
while ($qty--)
next($this->templates);
return $this->id;
}
public function reset()
protected function reset()
{
unset($this->curTpl); // kill reference or it will 'bleed' into the next iteration
$this->curTpl = reset($this->templates);
$this->id = (int)$this->curTpl[Util::getIdFieldName($this->curTpl)];
$this->id = key($this->templates);
}
// read-access to templates
@@ -212,11 +216,13 @@ abstract class BaseType
return is_numeric($value) ? floatVal($value) : $value;
}
public function getFoundIDs()
{
return array_keys($this->templates);
}
public function getMatches()
{
if ($this->matches === null)
$this->matches = DB::Aowow()->SelectCell($this->matchQuery);
return $this->matches;
}
@@ -264,9 +270,7 @@ trait listviewHelper
$result = 0x0;
$this->reset();
while ($this->iterate())
foreach ($this->iterate() as $__)
{
foreach ($fields as $k => $str)
{
@@ -278,7 +282,10 @@ trait listviewHelper
}
if (empty($fields)) // all set .. return early
{
$this->reset(); // Generators have no __destruct, reset manually, when not doing a full iteration
return $result;
}
}
return $result;
@@ -292,11 +299,10 @@ trait listviewHelper
$base = [];
$result = 0x0;
$this->reset();
foreach ($fields as $k => $str)
$base[$str] = $this->getField($str);
while ($this->iterate())
foreach ($this->iterate() as $__)
{
foreach ($fields as $k => $str)
{
@@ -308,7 +314,10 @@ trait listviewHelper
}
if (empty($fields)) // all fields diff .. return early
{
$this->reset(); // Generators have no __destruct, reset manually, when not doing a full iteration
return $result;
}
}
return $result;
@@ -706,12 +715,12 @@ class SmartyAoWoW extends Smarty
unset($ann[$k]);
}
$this->_tpl_vars['announcements'] = $ann;
$tv['announcements'] = $ann;
}
$this->applyGlobals();
$this->_tpl_vars['mysql'] = DB::Aowow()->getStatistics();
$tv['mysql'] = DB::Aowow()->getStatistics();
parent::display($tpl);
}
@@ -944,6 +953,38 @@ class Util
)
);
public static $trainerTemplates = array( // TYPE => Id => templateList
TYPE_CLASS => array(
1 => [-200001, -200002], // Warrior
2 => [-200003, -200004, -200020, -200021], // Paladin
3 => [-200013, -200014], // Hunter
4 => [-200015, -200016], // Rogue
5 => [-200011, -200012], // Priest
6 => [-200019], // DK
7 => [-200017, -200018], // Shaman (HighlevelAlly Id missing..?)
8 => [-200007, -200008], // Mage
9 => [-200009, -200010], // Warlock
11 => [-200005, -200006] // Druid
),
TYPE_SKILL => array(
171 => [-201001, -201002, -201003], // Alchemy
164 => [-201004, -201005, -201006, -201007, -201008],// Blacksmithing
333 => [-201009, -201010, -201011], // Enchanting
202 => [-201012, -201013, -201014, -201015, -201016, -201017], // Engineering
182 => [-201018, -201019, -201020], // Herbalism
773 => [-201021, -201022, -201023], // Inscription
755 => [-201024, -201025, -201026], // Jewelcrafting
165 => [-201027, -201028, -201029, -201030, -201031, -201032], // Leatherworking
186 => [-201033, -201034, -201035], // Mining
393 => [-201036, -201037, -201038], // Skinning
197 => [-201039, -201040, -201041, -201042], // Tailoring
356 => [-202001, -202002, -202003], // Fishing
185 => [-202004, -202005, -202006], // Cooking
129 => [-202007, -202008, -202009], // First Aid
129 => [-202010, -202011, -202012] // Riding
)
);
public static $sockets = array( // jsStyle Strings
'meta', 'red', 'yellow', 'blue'
);
@@ -986,8 +1027,9 @@ class Util
public static $changeLevelString = '<a href="javascript:;" onmousedown="return false" class="tip" style="color: white; cursor: pointer" onclick="$WH.g_staticTooltipLevelClick(this, null, 0)" onmouseover="$WH.Tooltip.showAtCursor(event, \'<span class=\\\'q2\\\'>\' + LANG.tooltip_changelevel + \'</span>\')" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()"><!--lvl-->%s</a>';
public static $setRatingLevelString = '<a href="javascript:;" onmousedown="return false" class="tip" style="color: white; cursor: pointer" onclick="$WH.g_setRatingLevel(this, %s, %s, %s)" onmouseover="$WH.Tooltip.showAtCursor(event, \'<span class=\\\'q2\\\'>\' + LANG.tooltip_changelevel + \'</span>\')" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()">%s</a>';
public static $filterResultString = '$WH.sprintf(%s, %s, %s) + LANG.dash + LANG.lvnote_tryfiltering.replace(\'<a>\', \'<a href="javascript:;" onclick="fi_toggle()">\')';
public static $narrowResultString = '$WH.sprintf(%s, %s, %s) + LANG.dash + LANG.lvnote_trynarrowing';
public static $filterResultString = '$$WH.sprintf(LANG.lvnote_filterresults, \'%s\')';
public static $tryFilteringString = '$$WH.sprintf(%s, %s, %s) + LANG.dash + LANG.lvnote_tryfiltering.replace(\'<a>\', \'<a href="javascript:;" onclick="fi_toggle()">\')';
public static $tryNarrowingString = '$$WH.sprintf(%s, %s, %s) + LANG.dash + LANG.lvnote_trynarrowing';
public static $setCriteriaString = "fi_setCriteria(%s, %s, %s);\n";
public static $dfnString = '<dfn title="%s" class="w">%s</dfn>';
@@ -1995,22 +2037,6 @@ class Util
return mb_strtoupper($first, 'UTF-8') . $rest;
}
// BaseType::_construct craaap!
// todo: unify indizes
public static function getIdFieldName($tpl)
{
if (isset($tpl['entry']))
return 'entry';
else if (isset($tpl['Id']))
return 'Id';
else if (isset($tpl['id']))
return 'id';
else if (isset($tpl['ID']))
return 'ID';
else
return null;
}
}
?>

View File

@@ -77,7 +77,6 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$acv->addGlobalsToJscript($smarty, GLOBALINFO_REWARDS);
$pageData['page'] = $acv->getDetailedData()[$id];
$acv->reset();
// infobox content
switch ($acv->getField('faction'))
@@ -92,7 +91,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$pageData['infoBox'][] = Lang::$main['side'].': '.Lang::$game['si'][SIDE_BOTH];
}
// todo: crosslink with charactersDB to check if realmFirsts are still available
// todo (low): crosslink with charactersDB to check if realmFirsts are still available
$pageData['infoBox'] = array_merge($pageData['infoBox'], Lang::getInfoBoxForFlags($acv->getField('cuFlags')));
@@ -138,7 +137,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
if ($foo = $acv->getField('rewards')[TYPE_ITEM])
{
$bar = new ItemList(array(['i.entry', $foo]));
while ($bar->iterate())
foreach ($bar->iterate() as $__)
{
$pageData['page']['itemReward'][$bar->id] = array(
'name' => $bar->getField('name', true),
@@ -150,7 +149,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
if ($foo = $acv->getField('rewards')[TYPE_TITLE])
{
$bar = new TitleList(array(['id', $foo]));
while ($bar->iterate())
foreach ($bar->iterate() as $__)
$pageData['page']['titleReward'][] = sprintf(Lang::$achievement['titleReward'], $bar->id, trim(str_replace('%s', '', $bar->getField('male', true))));
}

View File

@@ -91,7 +91,7 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter))
// create note if search limit was exceeded
if ($acvList->getMatches() > $AoWoWconf['sqlLimit'])
{
$pageData['params']['note'] = '$'.sprintf(Util::$filterResultString, 'LANG.lvnote_achievementsfound', $acvList->getMatches(), $AoWoWconf['sqlLimit']);
$pageData['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_achievementsfound', $acvList->getMatches(), $AoWoWconf['sqlLimit']);
$pageData['params']['_truncated'] = 1;
}

View File

@@ -37,17 +37,18 @@ if ($compareString)
$iList = new ItemList(array(['i.entry', $items]));
$data = $iList->getListviewData(ITEMINFO_SUBITEMS | ITEMINFO_JSON);
foreach ($data as $id => $item)
foreach ($iList->iterate() as $itemId => $__)
{
while ($iList->id != $id)
$iList->iterate();
if (empty($data[$itemId]))
continue;
$pageData['items'][] = [
$id,
$itemId,
Util::jsEscape($iList->getField('name', true)),
$iList->getField('Quality'),
$iList->getField('icon'),
json_encode($item, JSON_NUMERIC_CHECK)
json_encode($data[$itemId], JSON_NUMERIC_CHECK)
];
}
}

View File

@@ -43,7 +43,7 @@ if (!$smarty->loadCache($cacheKey, $pageData))
$events = new WorldEventList($condition);
$deps = [];
while ($events->iterate())
foreach ($events->iterate() as $__)
if ($d = $events->getField('requires'))
$deps[$events->id] = $d;

View File

@@ -17,8 +17,6 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
if ($iSet->error)
$smarty->notFound(Lang::$game['itemset']);
$iSet->reset();
$ta = $iSet->getField('contentGroup');
$ty = $iSet->getField('type');
$ev = $iSet->getField('holidayId');
@@ -78,26 +76,26 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$pieces = [];
$eqList = [];
$compare = [];
$iList = new ItemList(array(['i.entry', array_keys($iSet->pieceToSet)]));
$data = $iList->getListviewData(ITEMINFO_SUBITEMS | ITEMINFO_JSON);
foreach ($data as $iId => $item)
$iList = new ItemList(array(['i.entry', array_keys($iSet->pieceToSet)]));
$data = $iList->getListviewData(ITEMINFO_SUBITEMS | ITEMINFO_JSON);
foreach ($iList->iterate() as $itemId => $__)
{
while ($iList->id != $iId)
$iList->iterate();
if (empty($data[$itemId]))
continue;
$slot = $iList->getField('InventoryType');
$disp = $iList->getField('displayid');
if ($slot && $disp)
$eqList[] = [$slot, $disp];
$compare[] = $iId;
$compare[] = $itemId;
$pieces[] = array(
'id' => $iId,
'id' => $itemId,
'name' => $iList->getField('name', true),
'quality' => $iList->getField('Quality'),
'icon' => $iList->getField('icon'),
'json' => json_encode($item, JSON_NUMERIC_CHECK)
'json' => json_encode($data[$itemId], JSON_NUMERIC_CHECK)
);
}
@@ -129,12 +127,15 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
});
$setSpells = new SpellList(array(['s.id', $foo]));
foreach ($spells as &$s)
foreach ($setSpells->iterate() as $spellId => $__)
{
while ($setSpells->id != $s['id'])
$setSpells->iterate();
foreach ($spells as &$s)
{
if ($spellId != $s['id'])
continue;
$s['desc'] = $setSpells->parseText('description')[0];
$s['desc'] = $setSpells->parseText('description')[0];
}
}
// path

View File

@@ -33,7 +33,7 @@ if (!$smarty->loadCache($cacheKey, $pageData))
// create note if search limit was exceeded
if ($itemsets->getMatches() > $AoWoWconf['sqlLimit'])
{
$pageData['params']['note'] = '$'.sprintf(Util::$filterResultString, 'LANG.lvnote_itemsetsfound', $itemsets->getMatches(), $AoWoWconf['sqlLimit']);
$pageData['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_itemsetsfound', $itemsets->getMatches(), $AoWoWconf['sqlLimit']);
$pageData['params']['_truncated'] = 1;
}

View File

@@ -16,9 +16,6 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
if ($pet->error)
$smarty->notFound(Lang::$game['pet']);
// $pet->addGlobalsToJscript($smarty);
$pet->reset();
$infobox = [];
// level range
@@ -61,7 +58,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
'tabs' => '$tabsRelated',
'hiddenCols' => "$['type']",
'visibleCols' => "$['skin']",
'note' => '$sprintf(LANG.lvnote_filterresults, \'?npcs=1&filter=fa=38\')',
'note' => sprintf(Util::$filterResultString, '?npcs=1&filter=fa=38'),
'id' => 'tameable'
]
);
@@ -122,7 +119,6 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
]
];
$spells = new SpellList($conditions);
$spells->addGlobalsToJscript($smarty, GLOBALINFO_SELF);
@@ -137,7 +133,15 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
);
// talents
$conditions = [['s.typeCat', -7]];
$conditions = array(
['s.typeCat', -7],
[ // last rank or unranked
'OR',
['s.cuFlags', SPELL_CU_LAST_RANK, '&'],
['s.rankId', 0]
]
);
switch($pet->getField('type'))
{
case 0: $conditions[] = ['s.cuFlags', SPELL_CU_PET_TALENT_TYPE0, '&']; break;

View File

@@ -33,7 +33,6 @@ if (!$smarty->loadCache($cacheKey, $pageData))
if (($mask = $pets->hasDiffFields(['type'])) == 0x0)
$pageData['params']['hiddenCols'] = "$['type']";
$pets->reset();
$pets->addGlobalsToJscript($smarty, GLOBALINFO_RELATED);
$smarty->saveCache($cacheKey, $pageData);

View File

@@ -219,26 +219,27 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$_ = $pageData['page']['reagents'];
$pageData['page']['reagents'] = [];
while (!empty($_))
foreach ($spell->relItems->iterate() as $itemId => $__)
{
$spell->relItems->iterate();
if (!in_array($spell->relItems->id, array_keys($_)))
if (empty($_[$itemId]))
continue;
$pageData['page']['reagents'][] = array(
'name' => $spell->relItems->getField('name', true),
'quality' => $spell->relItems->getField('Quality'),
'entry' => $spell->relItems->id,
'count' => $_[$spell->relItems->id],
'entry' => $itemId,
'count' => $_[$itemId],
);
unset($_[$spell->relItems->id]);
unset($_[$itemId]);
if (empty($_))
break;
}
}
// Iterate through all effects:
$pageData['page']['effect'] = [];
$spell->reset();
$pageData['view3D'] = 0;
@@ -259,16 +260,19 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
// .. from item
if ($spell->canCreateItem() && ($_ = $spell->getField('effect'.$i.'CreateItemId')) && $_ > 0)
{
while ($spell->relItems->id != $_)
$spell->relItems->iterate();
foreach ($spell->relItems->iterate() as $itemId => $__)
{
if ($itemId != $_)
continue;
$foo['icon'] = array(
'id' => $spell->relItems->id,
'name' => $spell->relItems->getField('name', true),
'quality' => $spell->relItems->getField('Quality'),
'count' => $effDS + $effBP,
'icon' => $spell->relItems->getField('icon')
);
$foo['icon'] = array(
'id' => $spell->relItems->id,
'name' => $spell->relItems->getField('name', true),
'quality' => $spell->relItems->getField('Quality'),
'count' => $effDS + $effBP,
'icon' => $spell->relItems->getField('icon')
);
}
if ($effDS > 1)
$foo['icon']['count'] = "'".($effBP + 1).'-'.$foo['icon']['count']."'";
@@ -332,6 +336,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
break;
case 53: // Enchant Item Perm
case 54: // Enchant Item Temp
case 156: // Enchant Item Prismatic
$_ = DB::Aowow()->selectRow('SELECT * FROM ?_itemEnchantment WHERE id = ?d', $effMV);
$foo['name'] .= ' <span class="q2">'.Util::localizedString($_, 'text').'</span> ('.$effMV.')';
break;
@@ -585,7 +590,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
for ($i = 1; $i < 4; $i++)
{
// Flat Mods (107), Pct Mods (108), No Reagent Use .. include dummy..? (4)
// Flat Mods (107), Pct Mods (108), No Reagent Use (256) .. include dummy..? (4)
if (!in_array($spell->getField('effect'.$i.'AuraId'), [107, 108, 256, 4]))
continue;
@@ -626,8 +631,8 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$sub = ['OR'];
$conditions = [
['s.spellFamilyId', $spell->getField('spellFamilyId')],
&$sub]
;
&$sub
];
for ($i = 1; $i < 4; $i++)
{
@@ -808,7 +813,6 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
if ($extraItem && $spell->canCreateItem())
{
$spell->relItems->reset();
$foo = $spell->relItems->getListviewData();
for ($i = 1; $i < 4; $i++)
@@ -924,12 +928,6 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
}
*/
// Проверяем на пустые массивы
// if(!$spellArr['taughtbyitem'])
// unset($spellArr['taughtbyitem']);
// if(!$spellArr['taughtbynpc'])
// unset($spellArr['taughtbynpc']);
$smarty->saveCache($cacheKeyPage, $pageData);
}

View File

@@ -381,12 +381,12 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter))
$pageData['data'] = $spells->getListviewData();
$spells->addGlobalsToJscript($smarty, GLOBALINFO_SELF);
$spells->addGlobalsToJscript($smarty);
// create note if search limit was exceeded; overwriting 'note' is intentional
if ($spells->getMatches() > $AoWoWconf['sqlLimit'])
{
$pageData['params']['note'] = '$'.sprintf(Util::$filterResultString, 'LANG.lvnote_spellsfound', $spells->getMatches(), $AoWoWconf['sqlLimit']);
$pageData['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_spellsfound', $spells->getMatches(), $AoWoWconf['sqlLimit']);
$pageData['params']['_truncated'] = 1;
}

View File

@@ -119,7 +119,7 @@ if ($searchMask & 0x1)
if ($data = $classes->getListviewData())
{
while ($classes->iterate())
foreach ($classes->iterate() as $__)
$data[$classes->id]['param1'] = '"class_'.strToLower($classes->getField('fileString')).'"';
$found['class'] = array(
@@ -133,7 +133,7 @@ if ($searchMask & 0x1)
if ($classes->getMatches() > $maxResults)
{
// $found['class']['params']['note'] = '$'.sprintf(Util::$narrowResultString, 'LANG.lvnote_', $classes->getMatches(), $maxResults);
// $found['class']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_', $classes->getMatches(), $maxResults);
$found['class']['params']['_truncated'] = 1;
}
}
@@ -152,7 +152,7 @@ if ($searchMask & 0x2)
if ($data = $races->getListviewData())
{
while ($races->iterate())
foreach ($races->iterate() as $__)
$data[$races->id]['param1'] = '"race_'.strToLower($races->getField('fileString')).'_male"';
$found['race'] = array(
@@ -166,7 +166,7 @@ if ($searchMask & 0x2)
if ($races->getMatches() > $maxResults)
{
// $found['race']['params']['note'] = '$'.sprintf(Util::$narrowResultString, 'LANG.lvnote_', $races->getMatches(), $maxResults);
// $found['race']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_', $races->getMatches(), $maxResults);
$found['race']['params']['_truncated'] = 1;
}
}
@@ -211,7 +211,7 @@ if ($searchMask & 0x4)
if ($titles->getMatches() > $maxResults)
{
// $found['title']['params']['note'] = '$'.sprintf(Util::$narrowResultString, 'LANG.lvnote_', $titles->getMatches(), $maxResults);
// $found['title']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_', $titles->getMatches(), $maxResults);
$found['title']['params']['_truncated'] = 1;
}
}
@@ -255,7 +255,7 @@ if ($searchMask & 0x8)
if ($wEvents->getMatches() > $maxResults)
{
// $found['event']['params']['note'] = '$'.sprintf(Util::$narrowResultString, 'LANG.lvnote_', $wEvents->getMatches(), $maxResults);
// $found['event']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_', $wEvents->getMatches(), $maxResults);
$found['event']['params']['_truncated'] = 1;
}
}
@@ -268,7 +268,7 @@ if ($searchMask & 0x10)
if ($data = $money->getListviewData())
{
while ($money->iterate())
foreach ($money->iterate() as $__)
$data[$money->id]['param1'] = '"'.strToLower($money->getField('iconString')).'"';
$found['currency'] = array(
@@ -282,7 +282,7 @@ if ($searchMask & 0x10)
if ($money->getMatches() > $maxResults)
{
$found['currency']['params']['note'] = '$'.sprintf(Util::$narrowResultString, 'LANG.lvnote_currenciesfound', $money->getMatches(), $maxResults);
$found['currency']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_currenciesfound', $money->getMatches(), $maxResults);
$found['currency']['params']['_truncated'] = 1;
}
}
@@ -303,7 +303,7 @@ if ($searchMask & 0x20)
{
$sets->addGlobalsToJscript($smarty, GLOBALINFO_SELF);
while ($sets->iterate())
foreach ($sets->iterate() as $__)
$data[$sets->id]['param1'] = $sets->getField('quality');
$found['itemset'] = array(
@@ -318,7 +318,7 @@ if ($searchMask & 0x20)
if ($sets->getMatches() > $maxResults)
{
$found['itemset']['params']['note'] = '$'.sprintf(Util::$narrowResultString, 'LANG.lvnote_itemsetsfound', $sets->getMatches(), $maxResults);
$found['itemset']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_itemsetsfound', $sets->getMatches(), $maxResults);
$found['itemset']['params']['_truncated'] = 1;
}
}
@@ -348,7 +348,7 @@ if ($searchMask & 0x40)
{
$items->addGlobalsToJscript($smarty);
while ($items->iterate())
foreach ($items->iterate() as $__)
{
$data[$items->id]['param1'] = '"'.$items->getField('icon').'"';
$data[$items->id]['param2'] = $items->getField('Quality');
@@ -368,7 +368,7 @@ if ($searchMask & 0x40)
if ($items->getMatches() > $maxResults)
{
$found['item']['params']['note'] = '$'.sprintf(Util::$narrowResultString, 'LANG.lvnote_itemsfound', $items->getMatches(), $maxResults);
$found['item']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_itemsfound', $items->getMatches(), $maxResults);
$found['item']['params']['_truncated'] = 1;
}
}
@@ -395,7 +395,7 @@ if ($searchMask & 0x80)
if ($abilities->hasSetFields(['reagent1']))
$vis[] = 'reagents';
while ($abilities->iterate())
foreach ($abilities->iterate() as $__)
{
$data[$abilities->id]['param1'] = '"'.strToLower($abilities->getField('iconString')).'"';
$data[$abilities->id]['param2'] = '"'.$abilities->ranks[$abilities->id].'"';
@@ -417,7 +417,7 @@ if ($searchMask & 0x80)
if ($abilities->getMatches() > $maxResults)
{
$found['ability']['params']['note'] = '$'.sprintf(Util::$narrowResultString, 'LANG.lvnote_abilitiesfound', $abilities->getMatches(), $maxResults);
$found['ability']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_abilitiesfound', $abilities->getMatches(), $maxResults);
$found['ability']['params']['_truncated'] = 1;
}
}
@@ -442,7 +442,7 @@ if ($searchMask & 0x100)
if ($abilities->hasSetFields(['reagent1']))
$vis[] = 'reagents';
while ($talents->iterate())
foreach ($talents->iterate() as $__)
{
$data[$talents->id]['param1'] = '"'.strToLower($talents->getField('iconString')).'"';
$data[$talents->id]['param2'] = '"'.$talents->ranks[$talents->id].'"';
@@ -464,7 +464,7 @@ if ($searchMask & 0x100)
if ($talents->getMatches() > $maxResults)
{
$found['talent']['params']['note'] = '$'.sprintf(Util::$narrowResultString, 'LANG.lvnote_talentsfound', $talents->getMatches(), $maxResults);
$found['talent']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_talentsfound', $talents->getMatches(), $maxResults);
$found['talent']['params']['_truncated'] = 1;
}
}
@@ -485,7 +485,7 @@ if ($searchMask & 0x200)
{
$glyphs->addGlobalsToJscript($smarty, GLOBALINFO_SELF);
while ($glyphs->iterate())
foreach ($glyphs->iterate() as $__)
$data[$glyphs->id]['param1'] = '"'.strToLower($glyphs->getField('iconString')).'"';
$found['glyph'] = array(
@@ -504,7 +504,7 @@ if ($searchMask & 0x200)
if ($glyphs->getMatches() > $maxResults)
{
$found['glyph']['params']['note'] = '$'.sprintf(Util::$narrowResultString, 'LANG.lvnote_glyphsfound', $glyphs->getMatches(), $maxResults);
$found['glyph']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_glyphsfound', $glyphs->getMatches(), $maxResults);
$found['glyph']['params']['_truncated'] = 1;
}
}
@@ -525,7 +525,7 @@ if ($searchMask & 0x400)
{
$prof->addGlobalsToJscript($smarty, GLOBALINFO_SELF);
while ($prof->iterate())
foreach ($prof->iterate() as $__)
$data[$prof->id]['param1'] = '"'.strToLower($prof->getField('iconString')).'"';
$found['proficiency'] = array(
@@ -544,7 +544,7 @@ if ($searchMask & 0x400)
if ($prof->getMatches() > $maxResults)
{
$found['proficiency']['params']['note'] = '$'.sprintf(Util::$narrowResultString, 'LANG.lvnote_spellsfound', $prof->getMatches(), $maxResults);
$found['proficiency']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_spellsfound', $prof->getMatches(), $maxResults);
$found['proficiency']['params']['_truncated'] = 1;
}
}
@@ -565,7 +565,7 @@ if ($searchMask & 0x800)
{
$prof->addGlobalsToJscript($smarty);
while ($prof->iterate())
foreach ($prof->iterate() as $__)
$data[$prof->id]['param1'] = '"'.strToLower($prof->getField('iconString')).'"';
$found['profession'] = array(
@@ -584,7 +584,7 @@ if ($searchMask & 0x800)
if ($prof->getMatches() > $maxResults)
{
$found['profession']['params']['note'] = '$'.sprintf(Util::$narrowResultString, 'LANG.lvnote_professionfound', $prof->getMatches(), $maxResults);
$found['profession']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_professionfound', $prof->getMatches(), $maxResults);
$found['profession']['params']['_truncated'] = 1;
}
}
@@ -606,7 +606,7 @@ if ($searchMask & 0x1000)
{
$vPets->addGlobalsToJscript($smarty);
while ($vPets->iterate())
foreach ($vPets->iterate() as $__)
$data[$vPets->id]['param1'] = '"'.strToLower($vPets->getField('iconString')).'"';
$found['companion'] = array(
@@ -625,7 +625,7 @@ if ($searchMask & 0x1000)
if ($vPets->getMatches() > $maxResults)
{
$found['companion']['params']['note'] = '$'.sprintf(Util::$narrowResultString, 'LANG.lvnote_companionsfound', $vPets->getMatches(), $maxResults);
$found['companion']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_companionsfound', $vPets->getMatches(), $maxResults);
$found['companion']['params']['_truncated'] = 1;
}
}
@@ -646,7 +646,7 @@ if ($searchMask & 0x2000)
{
$mounts->addGlobalsToJscript($smarty, GLOBALINFO_SELF);
while ($mounts->iterate())
foreach ($mounts->iterate() as $__)
$data[$mounts->id]['param1'] = '"'.strToLower($mounts->getField('iconString')).'"';
$found['mount'] = array(
@@ -664,7 +664,7 @@ if ($searchMask & 0x2000)
if ($mounts->getMatches() > $maxResults)
{
$found['mount']['params']['note'] = '$'.sprintf(Util::$narrowResultString, 'LANG.lvnote_mountsfound', $mounts->getMatches(), $maxResults);
$found['mount']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_mountsfound', $mounts->getMatches(), $maxResults);
$found['mount']['params']['_truncated'] = 1;
}
}
@@ -702,7 +702,7 @@ if ($searchMask & 0x4000)
if ($npcs->getMatches() > $maxResults)
{
$found['npc']['params']['note'] = '$'.sprintf(Util::$narrowResultString, 'LANG.lvnote_npcsfound', $npcs->getMatches(), $maxResults);
$found['npc']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_npcsfound', $npcs->getMatches(), $maxResults);
$found['npc']['params']['_truncated'] = 1;
}
}
@@ -735,7 +735,7 @@ if ($searchMask & 0x8000)
if ($quests->getMatches() > $maxResults)
{
$found['quest']['params']['note'] = '$'.sprintf(Util::$narrowResultString, 'LANG.lvnote_questsfound', $quests->getMatches(), $maxResults);
$found['quest']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_questsfound', $quests->getMatches(), $maxResults);
$found['quest']['params']['_truncated'] = 1;
}
}
@@ -755,7 +755,7 @@ if ($searchMask & 0x10000)
{
$acvs->addGlobalsToJScript($smarty);
while ($acvs->iterate())
foreach ($acvs->iterate() as $__)
$data[$acvs->id]['param1'] = '"'.strToLower($acvs->getField('iconString')).'"';
$found['achievement'] = array(
@@ -772,7 +772,7 @@ if ($searchMask & 0x10000)
if ($acvs->getMatches() > $maxResults)
{
$found['achievement']['params']['note'] = '$'.sprintf(Util::$narrowResultString, 'LANG.lvnote_achievementsfound', $acvs->getMatches(), $maxResults);
$found['achievement']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_achievementsfound', $acvs->getMatches(), $maxResults);
$found['achievement']['params']['_truncated'] = 1;
}
}
@@ -809,7 +809,7 @@ if ($searchMask & 0x20000)
if ($stats->getMatches() > $maxResults)
{
$found['statistic']['params']['note'] = '$'.sprintf(Util::$narrowResultString, 'LANG.lvnote_statisticsfound', $stats->getMatches(), $maxResults);
$found['statistic']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_statisticsfound', $stats->getMatches(), $maxResults);
$found['statistic']['params']['_truncated'] = 1;
}
}
@@ -834,7 +834,7 @@ if ($searchMask & 0x400000)
if ($data = $pets->getListviewData())
{
while ($pets->iterate())
foreach ($pets->iterate() as $__)
$data[$pets->id]['param1'] = '"'.$pets->getField('iconString').'"';
$found['pet'] = array(
@@ -848,7 +848,7 @@ if ($searchMask & 0x400000)
if ($pets->getMatches() > $maxResults)
{
$found['pet']['params']['note'] = '$'.sprintf(Util::$narrowResultString, 'LANG.lvnote_petsfound', $pets->getMatches(), $maxResults);
$found['pet']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_petsfound', $pets->getMatches(), $maxResults);
$found['pet']['params']['_truncated'] = 1;
}
}
@@ -869,7 +869,7 @@ if ($searchMask & 0x800000)
{
$npcAbilities->addGlobalsToJscript($smarty, GLOBALINFO_SELF);
while ($npcAbilities->iterate())
foreach ($npcAbilities->iterate() as $__)
$data[$npcAbilities->id]['param1'] = '"'.strToLower($npcAbilities->getField('iconString')).'"';
$found['npcSpell'] = array(
@@ -889,7 +889,7 @@ if ($searchMask & 0x800000)
if ($npcAbilities->getMatches() > $maxResults)
{
$found['npcSpell']['params']['note'] = '$'.sprintf(Util::$narrowResultString, 'LANG.lvnote_spellsfound', $npcAbilities->getMatches(), $maxResults);
$found['npcSpell']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_spellsfound', $npcAbilities->getMatches(), $maxResults);
$found['npcSpell']['params']['_truncated'] = 1;
}
}
@@ -910,7 +910,7 @@ if ($searchMask & 0x1000000)
{
$misc->addGlobalsToJscript($smarty, GLOBALINFO_SELF);
while ($misc->iterate())
foreach ($misc->iterate() as $__)
$data[$misc->id]['param1'] = '"'.strToLower($misc->getField('iconString')).'"';
$found['spell'] = array(
@@ -929,7 +929,7 @@ if ($searchMask & 0x1000000)
if ($misc->getMatches() > $maxResults)
{
$found['spell']['params']['note'] = '$'.sprintf(Util::$narrowResultString, 'LANG.lvnote_spellsfound', $misc->getMatches(), $maxResults);
$found['spell']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_spellsfound', $misc->getMatches(), $maxResults);
$found['spell']['params']['_truncated'] = 1;
}
}

View File

@@ -72,7 +72,7 @@ if (!defined('AOWOW_REVISION'))
$enchantsOut = [];
while ($enchantSpells->iterate())
foreach ($enchantSpells->iterate() as $__)
{
$enchant = DB::Aowow()->SelectRow('SELECT * FROM ?_itemEnchantment WHERE Id = ?d', $enchantSpells->getField('effect1MiscValue'));
if (!$enchant) // 'shouldn't' happen
@@ -145,7 +145,7 @@ if (!defined('AOWOW_REVISION'))
$castItems[$enchantSpells->id] = new ItemList([['spellid_1', $enchantSpells->id], ['name', 'Scroll of Enchant%', '!']]); // do not reuse enchantment scrolls
$cI = &$castItems[$enchantSpells->id]; // this construct is a bit .. unwieldy
while ($cI->iterate())
foreach ($cI->iterate() as $__)
{
$ench['name'][] = $cI->getField('name', true);
$ench['source'][] = -$cI->id;

View File

@@ -69,7 +69,7 @@ if (!defined('AOWOW_REVISION'))
User::useLocale($lId);
$glyphsOut = [];
while ($glyphSpells->iterate())
foreach ($glyphSpells->iterate() as $__)
{
$pop = $glyphList[$glyphSpells->id];

View File

@@ -29,7 +29,7 @@ class ItemSetup extends ItemList
public function writeStatsTable()
{
while ($this->iterate())
foreach ($this->iterate() as $__)
{
$this->extendJsonStats();
$updateFields = [];

View File

@@ -288,7 +288,7 @@ foreach ($locales as $loc)
$name[$loc] = '"'.Util::sqlEscape(Util::localizedString($set, 'name')).'"';
while ($bonusSpells->iterate())
foreach ($bonusSpells->iterate() as $__)
@$descText[$loc] .= $bonusSpells->parseText()[0]."\n";
$descText[$loc] = '"'.Util::sqlEscape($descText[$loc]).'"';

View File

@@ -56,7 +56,6 @@ UPDATE aowow_skillLine sl, dbc.spell s, dbc.skillLineAbility sla SET sl.spellIco
UPDATE aowow_skillLine sl, dbc.spellIcon si SET sl.iconString = SUBSTRING_INDEX(si.string, '\\', -1) WHERE sl.spellIconId = si.id;
UPDATE aowow_skillLine SET iconString = 'inv_misc_questionmark' WHERE spellIconId = 0;
-- categorization
UPDATE aowow_skillLine SET typeCat = -5 WHERE id = 777 OR (categoryId = 9 AND id NOT IN (356, 129, 185, 142, 155));
UPDATE aowow_skillLine SET typeCat = -4 WHERE categoryId = 9 AND name_loc0 LIKE '%racial%';

View File

@@ -12,7 +12,9 @@
<script type="text/javascript">
g_initPath({$page.path}, {if empty($filter.query)} 0 {else} 1 {/if});
{if isset($filter.query)}Menu.append(mn_database[6], '&filter={$filter.query|escape:'quotes'}'); // todo: menu order varies per locale{/if}
{if isset($filter.query)}
Menu.modifyUrl(Menu.findItem(mn_database, [2]), {ldelim} filter: '+={$filter.query|escape:'quotes'}' {rdelim}, {ldelim} onAppendCollision: fi_mergeFilterParams {rdelim});
{/if}
</script>
<div id="fi" style="display:{if empty($filter.query)}none{else}block{/if};">
@@ -47,7 +49,7 @@
<td class="padded" width="100%">
<table><tr>
<td>&nbsp;&nbsp;&nbsp;Required level: </td>
<td>&nbsp;<input type="text" name="minrl" maxlength="2" class="smalltextbox" /> - <input type="text" name="maxrl" maxlength="2" class="smalltextbox" /></td>
<td>&nbsp;<input type="text" name="minrl" maxlength="2" class="smalltextbox"{if isset($filter.minrl)} value="{$filter.minrl}"{/if} /> - <input type="text" name="maxrl" maxlength="2" class="smalltextbox"{if isset($filter.maxrl)} value="{$filter.maxrl}"{/if} /></td>
</tr></table>
</td>
</tr><tr>

View File

@@ -2409,7 +2409,7 @@ Tabs.onShow = function(newTab, oldTab) {
padd = this.parent.offsetHeight + 15;
}
setTimeout(g_scrollTo.bind(null, el, padd), 10);
setTimeout($WH.g_scrollTo.bind(null, el, padd), 10);
}
};
@@ -12496,7 +12496,7 @@ Menu.fixUrls(mn_classes, '?class=');
Menu.fixUrls(mn_currencies, '?currencies=');
Menu.fixUrls(mn_factions, '?factions=');
Menu.fixUrls(mn_items, '?items=');
Menu.fixUrls(mn_itemSets, '?itemsets?filter=cl=', { hash: '0-2+1' });
Menu.fixUrls(mn_itemSets, '?itemsets&filter=cl=', { hash: '0-2+1' });
Menu.fixUrls(mn_npcs, '?npcs=');
Menu.fixUrls(mn_objects, '?objects=');
Menu.fixUrls(mn_petCalc, '?petcalc=');