From d848faa1fa12a4531282a5c367efd2be6f09df9e Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Tue, 5 Mar 2013 23:21:19 +0100 Subject: [PATCH] any 'Id' => 'id' as i'm mighty tired of the conflicts between js (lower) and php (ucFirst) added achievemnts-page to enable display of tooltips --- includes/class.achievement.php | 54 +-- includes/class.charclass.php | 14 +- includes/class.charrace.php | 12 +- includes/class.currency.php | 12 +- includes/class.item.php | 117 +++--- includes/class.itemset.php | 14 +- includes/class.quest.php | 14 +- includes/class.spell.php | 36 +- includes/class.title.php | 32 +- includes/utilities.php | 10 +- pages/achievement.php | 404 +++++++++++++++++++++ pages/compare.php | 12 +- pages/item.php | 4 +- pages/spell.php | 34 +- pages/title.php | 20 +- search.php | 18 +- setup/tools/dataset-assembler/enchants.php | 44 +-- setup/tools/dataset-assembler/glyphs.php | 6 +- setup/tools/dataset-assembler/itemsets.php | 2 +- setup/tools/dataset-assembler/talents.php | 2 +- template/bricks/announcement.tpl | 4 +- template/bricks/class_table.tpl | 2 +- template/bricks/community.tpl | 4 +- template/bricks/currency_table.tpl | 2 +- template/bricks/itemset_table.tpl | 2 +- template/bricks/race_table.tpl | 2 +- template/bricks/title_table.tpl | 2 +- 27 files changed, 643 insertions(+), 236 deletions(-) create mode 100644 pages/achievement.php diff --git a/includes/class.achievement.php b/includes/class.achievement.php index e0448b11..b8d9d939 100644 --- a/includes/class.achievement.php +++ b/includes/class.achievement.php @@ -8,7 +8,7 @@ class AchievementList extends BaseType public $criteria = []; public $tooltip = []; - protected $setupQuery = 'SELECT *, Id AS ARRAY_KEY FROM ?_achievement WHERE [filter] [cond] GROUP BY Id ORDER BY `orderInGroup` ASC'; + 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) @@ -19,7 +19,7 @@ class AchievementList extends BaseType while ($this->iterate()) { if (!$this->curTpl['iconString']) - $this->templates[$this->Id]['iconString'] = 'INV_Misc_QuestionMark'; + $this->templates[$this->id]['iconString'] = 'INV_Misc_QuestionMark'; //"rewards":[[11,137],[3,138]] [type, typeId] if (!empty($this->curTpl['rewardIds'])) @@ -29,7 +29,7 @@ class AchievementList extends BaseType foreach ($rewIds as $rewId) $rewards[] = ($rewId > 0 ? [TYPE_ITEM => $rewId] : ($rewId < 0 ? [TYPE_TITLE => -$rewId] : NULL)); - $this->templates[$this->Id]['rewards'] = $rewards; + $this->templates[$this->id]['rewards'] = $rewards; } } @@ -58,7 +58,7 @@ class AchievementList extends BaseType (new ItemList(array(['i.entry', array_unique($lookup['item'])])))->addGlobalsToJscript($refs); if (isset($lookup['title'])) - (new TitleList(array(['Id', array_unique($lookup['title'])])))->addGlobalsToJscript($refs); + (new TitleList(array(['id', array_unique($lookup['title'])])))->addGlobalsToJscript($refs); } public function addGlobalsToJscript(&$refs) @@ -68,7 +68,7 @@ class AchievementList extends BaseType while ($this->iterate()) { - $refs['gAchievements'][$this->Id] = array( + $refs['gAchievements'][$this->id] = array( 'icon' => $this->curTpl['iconString'], 'name' => Util::localizedString($this->curTpl, 'name') ); @@ -81,8 +81,8 @@ class AchievementList extends BaseType while ($this->iterate()) { - $data[$this->Id] = array( - 'id' => $this->Id, + $data[$this->id] = array( + 'id' => $this->id, 'name' => Util::localizedString($this->curTpl, 'name'), 'description' => Util::localizedString($this->curTpl, 'description'), 'points' => $this->curTpl['points'], @@ -98,10 +98,10 @@ class AchievementList extends BaseType foreach ($this->curTpl['rewards'] as $pair) $rewards[] = '['.key($pair).','.current($pair).']'; - $data[$this->Id]['rewards'] = '['.implode(',', $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'] = Util::localizedString($this->curTpl, 'reward'); } @@ -115,8 +115,8 @@ class AchievementList extends BaseType while ($this->iterate()) { - $data[$this->Id] = array( - 'id' => $this->Id, + $data[$this->id] = array( + 'id' => $this->id, 'name' => Util::localizedString($this->curTpl, 'name'), 'description' => Util::localizedString($this->curTpl, 'description'), 'points' => $this->curTpl['points'], @@ -134,26 +134,26 @@ class AchievementList extends BaseType { if (empty($this->criteria)) { - $result = DB::Aowow()->Select('SELECT * FROM ?_achievementcriteria WHERE `refAchievement` = ? ORDER BY `order` ASC', $this->Id); + $result = DB::Aowow()->Select('SELECT * FROM ?_achievementcriteria WHERE `refAchievement` = ? ORDER BY `order` ASC', $this->id); if (!$result) return []; if (is_array($result[0])) - $this->criteria[$this->Id] = $result; + $this->criteria[$this->id] = $result; else - $this->criteria[$this->Id][] = $result; + $this->criteria[$this->id][] = $result; } if ($idx < 0) - return $this->criteria[$this->Id]; + return $this->criteria[$this->id]; else - return $this->criteria[$this->Id][$idx]; + return $this->criteria[$this->id][$idx]; } public function renderTooltip() { - if (!empty($this->tooltip[$this->Id])) - return $this->tooltip[$this->Id]; + if (!empty($this->tooltip[$this->id])) + return $this->tooltip[$this->id]; $criteria = $this->getCriteria(); $tmp = []; @@ -232,9 +232,9 @@ class AchievementList extends BaseType $x .= ''; // Completed - $this->tooltip[$this->Id] = $x; + $this->tooltip[$this->id] = $x; - return $this->tooltip[$this->Id]; + return $this->tooltip[$this->id]; } public function getSourceData() @@ -243,11 +243,11 @@ class AchievementList extends BaseType while ($this->iterate()) { - $data[$this->Id] = array( + $data[$this->id] = array( "n" => Util::localizedString($this->curTpl, 'name'), "s" => $this->curTpl['faction'], "t" => TYPE_ACHIEVEMENT, - "ti" => $this->Id + "ti" => $this->id ); } @@ -308,7 +308,7 @@ class AchievementList extends BaseType // series parent(16) << child(16) $series = $this->curTpl['parent'] << 16; - $series |= DB::Aowow()->SelectCell('SELECT Id FROM ?_achievement WHERE parent = ?d', $acv->Id); + $series |= DB::Aowow()->SelectCell('SELECT Id FROM ?_achievement WHERE parent = ?d', $acv->id); // set rewards $rewardIds = []; @@ -330,12 +330,12 @@ class AchievementList extends BaseType } else if (stristr($rStr, 'reward:')) // i haz item { - if (in_array($acv->Id, [3656, 3478])) // Pilgrim + if (in_array($acv->id, [3656, 3478])) // Pilgrim { $rewardIds[] = -168; $rewardIds[] = 44810; } - else if (in_array($acv->Id, [1681, 1682])) // Loremaster + else if (in_array($acv->id, [1681, 1682])) // Loremaster { $rewardIds[] = -125; $rewardIds[] = 43300; @@ -345,7 +345,7 @@ class AchievementList extends BaseType $rStr = explode(':', $rStr)[1]; // head-b-gone $rewardIds[] = DB::Aowow()->SelectCell('SELECT entry FROM item_template WHERE name LIKE ?s', '%'.Util::sqlEscape(trim($rStr))); - if ($acv->Id == 1956) // higher learning + if ($acv->id == 1956) // higher learning $rewardIds[] = 44738; // pet not in description } } @@ -368,7 +368,7 @@ class AchievementList extends BaseType isset($rewardIds) ? implode(' ', $rewardIds) : '', $parentCat, $icon, - $acv->Id + $acv->id ); } } diff --git a/includes/class.charclass.php b/includes/class.charclass.php index 3810cdcf..74feb196 100644 --- a/includes/class.charclass.php +++ b/includes/class.charclass.php @@ -5,7 +5,7 @@ if (!defined('AOWOW_REVISION')) class CharClassList extends BaseType { - protected $setupQuery = 'SELECT *, Id AS ARRAY_KEY FROM ?_classes WHERE [cond] ORDER BY Id ASC'; + protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_classes WHERE [cond] ORDER BY Id ASC'; protected $matchQuery = 'SELECT COUNT(1) FROM ?_classes WHERE [cond]'; public function getListviewData() @@ -14,9 +14,9 @@ class CharClassList extends BaseType while ($this->iterate()) { - $data[$this->Id] = array( - 'Id' => $this->Id, - 'name' => $this->names[$this->Id], + $data[$this->id] = array( + 'id' => $this->id, + 'name' => $this->names[$this->id], 'races' => $this->curTpl['raceMask'], 'roles' => $this->curTpl['roles'], 'weapon' => $this->curTpl['weaponTypeMask'], @@ -25,10 +25,10 @@ class CharClassList extends BaseType ); if ($this->curTpl['expansion'] == 2) // todo: grr, move to db - $data[$this->Id]['hero'] = 1; + $data[$this->id]['hero'] = 1; if ($this->curTpl['expansion']) - $data[$this->Id]['expansion'] = $this->curTpl['expansion']; + $data[$this->id]['expansion'] = $this->curTpl['expansion']; } return $data; @@ -40,7 +40,7 @@ class CharClassList extends BaseType $refs['gClasses'] = []; while ($this->iterate()) - $refs['gClasses'][$this->Id] = Util::jsEscape($this->names[$this->Id]); + $refs['gClasses'][$this->id] = Util::jsEscape($this->names[$this->id]); } public function addRewardsToJScript(&$ref) { } diff --git a/includes/class.charrace.php b/includes/class.charrace.php index 12dd3be5..c8133e3e 100644 --- a/includes/class.charrace.php +++ b/includes/class.charrace.php @@ -5,7 +5,7 @@ if (!defined('AOWOW_REVISION')) class CharRaceList extends BaseType { - protected $setupQuery = 'SELECT *, Id AS ARRAY_KEY FROM ?_races WHERE [cond] ORDER BY Id ASC'; + protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_races WHERE [cond] ORDER BY Id ASC'; protected $matchQuery = 'SELECT COUNT(1) FROM ?_races WHERE [cond]'; public function getListviewData() @@ -14,9 +14,9 @@ class CharRaceList extends BaseType while ($this->iterate()) { - $data[$this->Id] = array( - 'Id' => $this->Id, - 'name' => $this->names[$this->Id], + $data[$this->id] = array( + 'id' => $this->id, + 'name' => $this->names[$this->id], 'classes' => $this->curTpl['classMask'], 'faction' => $this->curTpl['factionId'], 'leader' => $this->curTpl['leader'], @@ -25,7 +25,7 @@ class CharRaceList extends BaseType ); if ($this->curTpl['expansion']) - $data[$this->Id]['expansion'] = $this->curTpl['expansion']; + $data[$this->id]['expansion'] = $this->curTpl['expansion']; } return $data; @@ -36,7 +36,7 @@ class CharRaceList extends BaseType if (!isset($refs['gRaces'])) $refs['gRaces'] = []; - $refs['gRaces'][$this->Id] = Util::jsEscape($this->names[$this->Id]); + $refs['gRaces'][$this->id] = Util::jsEscape($this->names[$this->id]); } public function addRewardsToJScript(&$ref) { } diff --git a/includes/class.currency.php b/includes/class.currency.php index c31ac9e1..768c1e3e 100644 --- a/includes/class.currency.php +++ b/includes/class.currency.php @@ -5,7 +5,7 @@ if (!defined('AOWOW_REVISION')) class CurrencyList extends BaseType { - protected $setupQuery = 'SELECT *, Id AS ARRAY_KEY FROM ?_currencies WHERE [cond] ORDER BY Id ASC'; + protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_currencies WHERE [cond] ORDER BY Id ASC'; protected $matchQuery = 'SELECT COUNT(1) FROM ?_currencies WHERE [cond]'; public function getListviewData() @@ -14,10 +14,10 @@ class CurrencyList extends BaseType while ($this->iterate()) { - $data[$this->Id] = array( - 'Id' => $this->Id, + $data[$this->id] = array( + 'id' => $this->id, 'category' => $this->curTpl['category'], - 'name' => $this->names[$this->Id], + 'name' => $this->names[$this->id], 'icon' => $this->curTpl['iconString'] ); } @@ -34,8 +34,8 @@ class CurrencyList extends BaseType while ($this->iterate()) { - $refs['gCurrencies'][$this->Id] = array( - 'name_'.User::$localeString => Util::jsEscape($this->names[$this->Id]), + $refs['gCurrencies'][$this->id] = array( + 'name_'.User::$localeString => Util::jsEscape($this->names[$this->id]), 'icon' => $this->curTpl['iconString'] ); } diff --git a/includes/class.item.php b/includes/class.item.php index db9b7bb8..c4a4e8a9 100644 --- a/includes/class.item.php +++ b/includes/class.item.php @@ -90,8 +90,9 @@ class ItemList extends BaseType if ($addInfoMask & ITEMINFO_JSON) $this->extendJsonStats(); - $tmp = array_merge($this->json[$this->Id], array( - 'name' => $this->names[$this->Id], + $tmp = array_merge($this->json[$this->id], array( + 'id' => $this->id, + 'name' => $this->names[$this->id], 'quality' => 7 - $this->curTpl['Quality'], 'reqskill' => $this->curTpl['RequiredSkill'], 'reqskillrank' => $this->curTpl['RequiredSkillRank'], @@ -112,7 +113,7 @@ class ItemList extends BaseType if (!in_array($this->curTpl['AllowableClass'], [-1, 0, CLASS_MASK_ALL])) $tmp['reqclass'] = $this->curTpl['AllowableClass']; // $tmp['classes'] ?? - $data[$this->Id] = $tmp; + $data[$this->id] = $tmp; } /* even more complicated crap @@ -140,8 +141,8 @@ class ItemList extends BaseType while ($this->iterate()) { - $refs['gItems'][$this->Id] = array( - 'name' => $this->names[$this->Id], + $refs['gItems'][$this->id] = array( + 'name' => $this->names[$this->id], 'quality' => $this->curTpl['Quality'], 'icon' => $this->curTpl['icon'], ); @@ -161,10 +162,10 @@ class ItemList extends BaseType if ($this->error) return; - $name = $this->names[$this->Id]; + $name = $this->names[$this->id]; - if (!empty($this->tooltip[$this->Id])) - return $this->tooltip[$this->Id]; + if (!empty($this->tooltip[$this->id])) + return $this->tooltip[$this->id]; if (!empty($enhance['rand'])) { @@ -532,10 +533,10 @@ class ItemList extends BaseType if ($itemSpellsAndTrigger) { - $itemSpells = new SpellList(array(['Id', array_keys($itemSpellsAndTrigger)])); + $itemSpells = new SpellList(array(['id', array_keys($itemSpellsAndTrigger)])); while ($itemSpells->iterate()) if ($parsed = $itemSpells->parseText('description', $this->curTpl['RequiredLevel'])) - $green[] = Lang::$item['trigger'][$itemSpellsAndTrigger[$itemSpells->Id]].$parsed; + $green[] = Lang::$item['trigger'][$itemSpellsAndTrigger[$itemSpells->id]].$parsed; } @@ -556,7 +557,7 @@ class ItemList extends BaseType ?_itemset WHERE (item1=?d or item2=?d or item3=?d or item4=?d or item5=?d or item6=?d or item7=?d or item8=?d or item9=?d or item10=?d)', - $this->Id, $this->Id, $this->Id, $this->Id, $this->Id, $this->Id, $this->Id, $this->Id, $this->Id, $this->Id + $this->id, $this->id, $this->id, $this->id, $this->id, $this->id, $this->id, $this->id, $this->id, $this->id ); if ($itemset) @@ -573,7 +574,7 @@ class ItemList extends BaseType } $tmpX .= implode('
', $pieces); - $x .= '
'.Util::localizedString($itemset, 'name').' (0/'.$num.')'; + $x .= '
'.Util::localizedString($itemset, 'name').' (0/'.$num.')'; if ($itemset['skillID']) // bonus requires skill to activate { @@ -598,13 +599,13 @@ class ItemList extends BaseType // todo: get from static prop? if ($setSpellsAndIdx) { - $boni = new SpellList(array(['Id', array_keys($setSpellsAndIdx)])); + $boni = new SpellList(array(['id', array_keys($setSpellsAndIdx)])); while ($boni->iterate()) { $itemset['spells'][] = array( 'tooltip' => $boni->parseText('description', $this->curTpl['RequiredLevel']), - 'entry' => $itemset['spell'.$setSpellsAndIdx[$boni->Id]], - 'bonus' => $itemset['bonus'.$setSpellsAndIdx[$boni->Id]] + 'entry' => $itemset['spell'.$setSpellsAndIdx[$boni->id]], + 'bonus' => $itemset['bonus'.$setSpellsAndIdx[$boni->id]] ); } } @@ -632,7 +633,7 @@ class ItemList extends BaseType // recipe handling (some stray Techniques have subclass == 0), place at bottom of tooltipp if ($this->curTpl['class'] == ITEM_CLASS_RECIPE && ($this->curTpl['subclass'] || $this->curTpl['BagFamily'] == 16)) { - $craftSpell = new SpellList(array(['Id', (int)$this->curTpl['spellid_2']])); + $craftSpell = new SpellList(array(['id', (int)$this->curTpl['spellid_2']])); $craftItem = new ItemList(array(['i.entry', (int)$craftSpell->curTpl["effect1CreateItemId"]])); $reagentItems = []; @@ -648,7 +649,7 @@ class ItemList extends BaseType $xCraft = '

'.$craftItem->renderTooltip(null, $interactive).'

'; while ($reagents->iterate()) - $reqReag[] = ''.$reagents->names[$reagents->Id].' ('.$reagentItems[$reagents->Id].')'; + $reqReag[] = ''.$reagents->names[$reagents->id].' ('.$reagentItems[$reagents->id].')'; $xCraft .= ''.Lang::$game['requires']." ".implode(", ", $reqReag).''; @@ -682,24 +683,24 @@ class ItemList extends BaseType $x .= ''; // heirloom tooltip scaling - if (isset($this->ssd[$this->Id])) + if (isset($this->ssd[$this->id])) { $link = array( - $this->Id, // itemId + $this->id, // itemId 1, // scaleMinLevel - $this->ssd[$this->Id]['maxLevel'], // scaleMaxLevel - $this->ssd[$this->Id]['maxLevel'], // scaleCurLevel + $this->ssd[$this->id]['maxLevel'], // scaleMaxLevel + $this->ssd[$this->id]['maxLevel'], // scaleCurLevel $this->curTpl['ScalingStatDistribution'], // scaleDist $this->curTpl['ScalingStatValue'], // scaleFlags ); $x .= ''; } else - $x .= ''; + $x .= ''; - $this->tooltip[$this->Id] = $x; + $this->tooltip[$this->id] = $x; - return $this->tooltip[$this->Id]; + return $this->tooltip[$this->id]; } // from Trinity @@ -783,7 +784,7 @@ class ItemList extends BaseType if (!$this->curTpl['stat_type'.$h]) continue; - @$this->itemMods[$this->Id][$this->curTpl['stat_type'.$h]] += $this->curTpl['stat_value'.$h]; + @$this->itemMods[$this->id][$this->curTpl['stat_type'.$h]] += $this->curTpl['stat_value'.$h]; } // convert Spells @@ -802,33 +803,33 @@ class ItemList extends BaseType if ($equipSpells) { - $eqpSplList = new SpellList(array(['Id', $equipSpells])); + $eqpSplList = new SpellList(array(['id', $equipSpells])); $stats = $eqpSplList->getStatGain(); foreach ($stats as $mId => $qty) - @$this->itemMods[$this->Id][$mId] += $qty; + @$this->itemMods[$this->id][$mId] += $qty; } // fetch and add socketbonusstats - if (@$this->json[$this->Id]['socketbonus'] > 0) + if (@$this->json[$this->id]['socketbonus'] > 0) { - $enh = DB::Aowow()->selectRow('SELECT * FROM ?_itemenchantment WHERE Id = ?;', $this->json[$this->Id]['socketbonus']); - $this->json[$this->Id]['socketbonusstat'] = []; + $enh = DB::Aowow()->selectRow('SELECT * FROM ?_itemenchantment WHERE Id = ?;', $this->json[$this->id]['socketbonus']); + $this->json[$this->id]['socketbonusstat'] = []; $socketbonusstat = Util::parseItemEnchantment($enh); foreach ($socketbonusstat as $k => $v) - $this->json[$this->Id]['socketbonusstat'][] = '"'.$k.'":'.$v; + $this->json[$this->id]['socketbonusstat'][] = '"'.$k.'":'.$v; - $this->json[$this->Id]['socketbonusstat'] = "{".implode(',', $this->json[$this->Id]['socketbonusstat'])."}"; + $this->json[$this->id]['socketbonusstat'] = "{".implode(',', $this->json[$this->id]['socketbonusstat'])."}"; } // readdress itemset .. is wrong for virtual sets if ($pieceAssoc) - $this->json[$this->Id]['itemset'] = $pieceAssoc[$this->Id]; + $this->json[$this->id]['itemset'] = $pieceAssoc[$this->id]; // gather random Enchantments // todo: !important! extremly high sql-load - if (@$this->json[$this->Id]['commondrop'] && isset($this->subItems[$this->Id])) + if (@$this->json[$this->id]['commondrop'] && isset($this->subItems[$this->id])) { - foreach ($this->subItems[$this->Id] as $k => $sI) + foreach ($this->subItems[$this->id] as $k => $sI) { $jsonEquip = []; $jsonText = []; @@ -856,27 +857,27 @@ class ItemList extends BaseType } } - $this->subItems[$this->Id][$k] = array( + $this->subItems[$this->id][$k] = array( 'name' => Util::localizedString($sI, 'name'), 'enchantment' => implode(', ', $jsonText), 'jsonequip' => $jsonEquip ); } - $this->json[$this->Id]['subitems'] = json_encode($this->subItems[$this->Id], JSON_FORCE_OBJECT); + $this->json[$this->id]['subitems'] = json_encode($this->subItems[$this->id], JSON_FORCE_OBJECT); } - foreach ($this->json[$this->Id] as $k => $v) + foreach ($this->json[$this->id] as $k => $v) { if (!isset($v) || $v === "false") { - unset($this->json[$this->Id][$k]); + unset($this->json[$this->id][$k]); continue; } if (!in_array($k, ['classs', 'subclass', 'armor']) && $v === "0") { - unset($this->json[$this->Id][$k]); + unset($this->json[$this->id][$k]); continue; } } @@ -885,7 +886,7 @@ class ItemList extends BaseType private function parseRating($type, $value, $interactive = false) { // clamp level range - $ssdLvl = isset($this->ssd[$this->Id]) ? $this->ssd[$this->Id]['maxLevel'] : 1; + $ssdLvl = isset($this->ssd[$this->id]) ? $this->ssd[$this->id]['maxLevel'] : 1; $level = min(max($this->curTpl['RequiredLevel'], $ssdLvl), MAX_LEVEL); if (!Lang::$item['statType'][$type]) // unknown rating @@ -925,45 +926,45 @@ class ItemList extends BaseType if ($mask & (1 << $i)) $field = Util::$ssdMaskFields[$i]; - return $field ? DB::Aowow()->selectCell("SELECT ?# FROM ?_scalingstatvalues WHERE charLevel = ?", $field, $this->ssd[$this->Id]['maxLevel']) : 0; + return $field ? DB::Aowow()->selectCell("SELECT ?# FROM ?_scalingstatvalues WHERE charLevel = ?", $field, $this->ssd[$this->id]['maxLevel']) : 0; } private function initScalingStats() { - $this->ssd[$this->Id] = DB::Aowow()->selectRow("SELECT * FROM ?_scalingstatdistribution WHERE id = ?", $this->curTpl['ScalingStatDistribution']); + $this->ssd[$this->id] = DB::Aowow()->selectRow("SELECT * FROM ?_scalingstatdistribution WHERE id = ?", $this->curTpl['ScalingStatDistribution']); // stats and ratings for ($i = 1; $i <= 10; $i++) { - if ($this->ssd[$this->Id]['statMod'.$i] <= 0) + if ($this->ssd[$this->id]['statMod'.$i] <= 0) { - $this->templates[$this->Id]['stat_type'.$i] = 0; - $this->templates[$this->Id]['stat_value'.$i] = 0; + $this->templates[$this->id]['stat_type'.$i] = 0; + $this->templates[$this->id]['stat_value'.$i] = 0; } else { - $this->templates[$this->Id]['stat_type'.$i] = $this->ssd[$this->Id]['statMod'.$i]; - $this->templates[$this->Id]['stat_value'.$i] = intVal(($this->getSSDMod('stats') * $this->ssd[$this->Id]['modifier'.$i]) / 10000); + $this->templates[$this->id]['stat_type'.$i] = $this->ssd[$this->id]['statMod'.$i]; + $this->templates[$this->id]['stat_value'.$i] = intVal(($this->getSSDMod('stats') * $this->ssd[$this->id]['modifier'.$i]) / 10000); } } // armor: only replace if set if ($ssvArmor = $this->getSSDMod('armor')) - $this->templates[$this->Id]['armor'] = $ssvArmor; + $this->templates[$this->id]['armor'] = $ssvArmor; // if set dpsMod in ScalingStatValue use it for min (70% from average), max (130% from average) damage if ($extraDPS = $this->getSSDMod('dps')) // dmg_x2 not used for heirlooms { $average = $extraDPS * $this->curTpl['delay'] / 1000; - $this->templates[$this->Id]['dmg_min1'] = number_format(0.7 * $average); - $this->templates[$this->Id]['dmg_max1'] = number_format(1.3 * $average); + $this->templates[$this->id]['dmg_min1'] = number_format(0.7 * $average); + $this->templates[$this->id]['dmg_max1'] = number_format(1.3 * $average); } // apply Spell Power from ScalingStatValue if set if ($spellBonus = $this->getSSDMod('spell')) { - $this->templates[$this->Id]['stat_type10'] = ITEM_MOD_SPELL_POWER; - $this->templates[$this->Id]['stat_value10'] = $spellBonus; + $this->templates[$this->id]['stat_type10'] = ITEM_MOD_SPELL_POWER; + $this->templates[$this->id]['stat_value10'] = $spellBonus; } } @@ -977,22 +978,22 @@ class ItemList extends BaseType $randomIds[$key] = -$val; }); - $this->subItems[$this->Id] = DB::Aowow()->select('SELECT *, Id AS ARRAY_KEY FROM ?_itemRandomEnchant WHERE Id IN (?a)', $randomIds); + $this->subItems[$this->id] = DB::Aowow()->select('SELECT *, Id AS ARRAY_KEY FROM ?_itemRandomEnchant WHERE Id IN (?a)', $randomIds); // subitems may share enchantmentIds - foreach ($this->subItems[$this->Id] as $sI) + foreach ($this->subItems[$this->id] as $sI) for ($i = 1; $i < 6; $i++) if (!isset($this->rndEnchIds[$sI['enchantId'.$i]]) && $sI['enchantId'.$i]) if ($enchant = DB::Aowow()->selectRow('SELECT *, Id AS ARRAY_KEY FROM ?_itemenchantment WHERE Id = ?d', $sI['enchantId'.$i])) - $this->rndEnchIds[$enchant['Id']] = $enchant; + $this->rndEnchIds[$enchant['id']] = $enchant; } } private function initJsonStats() { $json = array( - 'id' => $this->Id, // note to self: lowercase for js-Ids.. ALWAYS!! - 'name' => (ITEM_QUALITY_HEIRLOOM - $this->curTpl['Quality']).$this->names[$this->Id], + 'id' => $this->id, // note to self: lowercase for js-Ids.. ALWAYS!! + 'name' => (ITEM_QUALITY_HEIRLOOM - $this->curTpl['Quality']).$this->names[$this->id], 'icon' => $this->curTpl['icon'], 'classs' => $this->curTpl['class'], 'subclass' => $this->curTpl['subclass'], diff --git a/includes/class.itemset.php b/includes/class.itemset.php index ba7a1ea4..1212130d 100644 --- a/includes/class.itemset.php +++ b/includes/class.itemset.php @@ -9,7 +9,7 @@ class ItemsetList extends BaseType public $pieces = []; // used to build g_items and search public $pieceToSet = []; - protected $setupQuery = 'SELECT *, Id AS ARRAY_KEY FROM ?_itemset WHERE [filter] [cond] ORDER BY maxlevel ASC'; + protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_itemset WHERE [filter] [cond] ORDER BY maxlevel ASC'; protected $matchQuery = 'SELECT COUNT(1) FROM ?_itemset WHERE [filter] [cond]'; public function __construct($data) @@ -19,7 +19,7 @@ class ItemsetList extends BaseType // post processing foreach ($this->templates as $this->curTpl) { - $Id = $this->curTpl['Id']; + $Id = $this->curTpl['id']; $this->templates[$Id]['classes'] = []; $this->templates[$Id]['pieces'] = []; @@ -39,7 +39,7 @@ class ItemsetList extends BaseType { $this->pieces[] = $piece; $this->templates[$Id]['pieces'][] = $piece; - $this->pieceToSet[$piece] = $this->Id; + $this->pieceToSet[$piece] = $this->id; } } } @@ -59,10 +59,10 @@ class ItemsetList extends BaseType while ($this->iterate()) { - $data[$this->Id] = array( - 'Id' => $this->Id, + $data[$this->id] = array( + 'id' => $this->id, 'idbak' => $this->curTpl['refSetId'], - 'name' => $this->names[$this->Id], + 'name' => $this->names[$this->id], 'quality' => 7 - $this->curTpl['quality'], 'minlevel' => $this->curTpl['minLevel'], 'maxlevel' => $this->curTpl['maxLevel'], @@ -81,7 +81,7 @@ class ItemsetList extends BaseType public function addGlobalsToJscript(&$refs) { if ($this->classes) - (new CharClassList(array(['Id', $this->classes])))->addGlobalsToJscript($refs); + (new CharClassList(array(['id', $this->classes])))->addGlobalsToJscript($refs); if ($this->pieces) (new ItemList(array(['i.entry', $this->pieces])))->addGlobalsToJscript($refs); diff --git a/includes/class.quest.php b/includes/class.quest.php index ceb8f334..77264d01 100644 --- a/includes/class.quest.php +++ b/includes/class.quest.php @@ -8,7 +8,7 @@ class QuestList extends BaseType public $cat1 = 0; public $cat2 = 0; - protected $setupQuery = 'SELECT *, Id AS ARRAY_KEY FROM quest_template a LEFT JOIN locales_quest b ON a.Id = b.entry WHERE [filter] [cond] ORDER BY Id ASC'; + protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM quest_template a LEFT JOIN locales_quest b ON a.Id = b.entry WHERE [filter] [cond] ORDER BY Id ASC'; protected $matchQuery = 'SELECT COUNT(1) FROM quest_template a LEFT JOIN locales_quest b ON a.Id = b.entry WHERE [filter] [cond]'; // parent::__construct does the job @@ -17,7 +17,7 @@ class QuestList extends BaseType { $r = parent::iterate($qty); - if (!$this->Id) + if (!$this->id) { $this->cat1 = 0; $this->cat2 = 0; @@ -75,10 +75,10 @@ class QuestList extends BaseType while ($this->iterate()) { - $data[$this->Id] = array( + $data[$this->id] = array( "n" => Util::localizedString($this->curTpl, 'Title'), "t" => TYPE_QUEST, - "ti" => $this->Id, + "ti" => $this->id, "c" => $this->cat1, "c2" => $this->cat2 ); @@ -96,7 +96,7 @@ class QuestList extends BaseType $set = array( 'category' => $this->cat1, 'category2' => $this->cat2, - 'id' => $this->Id, + 'id' => $this->id, 'level' => $this->curTpl['Level'], 'reqlevel' => $this->curTpl['MinLevel'], 'name' => Util::localizedString($this->curTpl, 'Title'), @@ -161,10 +161,10 @@ class QuestList extends BaseType (new ItemList(array(['i.entry', $items])))->addGlobalsToJscript($refs); if ($spells) - (new SpellList(array(['Id', $spells])))->addGlobalsToJscript($refs); + (new SpellList(array(['id', $spells])))->addGlobalsToJscript($refs); if ($titles) - (new TitleList(array(['Id', $titles])))->addGlobalsToJscript($refs); + (new TitleList(array(['id', $titles])))->addGlobalsToJscript($refs); } public function renderTooltip() diff --git a/includes/class.spell.php b/includes/class.spell.php index 27d70f50..5f61454a 100644 --- a/includes/class.spell.php +++ b/includes/class.spell.php @@ -11,7 +11,7 @@ class SpellList extends BaseType private $spellVars = []; private $refSpells = []; - protected $setupQuery = 'SELECT *, Id AS ARRAY_KEY FROM ?_spell WHERE [filter] [cond] GROUP BY Id ORDER BY Id ASC'; + protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_spell WHERE [filter] [cond] GROUP BY Id ORDER BY Id ASC'; protected $matchQuery = 'SELECT COUNT(1) FROM ?_spell WHERE [filter] [cond]'; public function __construct($conditions) @@ -27,13 +27,13 @@ class SpellList extends BaseType // if the spell creates an item use the itemIcon instead while ($this->iterate()) if ($this->curTpl['effect1CreateItemId']) - $itemIcons[(int)$this->curTpl['effect1CreateItemId']] = $this->Id; + $itemIcons[(int)$this->curTpl['effect1CreateItemId']] = $this->id; if ($itemIcons) { $itemList = new ItemList(array(['i.entry', array_keys($itemIcons)])); while ($itemList->iterate()) - $this->templates[$itemIcons[$itemList->Id]]['createItemString'] = $itemList->getField('icon'); + $this->templates[$itemIcons[$itemList->id]]['createItemString'] = $itemList->getField('icon'); } $this->reset(); // restore 'iterator' @@ -266,7 +266,7 @@ class SpellList extends BaseType // cache at least some lookups.. should be moved to single spellList :/ if ($lookup && !isset($this->refSpells[$lookup])) - $this->refSpells[$lookup] = new SpellList(array(['Id', $lookup])); + $this->refSpells[$lookup] = new SpellList(array(['id', $lookup])); switch ($var) { @@ -750,31 +750,31 @@ class SpellList extends BaseType return null; // step 1: if the text is supplemented with text-variables, get and replace them - if (empty($this->spellVars[$this->Id]) && $this->curTpl['spellDescriptionVariableId'] > 0) + if (empty($this->spellVars[$this->id]) && $this->curTpl['spellDescriptionVariableId'] > 0) { $spellVars = DB::Aowow()->SelectCell('SELECT vars FROM ?_spellVariables WHERE id = ?d', $this->curTpl['spellDescriptionVariableId']); $spellVars = explode("\n", $spellVars); foreach ($spellVars as $sv) if (preg_match('/\$(\w*\d*)=(.*)/i', trim($sv), $matches)) - $this->spellVars[$this->Id][$matches[1]] = $matches[2]; + $this->spellVars[$this->id][$matches[1]] = $matches[2]; // replace self-references $reset = true; while ($reset) { $reset = false; - foreach ($this->spellVars[$this->Id] as $k => $sv) + foreach ($this->spellVars[$this->id] as $k => $sv) { if (preg_match('/\$<(\w*\d*)>/i', $sv, $matches)) { - $this->spellVars[$this->Id][$k] = str_replace('$<'.$matches[1].'>', '${'.$this->spellVars[$this->Id][$matches[1]].'}', $sv); + $this->spellVars[$this->id][$k] = str_replace('$<'.$matches[1].'>', '${'.$this->spellVars[$this->id][$matches[1]].'}', $sv); $reset = true; } } } // finally, replace SpellDescVars - foreach ($this->spellVars[$this->Id] as $k => $sv) + foreach ($this->spellVars[$this->id] as $k => $sv) $data = str_replace('$<'.$k.'>', $sv, $data); } @@ -944,7 +944,7 @@ class SpellList extends BaseType { while ($this->iterate()) { - if ($Id && $this->Id != $Id) + if ($Id && $this->id != $Id) continue; // doesn't have a buff @@ -973,7 +973,7 @@ class SpellList extends BaseType $x .= ''; - $this->buffs[$this->Id] = $x; + $this->buffs[$this->id] = $x; } return $Id ? $this->buffs[$Id] : true; @@ -983,7 +983,7 @@ class SpellList extends BaseType { while ($this->iterate()) { - if ($Id && $this->Id != $Id) + if ($Id && $this->id != $Id) continue; // get reagents @@ -1033,7 +1033,7 @@ class SpellList extends BaseType $x .= '
'; // name - $x .= ''.$this->names[$this->Id].''; + $x .= ''.$this->names[$this->id].''; // rank if (!empty($rankText)) @@ -1161,7 +1161,7 @@ class SpellList extends BaseType if ($reqWrapper2) $x .= "
"; - $this->tooltips[$this->Id] = $x; + $this->tooltips[$this->id] = $x; } return $Id ? $this->tooltips[$Id] : true; @@ -1261,8 +1261,8 @@ class SpellList extends BaseType while ($this->iterate()) { - $data[$this->Id] = array( - 'name' => $this->names[$this->Id], + $data[$this->id] = array( + 'name' => $this->names[$this->id], 'icon' => $this->curTpl['iconString'], 'level' => $this->curTpl['baseLevel'], ); @@ -1280,9 +1280,9 @@ class SpellList extends BaseType { $iconString = isset($this->curTpl['createItemString']) ? 'createItemString' : 'iconString'; - $refs['gSpells'][$this->Id] = array( + $refs['gSpells'][$this->id] = array( 'icon' => $this->curTpl[$iconString], - 'name' => $this->names[$this->Id], + 'name' => $this->names[$this->id], ); } } diff --git a/includes/class.title.php b/includes/class.title.php index 9b227876..4130ad9d 100644 --- a/includes/class.title.php +++ b/includes/class.title.php @@ -7,7 +7,7 @@ class TitleList extends BaseType { private $sources = []; - protected $setupQuery = 'SELECT *, Id AS ARRAY_KEY FROM ?_titles WHERE [cond] ORDER BY Id ASC'; + protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_titles WHERE [cond] ORDER BY Id ASC'; protected $matchQuery = 'SELECT COUNT(1) FROM ?_titles WHERE [cond]'; public function __construct($data) @@ -18,9 +18,9 @@ class TitleList extends BaseType while ($this->iterate()) { // overwrite names with gender-speciffics - $this->names[$this->Id][GENDER_MALE] = Util::localizedString($this->curTpl, 'male'); + $this->names[$this->id][GENDER_MALE] = Util::localizedString($this->curTpl, 'male'); if ($this->curTpl['female_loc0'] || $this->curTpl['female_loc'.User::$localeId]) - $this->names[$this->Id][GENDER_FEMALE] = Util::localizedString($this->curTpl, 'female'); + $this->names[$this->id][GENDER_FEMALE] = Util::localizedString($this->curTpl, 'female'); // preparse sources if (!empty($this->curTpl['source'])) @@ -29,7 +29,7 @@ class TitleList extends BaseType foreach ($sources as $src) { $src = explode(':', $src); - $this->sources[$this->Id][$src[0]][] = $src[1]; + $this->sources[$this->id][$src[0]][] = $src[1]; } } } @@ -42,9 +42,9 @@ class TitleList extends BaseType while ($this->iterate()) { - $data[$this->Id] = array( - 'Id' => $this->Id, - 'name' => $this->names[$this->Id][GENDER_MALE], + $data[$this->id] = array( + 'id' => $this->id, + 'name' => $this->names[$this->id][GENDER_MALE], 'side' => $this->curTpl['side'], 'gender' => $this->curTpl['gender'], 'expansion' => $this->curTpl['expansion'], @@ -52,7 +52,7 @@ class TitleList extends BaseType ); if (!empty($this->curTpl['source'])) - $data[$this->Id]['source'] = $this->curTpl['source']; + $data[$this->id]['source'] = $this->curTpl['source']; } if (isset($this->name[GENDER_FEMALE])) @@ -68,10 +68,10 @@ class TitleList extends BaseType while ($this->iterate()) { - $refs['gTitles'][$this->Id]['name'] = Util::jsEscape($this->names[$this->Id][GENDER_MALE]); + $refs['gTitles'][$this->id]['name'] = Util::jsEscape($this->names[$this->id][GENDER_MALE]); - if (isset($this->names[$this->Id][GENDER_FEMALE])) - $refs['gTitles'][$this->Id]['namefemale'] = Util::jsEscape($this->names[$this->Id][GENDER_FEMALE]); + if (isset($this->names[$this->id][GENDER_FEMALE])) + $refs['gTitles'][$this->id]['namefemale'] = Util::jsEscape($this->names[$this->id][GENDER_FEMALE]); } } @@ -85,20 +85,20 @@ class TitleList extends BaseType while ($this->iterate()) { - if (empty($this->sources[$this->Id])) + if (empty($this->sources[$this->id])) continue; foreach (array_keys($sources) as $srcKey) - if (isset($this->sources[$this->Id][$srcKey])) - $sources[$srcKey] = array_merge($sources[$srcKey], $this->sources[$this->Id][$srcKey]); + if (isset($this->sources[$this->id][$srcKey])) + $sources[$srcKey] = array_merge($sources[$srcKey], $this->sources[$this->id][$srcKey]); } // fill in the details if (!empty($sources[4])) - $sources[4] = (new QuestList(array(['Id', $sources[4]])))->getSourceData(); + $sources[4] = (new QuestList(array(['id', $sources[4]])))->getSourceData(); if (!empty($sources[12])) - $sources[12] = (new AchievementList(array(['Id', $sources[12]])))->getSourceData(); + $sources[12] = (new AchievementList(array(['id', $sources[12]])))->getSourceData(); if (!empty($sources[13])) $sources[13] = DB::Aowow()->SELECT('SELECT *, Id AS ARRAY_KEY FROM ?_sourceStrings WHERE Id IN (?a)', $sources[13]); diff --git a/includes/utilities.php b/includes/utilities.php index f6f2d981..92546cf3 100644 --- a/includes/utilities.php +++ b/includes/utilities.php @@ -140,18 +140,18 @@ abstract class BaseType $this->curTpl = current($this->templates); $field = $this->curTpl ? Util::getIdFieldName($this->curTpl) : null; - $this->Id = $this->curTpl ? $this->curTpl[$field] : 0; + $this->id = $this->curTpl ? $this->curTpl[$field] : 0; while ($qty--) next($this->templates); - return $this->Id; + return $this->id; } public function reset() { $this->curTpl = reset($this->templates); - $this->Id = $this->curTpl[Util::getIdFieldName($this->curTpl)]; + $this->id = $this->curTpl[Util::getIdFieldName($this->curTpl)]; } // read-access to templates @@ -1192,7 +1192,7 @@ class Util break; case 3: case 7: - $spl = new SpellList(array(['Id', (int)$enchant['object'.$h]])); + $spl = new SpellList(array(['id', (int)$enchant['object'.$h]])); $gain = $spl->getStatGain(); foreach ($gain as $k => $v) // array_merge screws up somehow... @@ -1264,6 +1264,8 @@ class Util return 'entry'; else if (isset($tpl['Id'])) return 'Id'; + else if (isset($tpl['id'])) + return 'id'; else if (isset($tpl['ID'])) return 'ID'; else diff --git a/pages/achievement.php b/pages/achievement.php new file mode 100644 index 00000000..84a8abf7 --- /dev/null +++ b/pages/achievement.php @@ -0,0 +1,404 @@ + 100 +* } +*/ + +require 'includes/class.community.php'; + +$id = intVal($pageParam); +$acv = new AchievementList(array(['id', $id])); + +$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_ACHIEVEMENT, $id, -1, User::$localeId]); +$cacheKeyTooltip = implode('_', [CACHETYPE_TOOLTIP, TYPE_ACHIEVEMENT, $id, -1, User::$localeId]); + +// AowowPower-request +if (isset($_GET['power'])) +{ + header('Content-type: application/x-javascript; charsetUTF-8'); + + Util::powerUseLocale(@$_GET['domain']); + + if ($acv->error) + die('$WowheadPower.registerAchievement(\''.$id.'\', '.User::$localeId.', {})'); + + if (!$smarty->loadCache($cacheKeyTooltip, $x)) + { + $x = '$WowheadPower.registerAchievement('.$id.', '.User::$localeId.",{\n"; + $x .= "\tname_".User::$localeString.": '".Util::jsEscape($acv->names[$id])."',\n"; + $x .= "\ticon: '".$acv->getField('iconString')."',\n"; + $x .= "\ttooltip_".User::$localeString.': \''.$acv->renderTooltip()."'\n"; + $x .= "});"; + + $smarty->saveCache($cacheKeyTooltip, $x); + } + die($x); +} + +// regular page +if (!$smarty->loadCache($cacheKeyPage, $pageData)) +{ + + if ($acv->error) + { + $smarty->updatePageVars(array( + 'subject' => ucfirst(Lang::$achievement['achievement']), + 'id' => $id, + 'notFound' => sprintf(Lang::$main['pageNotFound'], Lang::$achievement['achievement']), + )); + $smarty->assign('lang', Lang::$main); + $smarty->display('404.tpl'); + exit(); + } + + $pageData['path'] = []; + $pageData['title'] = [ucfirst(Lang::$achievement['achievement'])]; + $acv->renderTooltip(); + + // create page title and path + $curCat = $acv->getField('category'); + do + { + $pageData['path'][] = $curCat; + $curCat = DB::Aowow()->SelectCell('SELECT parentCategory FROM ?_achievementcategory WHERE id = ?d', $curCat); + } + while ($curCat > 0); + + $pageData['path'] = array_reverse(array_merge($pageData['path'], [9, 0])); + + array_unshift($pageData['title'], $acv->names[$id]); + + $acv->addRewardsToJscript($pageData); + $pageData['page'] = $acv->getDetailedData(); + + // infobox content + switch ($acv->getField('faction')) + { + case 0: + $pageData['page']['infoBox'][] = Lang::$main['side'].': '.Lang::$game['alliance'].''; + break; + case 1: + $pageData['page']['infoBox'][] = Lang::$main['side'].': '.Lang::$game['horde'].''; + break; + default: // case 3 + $pageData['page']['infoBox'][] = Lang::$main['side'].': '.Lang::$main['both']; + } + + // todo: crosslink with charactersDB to check if realmFirsts are still available + + $pageData['page']['infoBox'] = array_merge($pageData['page']['infoBox'], Lang::getInfoBoxForFlags($acv->getField('cuFlags'))); + + // listview: "see also" + $conditions = array( + ['name_loc'.User::$localeId, $acv->names[$id]], + ['id', $id, '!'] + ); + $saList = new AchievementList($conditions); + $pageData['page']['saData'] = $saList->getListviewData(); + $pageData['page']['saParams'] = array( + 'id' => 'see-also', + 'name' => '$LANG.tab_seealso', + 'visibleCols' => "$['category']" + ); + + $saList->addRewardsToJscript($pageData); + $saList->addGlobalsToJscript($pageData); + + // listview: "criteria of" + $refs = DB::Aowow()->SelectCol('SELECT refAchievement FROM ?_achievementcriteria WHERE Type = ?d AND value1 = ?d', + ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT, + $id + ); + if (!empty($refs)) + { + $coList = new AchievementList(array(['id', $refs])); + $pageData['page']['coData'] = $coList->getListviewData(); + $pageData['page']['coParams'] = array( + 'id' => 'criteria-of', + 'name' => '$LANG.tab_criteriaof', + 'visibleCols' => "$['category']" + ); + + $coList->addRewardsToJscript($pageData); + $coList->addGlobalsToJscript($pageData); + } + + // create rewards + $pageData['page']['titleReward'] = []; + $pageData['page']['itemReward'] = []; + $acv->addRewardsToJscript($pageData); + foreach ($pageData['page']['titleReward'] as $k => $v) + $pageData['page']['titleReward'][$k] = sprintf(Lang::$achievement['titleReward'], $k, trim(str_replace('%s', '', $v['name']))); + + // ***** + // ACHIEVEMENT CRITERIA + // ***** + + $pageData['page']['criteria'] = []; + $iconId = 1; + $tmp_arr = []; + $pageData['page']['icons'] = []; + $pageData['page']['total_criteria'] = count($acv->getCriteria()); + + $i = 0; // stupid uninitialized iterator..... + foreach ($acv->getCriteria() as $crt) + { + // hide hidden criteria for regular users (really do..?) + // if (($crt['complete_flags'] & ACHIEVEMENT_CRITERIA_FLAG_HIDDEN) && User::$perms > 0) + // continue; + + // alternative display option + $displayMoney = $crt['complete_flags'] & ACHIEVEMENT_CRITERIA_FLAG_MONEY_COUNTER; + + $crtName = Util::localizedString($crt, 'name'); + $tmp = array( + 'id' => $crt['id'], + 'name' => $crtName, + 'type' => $crt['type'], + ); + + switch ($crt['type']) + { + // link to npc + case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE: + case ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE: + $tmp['link'] = array( + 'href' => '?npc='.$crt['value1'], + 'text' => $crtName, + ); + $tmp['extra_text'] = Lang::$achievement['slain']; + break; + // link to area (by map) + case ACHIEVEMENT_CRITERIA_TYPE_WIN_BG: + case ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA: + case ACHIEVEMENT_CRITERIA_TYPE_PLAY_ARENA: + case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND: + case ACHIEVEMENT_CRITERIA_TYPE_DEATH_AT_MAP: + if ($zoneId = DB::Aowow()->selectCell('SELECT areatableID FROM ?_zones WHERE mapID = ? LIMIT 1', $crt['value1'])) + $tmp['link'] = array( + 'href' => '?zone='.$zoneId, + 'text' => $crtName, + ); + else + $tmp['extra_text'] = $crtName; + break; + // link to area + case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE: + case ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA: + $tmp['link'] = array( + 'href' => '?zone='.$crt['value1'], + 'text' => $crtName, + ); + break; + // link to skills + case ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL: + case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL: + case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS: + case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE: + $tmp['link'] = array( + 'href' => '?skill='.$crt['value1'], + 'text' => $crtName, + ); + break; + // link to class + case ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS: + $tmp['link'] = array( + 'href' => '?class='.$crt['value1'], + 'text' => $crtName, + ); + break; + // link to race + case ACHIEVEMENT_CRITERIA_TYPE_HK_RACE: + $tmp['link'] = array( + 'href' => '?race='.$crt['value1'], + 'text' => $crtName, + ); + break; + // link to title + case ACHIEVEMENT_CRITERIA_TYPE_EARNED_PVP_TITLE: + // todo: crosslink + break; + // link to achivement (/w icon) + case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT: + $tmp['link'] = array( + 'href' => '?achievement='.$crt['value1'], + 'text' => $crtName, + ); + $tmp['icon'] = $iconId; + $pageData['page']['icons'][] = array( + 'itr' => $iconId++, + 'type' => 'g_achievements', + 'id' => $crt['value1'], + ); + if ($crtAcv = new AchievementList(array(['id', $crt['value1']]))) + $crtAcv->addGlobalsToJscript($pageData); + break; + // link to quest + case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST: + $crtName = Quest::getName($crt['value1']); + $tmp['link'] = array( + 'href' => '?quest='.$crt['value1'], + 'text' => $crtName ? $crtName : $crtName, + ); + break; + // link to spell (/w icon) + case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET: + case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2: + case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL: + case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL: + case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2: + $crtSpl = new SpellList(array(['id', $crt['value1']])); + $crtSpl->addGlobalsToJscript($pageData); + $text = $crtName ? $crtName : $crtSpl->names[$crtSpl->id]; + $tmp['link'] = array( + 'href' => '?spell='.$crt['value1'], + 'text' => $text + ); + $tmp['icon'] = $iconId; + $pageData['page']['icons'][] = array( + 'itr' => $iconId++, + 'type' => 'g_spells', + 'id' => $crt['value1'], + ); + break; + // link to item (/w icon) + case ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM: + case ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM: + case ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM: + case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM: + $crtItm = new ItemList(array(['id', $crt['value1']])); + $crtItm->addGlobalsToJscript($pageData); + $text = $crtName ? $crtName : $crtItm->names[$crtItm->id]; + $tmp['link'] = array( + 'href' => '?item='.$crt['value1'], + 'text' => $text, + 'quality' => $crtItm->getField('Quality'), + 'count' => $crt['value2'], + ); + $tmp['icon'] = $iconId; + $pageData['page']['icons'][] = array( + 'itr' => $iconId++, + 'type' => 'g_items', + 'id' => $crt['value1'], + 'count' => $crt['value2'], + ); + break; + // link to faction (/w target reputation) + case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION: + $crtName = Faction::getName($crt['value1']); + $tmp['link'] = array( + 'href' => '?faction='.$crt['value1'], + 'text' => $crtName ? $crtName : $crtName, + ); + $tmp['extra_text'] = ' ('.Lang::getReputationLevelForPoints($crt['value2']).')'; + break; + // link to GObject + case ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT: + case ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT: + $tmp['link'] = array( + 'href' => '?object='.$crt['value1'], + 'text' => $crtName, + ); + break; + default: + $tmp['standard'] = true; + // Add a gold coin icon + $tmp['extra_text'] = $displayMoney ? Util::formatMoney($crt['value2']) : $crtName; + break; + } + // If the right column + if ($i++ % 2) + $tmp_arr[] = $tmp; + else + $pageData['page']['criteria'][] = $tmp; + + } + // If you found the second column - merge data from it to the end of the main body + if ($tmp_arr) + $pageData['page']['criteria'] = array_merge($pageData['page']['criteria'], $tmp_arr); + + // ***** + // ACHIEVEMENT CHAIN + // ***** + + if ($acv->getField('series')) + { + $pageData['page']['series'] = array( + array( + 'id' => $id, + 'name' => $acv->names[$id], + 'parent' => $acv->getField('series') >> 16, + ) + ); + $tmp = $pageData['page']['series'][0]; + while ($tmp) + { + $tmp = DB::Aowow()->selectRow('SELECT id, name_loc0, name_loc?d, series >> 16 AS parent FROM ?_achievement WHERE id = ?', + User::$localeId, + $pageData['page']['series'][0]['parent'] + ); + if ($tmp) + { + $tmp['name'] = Util::localizedString($tmp, 'name'); + array_unshift($pageData['page']['series'], $tmp); + } + } + $tmp = end($pageData['page']['series']); + while ($tmp) + { + $end = end($pageData['page']['series']); + $tmp = DB::Aowow()->selectRow('SELECT id, name_loc0, name_loc?d, series >> 16 AS parent FROM ?_achievement WHERE (series >> 16) = ?', + User::$localeId, + $end['id'] + ); + if ($tmp) + { + $tmp['name'] = Util::localizedString($tmp, 'name'); + array_push($pageData['page']['series'], $tmp); + } + } + } + + $smarty->saveCache($cacheKeyPage, $pageData); +} + +$announcements = DB::Aowow()->Select('SELECT * FROM ?_announcements WHERE flags & 0x10 AND (page = "achievement" OR page = "*")'); +foreach ($announcements as $k => $v) + $announcements[$k]['text'] = Util::localizedString($v, 'text'); + +$vars = array( + 'title' => implode(" - ", $pageData['title']), + 'path' => "[".implode(", ", $pageData['path'])."]",// menuId 9: Achievement (g_initPath) + 'tab' => 0, // tabId 0: Database for g_initHeader($tab) + 'type' => TYPE_ACHIEVEMENT, + 'typeId' => $id, +); + +$smarty->updatePageVars($vars); +$smarty->assign('community', CommunityContent::getAll(TYPE_ACHIEVEMENT, $id)); // comments, screenshots, videos +$smarty->assign('announcements', $announcements); +$smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$achievement)); +$smarty->assign('data', $pageData); + +// Mysql query execution statistics +$smarty->assign('mysql', DB::Aowow()->getStatistics()); + +// load the page +$smarty->display('achievement.tpl'); + +?> \ No newline at end of file diff --git a/pages/compare.php b/pages/compare.php index 10500ab0..000829e8 100644 --- a/pages/compare.php +++ b/pages/compare.php @@ -34,14 +34,14 @@ if ($compareString) // MATCH() AGAINST() for integers would be nice... $res = DB::Aowow()->SelectRow( - "SELECT Id FROM ?_itemset WHERE + "SELECT id FROM ?_itemset WHERE item1 = ? OR item2 = ? OR item3 = ? OR item4 = ? OR item5 = ? OR item6 = ? OR item7 = ? OR item8 = ? OR item9 = ? OR item10 = ?", (int)$params[0], (int)$params[0], (int)$params[0], (int)$params[0], (int)$params[0], (int)$params[0], (int)$params[0], (int)$params[0], (int)$params[0], (int)$params[0] ); if ($res) - $piecesAssoc[(int)$params[0]] = $res['Id']; + $piecesAssoc[(int)$params[0]] = $res['id']; } $outSet[] = "[".implode(',', $outString)."]"; } @@ -53,16 +53,16 @@ if ($compareString) $iList->extendJsonStats(); $stats = []; - foreach ($iList->json[$iList->Id] as $k => $v) + foreach ($iList->json[$iList->id] as $k => $v) $stats[] = is_numeric($v) || $v[0] == "{" ? '"'.$k.'":'.$v.'' : '"'.$k.'":"'.$v.'"'; - foreach ($iList->itemMods[$iList->Id] as $k => $v) + foreach ($iList->itemMods[$iList->id] as $k => $v) if ($v) $stats[] = '"'.Util::$itemMods[$k].'":'.$v; $pageData['items'][] = [ - $iList->Id, - Util::jsEscape($iList->names[$iList->Id]), + $iList->id, + Util::jsEscape($iList->names[$iList->id]), $iList->getField('Quality'), $iList->getField('icon'), "{".implode(",", $stats)."}" diff --git a/pages/item.php b/pages/item.php index 953dc72b..e3f813ac 100644 --- a/pages/item.php +++ b/pages/item.php @@ -58,10 +58,10 @@ if (isset($_GET['power'])) $item->renderTooltip($enh); $x .= '$WowheadPower.registerItem(\''.$itemString.'\', '.User::$localeId.", {\n"; - $x .= "\tname_".User::$localeString.": '".Util::jsEscape($item->names[$item->Id])."',\n"; + $x .= "\tname_".User::$localeString.": '".Util::jsEscape($item->names[$id])."',\n"; $x .= "\tquality: ".$item->getField('Quality').",\n"; $x .= "\ticon: '".Util::jsEscape($item->getField('icon'))."',\n"; - $x .= "\ttooltip_".User::$localeString.": '".Util::jsEscape($item->tooltip[$item->Id])."'\n"; + $x .= "\ttooltip_".User::$localeString.": '".Util::jsEscape($item->tooltip[$id])."'\n"; $x .= "});"; $smarty->saveCache($cacheKeyTooltip, $x); diff --git a/pages/spell.php b/pages/spell.php index 7e681b93..3804ea82 100644 --- a/pages/spell.php +++ b/pages/spell.php @@ -8,10 +8,10 @@ if (!defined('AOWOW_REVISION')) // require 'includes/allquests.php'; // require 'includes/class.community.php'; // not needed .. yet -$Id = intVal($pageParam); +$id = intVal($pageParam); -$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_SPELL, $Id, -1, User::$localeId]); -$cacheKeyTooltip = implode('_', [CACHETYPE_TOOLTIP, TYPE_SPELL, $Id, -1, User::$localeId]); +$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_SPELL, $id, -1, User::$localeId]); +$cacheKeyTooltip = implode('_', [CACHETYPE_TOOLTIP, TYPE_SPELL, $id, -1, User::$localeId]); if (isset($_GET['power'])) { @@ -21,19 +21,19 @@ if (isset($_GET['power'])) if (!$smarty->loadCache($cacheKeyTooltip, $x)) { - $spell = new SpellList(array(['Id', $Id])); + $spell = new SpellList(array(['id', $id])); if ($spell->error) - die('$WowheadPower.registerSpell('.$Id.', '.User::$localeId.', {});'); + die('$WowheadPower.registerSpell('.$id.', '.User::$localeId.', {});'); - $x = '$WowheadPower.registerSpell('.$Id.', '.User::$localeId.", {\n"; - if ($n = $spell->names[$Id]) + $x = '$WowheadPower.registerSpell('.$id.', '.User::$localeId.", {\n"; + if ($n = $spell->names[$id]) $x .= "\tname_".User::$localeString.": '".Util::jsEscape($n)."',\n"; if ($i = $spell->getField('iconString')) $x .= "\ticon: '".Util::jsEscape($i)."',\n"; - if ($t = $spell->renderTooltip($Id)) + if ($t = $spell->renderTooltip($id)) $x .= "\ttooltip_".User::$localeString.": '".Util::jsEscape($t)."'"; - if ($b = $spell->renderBuff($Id)) + if ($b = $spell->renderBuff($id)) $x .= ",\n\tbuff_".User::$localeString.": '".Util::jsEscape($b)."'\n"; $x .= '});'; @@ -44,17 +44,17 @@ if (isset($_GET['power'])) if (!$smarty->loadCache($cacheKeyPage, $pageData)) { - $spell = new SpellList(array(['Id', $Id])); + $spell = new SpellList(array(['id', $id])); // v there be dragons v // Spelldata - if ($spellObj = new SpellList(array(['Id', $Id]))) + if ($spellObj = new SpellList(array(['id', $id]))) { $row = $spellObj->template; // equivalent to 5 layers of panzertape // Номер спелла - $spell['entry'] = $row['Id']; + $spell['entry'] = $row['id']; // Имя спелла $spell['name'] = Util::localizedString($row, 'name'); // Иконка спелла @@ -148,14 +148,14 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $spell['effect'] = []; for ($j=1;$j<=3;$j++) { - if($row['effect'.$j.'Id'] > 0) + if($row['effect'.$j.'id'] > 0) { // Название эффекта - $spell['effect'][$i]['name'] = '('.$row['effect'.$j.'Id'].') '.Util::$spellEffectStrings[$row['effect'.$j.'Id']]; + $spell['effect'][$i]['name'] = '('.$row['effect'.$j.'id'].') '.Util::$spellEffectStrings[$row['effect'.$j.'id']]; // Доп информация в имени if($row['effect'.$j.'MiscValue']) { - switch ($row['effect'.$j.'Id']) + switch ($row['effect'.$j.'id']) { // Если эффект - создание обекта, создаем информацию о нём case 50: // "Summon Object" // 103 spells, OK @@ -199,7 +199,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) } } // Если просто урон школой - добавляем подпись школы - if($row['effect'.$j.'Id'] == 2 && $spell['school']) + if($row['effect'.$j.'id'] == 2 && $spell['school']) $spell['effect'][$i]['name'] .= ' ('.$spell['school'].')'; // Радиус действия эффекта if($row['effect'.$j.'RadiusMax']) @@ -233,7 +233,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) elseif($row['effect'.$j.'AuraId'] > 0) $spell['effect'][$i]['name'] .= ': Unknown Aura ('.$row['effect'.$j.'AuraId'].')'; // Создает вещь: - if($row['effect'.$j.'Id'] == 24) + if($row['effect'.$j.'id'] == 24) { $spell['effect'][$i]['item'] = []; $spell['effect'][$i]['item']['entry'] = $row['effect'.$j.'CreateItemId']; diff --git a/pages/title.php b/pages/title.php index ffd3a96d..b56e3997 100644 --- a/pages/title.php +++ b/pages/title.php @@ -6,18 +6,18 @@ if (!defined('AOWOW_REVISION')) require 'includes/class.community.php'; -$Id = intVal($pageParam); +$id = intVal($pageParam); -$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_TITLE, $Id, -1, User::$localeId]); +$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_TITLE, $id, -1, User::$localeId]); if (!$smarty->loadCache($cacheKeyPage, $pageData)) { - $title = new TitleList(array(['Id', $Id])); + $title = new TitleList(array(['id', $id])); if ($title->error) { $smarty->updatePageVars(array( 'subject' => ucfirst(Lang::$game['title']), - 'id' => $Id, + 'id' => $id, 'notFound' => sprintf(Lang::$main['pageNotFound'], Lang::$game['title']), )); $smarty->assign('lang', Lang::$main); @@ -46,19 +46,19 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $pageData = array( 'page' => array( 'name' => $title->getHtmlizedName(), - 'id' => $Id, + 'id' => $id, 'expansion' => Util::$expansionString[$title->getField('expansion')] ), 'infobox' => '[li][ul]'.implode('[/ul][ul]', $infobox).'[/ul][/li]', ); - foreach ($title->sources[$Id] as $type => $entries) + foreach ($title->sources[$id] as $type => $entries) { // todo: hidden-/visibleCols by actual use switch ($type) { case 4: - $quests = new QuestList(array(['Id', $entries])); + $quests = new QuestList(array(['id', $entries])); $quests->addRewardsToJscript($pageData); $pageData['page']['questReward'] = $quests->getListviewData(); @@ -70,7 +70,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) ); break; case 12: - $acvs = new AchievementList(array(['Id', $entries])); + $acvs = new AchievementList(array(['id', $entries])); $acvs->addGlobalsToJscript($pageData); $acvs->addRewardsToJscript($pageData); @@ -98,7 +98,7 @@ $smarty->updatePageVars(array( 'path' => $pageData['path'], 'tab' => 0, // for g_initHeader($tab) 'type' => TYPE_TITLE, // 11:Titles - 'typeId' => $Id + 'typeId' => $id )); @@ -107,7 +107,7 @@ $announcements = DB::Aowow()->Select('SELECT * FROM ?_announcements WHERE flags foreach ($announcements as $k => $v) $announcements[$k]['text'] = Util::localizedString($v, 'text'); -$smarty->assign('community', CommunityContent::getAll(TYPE_TITLE, $Id)); // comments, screenshots, videos +$smarty->assign('community', CommunityContent::getAll(TYPE_TITLE, $id)); // comments, screenshots, videos $smarty->assign('lang', array_merge(Lang::$main)); $smarty->assign('data', $pageData); $smarty->assign('mysql', DB::Aowow()->getStatistics()); diff --git a/search.php b/search.php index 341b80a4..c39cdf87 100644 --- a/search.php +++ b/search.php @@ -113,7 +113,7 @@ if ($searchMask & 0x1) if ($data = $classes->getListviewData()) { while ($classes->iterate()) - $data[$classes->Id]['param1'] = '"class_'.strToLower($classes->getField('fileString')).'"'; + $data[$classes->id]['param1'] = '"class_'.strToLower($classes->getField('fileString')).'"'; $found['class'] = array( 'type' => TYPE_CLASS, @@ -138,7 +138,7 @@ if ($searchMask & 0x2) if ($data = $races->getListviewData()) { while ($races->iterate()) - $data[$races->Id]['param1'] = '"race_'.strToLower($races->getField('fileString')).'_male"'; + $data[$races->id]['param1'] = '"race_'.strToLower($races->getField('fileString')).'_male"'; $found['race'] = array( 'type' => TYPE_RACE, @@ -212,7 +212,7 @@ if ($searchMask & 0x10) if ($data = $money->getListviewData()) { while ($money->iterate()) - $data[$money->Id]['param1'] = strToLower($money->getField('iconString')); + $data[$money->id]['param1'] = strToLower($money->getField('iconString')); $found['currency'] = array( 'type' => TYPE_CURRENCY, @@ -232,7 +232,7 @@ if ($searchMask & 0x20) if ($data = $sets->getListviewData()) { while ($sets->iterate()) - $data[$sets->Id]['param1'] = $sets->getField('quality'); + $data[$sets->id]['param1'] = $sets->getField('quality'); $found['itemset'] = array( 'type' => TYPE_ITEMSET, @@ -248,7 +248,7 @@ if ($searchMask & 0x20) if ($searchMask & 0x40) { if (($searchMask & SEARCH_TYPE_JSON) && $type == TYPE_ITEMSET && $found['itemset']['pieces']) - $conditions = [['i.class', [2, 4]], ['i.entry', $foundItems]]; + $conditions = [['i.class', [2, 4]], ['i.entry', $found['itemset']['pieces']]]; else $conditions = [[User::$localeId ? 'name_loc'.User::$localeId : 'name', $query], 0]; $items = new ItemList($conditions); @@ -258,8 +258,8 @@ if ($searchMask & 0x40) { while ($items->iterate()) { - $data[$items->Id]['param1'] = '"'.$items->getField('icon').'"'; - $data[$items->Id]['param2'] = $items->getField('Quality'); + $data[$items->id]['param1'] = '"'.$items->getField('icon').'"'; + $data[$items->id]['param2'] = $items->getField('Quality'); } $found['item'] = array( @@ -380,7 +380,7 @@ else if ($searchMask & SEARCH_TYPE_OPEN) break; $names[] = '"'.$data['name'].$set['appendix'].'"'; - $extra = [$set['type'], $data['Id']]; + $extra = [$set['type'], $data['id']]; if (isset($data['param1'])) $extra[] = $data['param1']; @@ -405,7 +405,7 @@ else /* if ($searchMask & SEARCH_TYPE_REGULAR) */ // // only one match -> redirect to find // if ($foundTotal == 1) // { - // header("Location: ?".Util::$typeStrings[$found[0]['type']].'='.$found[0]['data'][0]['Id']); + // header("Location: ?".Util::$typeStrings[$found[0]['type']].'='.$found[0]['data'][0]['id']); // die(); // } diff --git a/setup/tools/dataset-assembler/enchants.php b/setup/tools/dataset-assembler/enchants.php index 90fd45e3..ca7901bd 100644 --- a/setup/tools/dataset-assembler/enchants.php +++ b/setup/tools/dataset-assembler/enchants.php @@ -105,8 +105,8 @@ if (!defined('AOWOW_REVISION')) } // costy and locale-independant -> cache - if (!isset($jsonEnchants[$enchant['Id']])) - $jsonEnchants[$enchant['Id']] = Util::parseItemEnchantment($enchant); + if (!isset($jsonEnchants[$enchant['id']])) + $jsonEnchants[$enchant['id']] = Util::parseItemEnchantment($enchant); // defaults $ench = array( @@ -117,7 +117,7 @@ if (!defined('AOWOW_REVISION')) 'skill' => -1, // modified if skill 'slots' => [], // determied per spell but set per item 'enchantment' => Util::jsEscape(Util::localizedString($enchant, 'text')), - 'jsonequip' => $jsonEnchants[$enchant['Id']], + 'jsonequip' => $jsonEnchants[$enchant['id']], 'temp' => 0, // always 0 'classes' => 0, // modified by item ); @@ -132,23 +132,23 @@ if (!defined('AOWOW_REVISION')) $ench['jsonequip']['reqlevel'] = $enchant['requiredLevel']; // check if the spell has an entry in skill_line_ability -> Source:Profession - if ($skill = DB::Aowow()->SelectCell('SELECT skillId FROM ?_skill_line_ability WHERE spellId = ?d', $enchantSpells->Id)) + if ($skill = DB::Aowow()->SelectCell('SELECT skillId FROM ?_skill_line_ability WHERE spellId = ?d', $enchantSpells->id)) { - $ench['name'][] = Util::jsEscape($enchantSpells->names[$enchantSpells->Id])); - $ench['source'][] = $enchantSpells->Id; + $ench['name'][] = Util::jsEscape($enchantSpells->names[$enchantSpells->id])); + $ench['source'][] = $enchantSpells->id; $ench['skill'] = $skill; $ench['slots'][] = $slot; } // check if this item can be cast via item -> Source:Item - if (!isset($castItems[$enchantSpells->Id])) - $castItems[$enchantSpells->Id] = new ItemList([['spellid_1', $enchantSpells->Id], ['name', 'Scroll of Enchant%', '!']]); // do not reuse enchantment scrolls + if (!isset($castItems[$enchantSpells->id])) + $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 + $cI &= $castItems[$enchantSpells->id]; // this construct is a bit .. unwieldy while ($cI->iterate()) { - $ench['name'][] = Util::jsEscape($cI->names[$cI->Id]); - $ench['source'][] = -$cI->Id; + $ench['name'][] = Util::jsEscape($cI->names[$cI->id]); + $ench['source'][] = -$cI->id; $ench['icon'] = strTolower($cI->getField('icon')); $ench['slots'][] = $slot; @@ -171,33 +171,33 @@ if (!defined('AOWOW_REVISION')) continue; // everything gathered - if (isset($enchantsOut[$enchant['Id']])) // already found, append data + if (isset($enchantsOut[$enchant['id']])) // already found, append data { - foreach ($enchantsOut[$enchant['Id']] as $k => $v) + foreach ($enchantsOut[$enchant['id']] as $k => $v) { if (is_array($v)) { while ($pop = array_pop($ench[$k])) - $enchantsOut[$enchant['Id']][$k][] = $pop; + $enchantsOut[$enchant['id']][$k][] = $pop; } else { if ($k == 'quality') // quality:-1 if spells and items are mixed { - if ($enchantsOut[$enchant['Id']]['source'][0] > 0 && $ench['source'][0] < 0) - $enchantsOut[$enchant['Id']][$k] = -1; - else if ($enchantsOut[$enchant['Id']]['source'][0] < 0 && $ench['source'][0] > 0) - $enchantsOut[$enchant['Id']][$k] = -1; + if ($enchantsOut[$enchant['id']]['source'][0] > 0 && $ench['source'][0] < 0) + $enchantsOut[$enchant['id']][$k] = -1; + else if ($enchantsOut[$enchant['id']]['source'][0] < 0 && $ench['source'][0] > 0) + $enchantsOut[$enchant['id']][$k] = -1; else - $enchantsOut[$enchant['Id']][$k] = $ench[$k]; + $enchantsOut[$enchant['id']][$k] = $ench[$k]; } - else if ($enchantsOut[$enchant['Id']][$k] <= 0) - $enchantsOut[$enchant['Id']][$k] = $ench[$k]; + else if ($enchantsOut[$enchant['id']][$k] <= 0) + $enchantsOut[$enchant['id']][$k] = $ench[$k]; } } } else // nothing yet, create new - $enchantsOut[$enchant['Id']] = $ench; + $enchantsOut[$enchant['id']] = $ench; } // walk over each entry and strip single-item arrays diff --git a/setup/tools/dataset-assembler/glyphs.php b/setup/tools/dataset-assembler/glyphs.php index 0303c484..bb3e6a51 100644 --- a/setup/tools/dataset-assembler/glyphs.php +++ b/setup/tools/dataset-assembler/glyphs.php @@ -132,7 +132,7 @@ if (!defined('AOWOW_REVISION')) if ($pop['glyphEffect']) $glyphSpells[] = $pop['glyphEffect']; - $glyphSpells = new SpellList(array(['Id', $glyphSpells])); + $glyphSpells = new SpellList(array(['id', $glyphSpells])); foreach ($locales as $lId) { @@ -145,7 +145,7 @@ if (!defined('AOWOW_REVISION')) if (!$pop['glyphEffect']) continue; - while ($glyphSpells->Id != $pop['glyphEffect']) + while ($glyphSpells->id != $pop['glyphEffect']) $glyphSpells->iterate(); if ($glyphSpells->getField('effect1Id') != 6 && $glyphSpells->getField('effect2Id') != 6 && $glyphSpells->getField('effect3Id') != 6) @@ -193,7 +193,7 @@ if (!defined('AOWOW_REVISION')) $m2 = $glyphSpells->getField('effect2SpellClassMask'.$l[$i]); $m3 = $glyphSpells->getField('effect3SpellClassMask'.$l[$i]); - if ($glyphSpells->getField('effect'.$i.'Id') != 6 || (!$m1 && !$m2 && !$m3)) + if ($glyphSpells->getField('effect'.$i.'id') != 6 || (!$m1 && !$m2 && !$m3)) continue; $where = "SpellFamilyId = ?d AND ((SpellFamilyFlags3 & 0xFFFFFFFF) & ?d OR (SpellFamilyFlags2 & 0xFFFFFFFF) & ?d OR (SpellFamilyFlags1 & 0xFFFFFFFF) & ?d)"; diff --git a/setup/tools/dataset-assembler/itemsets.php b/setup/tools/dataset-assembler/itemsets.php index 08db7379..697e2fb7 100644 --- a/setup/tools/dataset-assembler/itemsets.php +++ b/setup/tools/dataset-assembler/itemsets.php @@ -113,7 +113,7 @@ if (!defined('AOWOW_REVISION')) // costy and locale-independant -> cache if (!isset($jsonBonus[$set['spell'.$i]])) { - $bSpell = new SpellList(array(['Id', $set['spell'.$i]])); + $bSpell = new SpellList(array(['id', $set['spell'.$i]])); $jsonBonus[$set['spell'.$i]] = $bSpell->getStatGain(); } diff --git a/setup/tools/dataset-assembler/talents.php b/setup/tools/dataset-assembler/talents.php index 7d151fd3..577274fb 100644 --- a/setup/tools/dataset-assembler/talents.php +++ b/setup/tools/dataset-assembler/talents.php @@ -114,7 +114,7 @@ if (!defined('AOWOW_REVISION')) for ($k = 0; $k <= ($m - 1); $k++) { - $tSpell = new SpellList(array(['Id', $talents[$j]['rank'.($k + 1)]])); + $tSpell = new SpellList(array(['id', $talents[$j]['rank'.($k + 1)]])); $d[] = $tSpell->parseText(); $s[] = $talents[$j]['rank'.($k + 1)]; diff --git a/template/bricks/announcement.tpl b/template/bricks/announcement.tpl index aa596534..e00d925f 100644 --- a/template/bricks/announcement.tpl +++ b/template/bricks/announcement.tpl @@ -1,5 +1,5 @@ {strip} - {math equation="abs(x)" x=$an.Id assign="pId"} + {math equation="abs(x)" x=$an.id assign="pId"} {math equation="(x & 0xF)" x=$an.flags assign="mode"} {math equation="(x & 0xF0) >> 4" x=$an.flags assign="status"} {math equation="(x & 0xF00) >> 8" x=$an.flags assign="jsVar"} @@ -8,7 +8,7 @@