From cbd27c67b32f7946f11b7069f7ef349852090abe Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Sun, 12 May 2013 23:56:51 +0200 Subject: [PATCH] Types: - added some more lasses for (for now) static use Achievements: - moved setup to separate file (not included yet (and shouldn't have been)) - unified use of the infobox.tpl Items: - Tooltip-layout changes, when used as standalone or incorporated in other tooltips. This can now be considered. Util: - added utf8-safe Util::ucFirst() - added Lang::getRequiredItems() for use with spell - equippedItem[Sub]Class Templates: - minor wording fix (link -> links) Markup: - [class=X], [race=X], [money=X] added (i really shouldn't have done this) - [color=X] now also accepts r1 - r4 as parameter obligatory minor stuff here and there --- includes/class.achievement.php | 119 --------------------------------- includes/class.charrace.php | 3 +- includes/class.creature.php | 38 +++++++++++ includes/class.gameobject.php | 38 +++++++++++ includes/class.item.php | 71 +++++++++++--------- includes/class.skill.php | 34 ++++++++++ includes/utilities.php | 50 +++++++++++++- pages/achievement.php | 16 ++--- pages/achievements.php | 8 +-- pages/classes.php | 2 +- pages/currencies.php | 2 +- pages/itemsets.php | 2 +- pages/pets.php | 2 +- pages/races.php | 2 +- pages/title.php | 17 +++-- pages/titles.php | 2 +- template/achievement.tpl | 4 +- template/achievements.tpl | 2 +- template/bricks/infobox.tpl | 10 ++- template/css/global.css | 9 ++- template/itemsets.tpl | 2 +- template/js/Mapper.js | 2 +- template/js/Markup.js | 48 +++++++++---- template/js/TalentCalc.js | 2 +- template/title.tpl | 2 +- 25 files changed, 282 insertions(+), 205 deletions(-) create mode 100644 includes/class.creature.php create mode 100644 includes/class.gameobject.php create mode 100644 includes/class.skill.php diff --git a/includes/class.achievement.php b/includes/class.achievement.php index 0609dc4c..ee92c8dc 100644 --- a/includes/class.achievement.php +++ b/includes/class.achievement.php @@ -259,125 +259,6 @@ class AchievementList extends BaseType return $data; } - - // run once .. should this even be here..? - public function setupAchievements() - { - set_time_limit(120); - - // add serverside achievements - DB::Aowow()->Query( - "INSERT IGNORE INTO - ?_achievement - SELECT - ID, - requiredFaction, - mapID, - 0, - 0, - 0, - points, - 0, - 0, - '', - flags, - count, - refAchievement, - '', - 0x10, - CONCAT('SERVERSIDE (', ID, ')'), - CONCAT('SERVERSIDE (', ID, ')'), - CONCAT('SERVERSIDE (', ID, ')'), - CONCAT('SERVERSIDE (', ID, ')'), - CONCAT('SERVERSIDE (', ID, ')'), - '', - '', - '', - '', - '', - '', - '', - '', - '', - '' - FROM - world.achievement_dbc" - ); - - while ($this->iterate()) - { - // set iconString - $icon = DB::Aowow()->SelectCell('SELECT iconname FROM ?_spellicons WHERE id = ?d', $this->curTpl['iconId']); - - // set parentCat - $parentCat = DB::Aowow()->SelectCell('SELECT parentCategory FROM ?_achievementcategory WHERE Id = ?d', $this->curTpl['category']); - - // series parent(16) << child(16) - $series = $this->curTpl['parent'] << 16; - $series |= DB::Aowow()->SelectCell('SELECT Id FROM ?_achievement WHERE parent = ?d', $acv->id); - - // set rewards - $rewardIds = []; - if ($rStr = $this->curTpl['reward_loc0']) - { - - // i can haz title? - if (stristr($rStr, 'title reward:') || stristr($rStr, 'title:')) - { - $rStr = explode(':', $rStr); // head-b-gone - $rStr = str_replace('The Grand' ,'Grand', $rStr); - $rStr = explode('.', $rStr[1]); // Crusader + Crap - $rStr = explode('/', $rStr[0]); // Matron & Patron - $rStr = explode(' or ', $rStr[0]); // Alliance & Horde - - $rewardIds[] = DB::Aowow()->SelectCell('SELECT -Id FROM ?_titles WHERE name_loc0 LIKE ?s', '%'.trim($rStr[0]).'%'); - if (isset($rStr[1])) - $rewardIds[] = DB::Aowow()->SelectCell('SELECT -Id FROM ?_titles WHERE name_loc0 LIKE ?s', '%'.trim($rStr[1]).'%'); - } - else if (stristr($rStr, 'reward:')) // i haz item - { - if (in_array($acv->id, [3656, 3478])) // Pilgrim - { - $rewardIds[] = -168; - $rewardIds[] = 44810; - } - else if (in_array($acv->id, [1681, 1682])) // Loremaster - { - $rewardIds[] = -125; - $rewardIds[] = 43300; - } - else - { - $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 - $rewardIds[] = 44738; // pet not in description - } - } - - } - else - continue; - - DB::Aowow()->Query( - 'UPDATE - ?_achievement - SET - rewardIds = ?s, - series = ?s, - parentCat = ?d, - iconString = ?s - WHERE - Id = ?d', - $series, - isset($rewardIds) ? implode(' ', $rewardIds) : '', - $parentCat, - $icon, - $acv->id - ); - } - } } ?> diff --git a/includes/class.charrace.php b/includes/class.charrace.php index 3777ae59..7a33215e 100644 --- a/includes/class.charrace.php +++ b/includes/class.charrace.php @@ -36,7 +36,8 @@ class CharRaceList extends BaseType if (!isset($refs['gRaces'])) $refs['gRaces'] = []; - $refs['gRaces'][$this->id] = Util::jsEscape($this->getField('name', true)); + while ($this->iterate()) + $refs['gRaces'][$this->id] = ['name' => $this->getField('name', true)]; } public function addRewardsToJScript(&$ref) { } diff --git a/includes/class.creature.php b/includes/class.creature.php new file mode 100644 index 00000000..a636c938 --- /dev/null +++ b/includes/class.creature.php @@ -0,0 +1,38 @@ +SelectRow(' + SELECT + name, + name_loc2, + name_loc3, + name_loc6, + name_loc8 + FROM + creature_template ct + LEFT JOIN + locales_creature lc + ON + lc.entry = ct.entry + WHERE + ct.entry = ?d', + $id + ); + return Util::localizedString($n, 'name'); + } + + public function getListviewData() { } + public function addGlobalsToJScript(&$refs) { } + public function addRewardsToJScript(&$refs) { } + public function renderTooltip() { } + +} + +?> diff --git a/includes/class.gameobject.php b/includes/class.gameobject.php new file mode 100644 index 00000000..05e50b12 --- /dev/null +++ b/includes/class.gameobject.php @@ -0,0 +1,38 @@ +SelectRow(' + SELECT + name, + name_loc2, + name_loc3, + name_loc6, + name_loc8 + FROM + gameobject_template gt + LEFT JOIN + locales_gameobject lg + ON + lg.entry = gt.entry + WHERE + gt.entry = ?d', + $id + ); + return Util::localizedString($n, 'name'); + } + + public function getListviewData() { } + public function addGlobalsToJScript(&$refs) { } + public function addRewardsToJScript(&$refs) { } + public function renderTooltip() { } + +} + +?> diff --git a/includes/class.item.php b/includes/class.item.php index e8457446..84a97270 100644 --- a/includes/class.item.php +++ b/includes/class.item.php @@ -14,7 +14,7 @@ class ItemList extends BaseType private $ssd = []; - 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] GROUP BY i.entry ORDER BY i.Quality DESC'; + 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, $pieceToSet = null) @@ -181,8 +181,9 @@ class ItemList extends BaseType gems: array (:-separated itemIds) rand: >0: randomPropId; <0: randomSuffixId interactive (set to place javascript/anchors to manipulate level and ratings or link to filters (static tooltips vs popup tooltip)) + subT (tabled layout doesn't work if used as sub-tooltip in other item or spell tooltips; use line-break instead) */ - public function renderTooltip($enhance = [], $interactive = false) + public function renderTooltip($enhance = [], $interactive = false, $subT = false) { if ($this->error) return; @@ -218,10 +219,14 @@ class ItemList extends BaseType $x = ''; // upper table: stats - $x .= '
'; + if (!$subT) + $x .= ''; + $x .= ''; else if ($this->curTpl['class'] == ITEM_CLASS_WEAPON) $x .= ''; else if ($this->curTpl['class'] == ITEM_CLASS_AMMUNITION) @@ -469,7 +474,7 @@ class ItemList extends BaseType if ($this->curTpl['socketBonus']) { $sbonus = DB::Aowow()->selectRow('SELECT * FROM ?_itemenchantment WHERE Id = ?d', $this->curTpl['socketBonus']); - $x .= ''.Lang::$item['socketBonus'].': '.Util::localizedString($sbonus, 'text').'
'; + $x .= ''.Lang::$item['socketBonus'].Lang::$colon.Util::localizedString($sbonus, 'text').'
'; } // durability @@ -478,15 +483,15 @@ class ItemList extends BaseType // required classes if ($classes = Lang::getClassString($this->curTpl['AllowableClass'])) - $x .= Lang::$game['classes'].': '.$classes.'
'; + $x .= Lang::$game['classes'].Lang::$colon.$classes.'
'; // required races if ($races = Lang::getRaceString($this->curTpl['AllowableRace'])) - $x .= Lang::$game['races'].': '.$races['name'].'
'; + $x .= Lang::$game['races'].Lang::$colon.$races['name'].'
'; // required honorRank (not used anymore) if ($this->curTpl['requiredhonorrank']) - $x .= Lang::$game['requires'].': '.Lang::$game['pvpRank'][$this->curTpl['requiredhonorrank']].'
'; + $x .= sprintf(Lang::$game['requires'], Lang::$game['pvpRank'][$this->curTpl['requiredhonorrank']]).'
'; // required CityRank..? // what the f.. @@ -503,19 +508,20 @@ class ItemList extends BaseType // required skill if ($this->curTpl['RequiredSkill']) { - $skillText = DB::Aowow()->selectRow('SELECT * FROM ?_skill WHERE skillID = ?d', $this->curTpl['RequiredSkill']); - $x .= '
'.Lang::$game['requires'].' '.Util::localizedString($skillText, 'name').''; + $_ = ''.SkillList::getName($this->curTpl['RequiredSkill']).''; if ($this->curTpl['RequiredSkillRank']) - $x .= ' ('.$this->curTpl['RequiredSkillRank'].')'; + $_ .= ' ('.$this->curTpl['RequiredSkillRank'].')'; + + $x .= '
'.sprintf(Lang::$game['requires'], $_); } // required spell if ($this->curTpl['requiredspell']) - $x .= '
'.Lang::$game['requires'].' '.SpellList::getName($this->curTpl['requiredspell']).''; + $x .= '
'.Lang::$game['requires2'].' '.SpellList::getName($this->curTpl['requiredspell']).''; // required reputation w/ faction if ($this->curTpl['RequiredReputationFaction']) - $x .= '
'.Lang::$game['requires'].' curTpl['RequiredReputationFaction'].'">'.Faction::getName($this->curTpl['RequiredReputationFaction']).' - '.Lang::$game['rep'][$this->curTpl['RequiredReputationRank']]; + $x .= '
'.sprintf(Lang::$game['requires'], 'curTpl['RequiredReputationFaction'].'">'.Faction::getName($this->curTpl['RequiredReputationFaction']).' - '.Lang::$game['rep'][$this->curTpl['RequiredReputationRank']]); // locked if ($this->curTpl['lockid']) @@ -534,13 +540,13 @@ class ItemList extends BaseType { if ($lock['type'.$j] == 1) // opened by item { - $l = Lang::$game['requires'].' '.Util::getItemName($lock['lockproperties'.$j]).''; + $l = sprintf(Lang::$game['requires'], ''.Util::getItemName($lock['lockproperties'.$j]).''); break; } else if ($lock['type'.$j] == 2) // opened by skill { $lockText = DB::Aowow()->selectRow('SELECT ?# FROM ?_locktype WHERE id = ?d', $lock['lockproperties'.$j]); - $l = Lang::$game['requires'].' '.Util::localizedString($lockText, 'name').' ('.$lock['requiredskill'.$j].')'; + $l = sprintf(Lang::$game['requires'], Util::localizedString($lockText, 'name').' ('.$lock['requiredskill'.$j].')'); break; } } @@ -548,7 +554,10 @@ class ItemList extends BaseType } // upper table: done - $x .= '
'; // name; quality - $x .= ''.$name.''; + if ($subT) + $x .= ''.$name.''; + else + $x .= ''.$name.''; // heroic tag if (($this->curTpl['Flags'] & ITEM_FLAG_HEROIC) && $this->curTpl['Quality'] == ITEM_QUALITY_EPIC) @@ -259,18 +264,18 @@ class ItemList extends BaseType else if ($this->curTpl['ItemLimitCategory']) { $limit = DB::Aowow()->selectRow("SELECT * FROM ?_itemlimitcategory WHERE id = ?", $this->curTpl['ItemLimitCategory']); - $x .= '
'.($limit['isGem'] ? Lang::$item['uniqueEquipped'] : Lang::$item['unique']).': '.Util::localizedString($limit, 'name').' ('.$limit['count'].')'; + $x .= '
'.($limit['isGem'] ? Lang::$item['uniqueEquipped'] : Lang::$item['unique']).Lang::$colon.Util::localizedString($limit, 'name').' ('.$limit['count'].')'; } // max duration if ($this->curTpl['duration'] > 0) - $x .= "
".Lang::$item['duration'] . ' '. Util::formatTime($this->curTpl['duration'] * 1000) . ($this->curTpl['duration'] < 0 ? ' ('.Lang::$game['realTime'].')' : null); + $x .= "
".Lang::$game['duration'] . ' '. Util::formatTime($this->curTpl['duration'] * 1000) . ($this->curTpl['duration'] < 0 ? ' ('.Lang::$game['realTime'].')' : null); // required holiday if ($this->curTpl['HolidayId']) { $hDay = DB::Aowow()->selectRow("SELECT * FROM ?_holidays WHERE id = ?", $this->curTpl['HolidayId']); - $x .= '
'.Lang::$game['requires'].' '.Util::localizedString($hDay, 'name').''; + $x .= '
'.sprintf(Lang::$game['requires'], ''.Util::localizedString($hDay, 'name').''); } // maxcount @@ -300,7 +305,7 @@ class ItemList extends BaseType // Subclass if ($this->curTpl['class'] == ITEM_CLASS_ARMOR && $this->curTpl['subclass'] > 0) - $x .= '
'.Lang::$item['armorSubclass'][$this->curTpl['subclass']].''.Lang::$item['armorSubClass'][$this->curTpl['subclass']].''.Lang::$item['weaponSubClass'][$this->curTpl['subclass']].'
'; + if (!$subT) + $x .= '
'; + else + $x .= '
'; // spells on item $itemSpellsAndTrigger = []; @@ -561,12 +570,13 @@ class ItemList extends BaseType $itemSpells = new SpellList(array(['s.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]] . ($interactive ? ''.$parsed.'' : $parsed); } - // lower table (ratings, spells, ect) - $x .= '
'; + if (!$subT) + $x .= '
'; + if (isset($green)) foreach ($green as $j => $bonus) if ($bonus) @@ -602,7 +612,7 @@ class ItemList extends BaseType if ($itemset['skillId']) // bonus requires skill to activate { $name = DB::Aowow()->selectRow('SELECT * FROM ?_skill WHERE skillId=?d', $itemset['skillId']); - $xSet .= '
'.Lang::$game['requires'].' '.Util::localizedString($name, 'name').''; + $xSet .= '
'.sprintf(Lang::$game['requires'], ''.Util::localizedString($name, 'name').''); if ($itemset['skillLevel']) $xSet .= ' ('.$itemset['skillLevel'].')'; @@ -672,9 +682,9 @@ class ItemList extends BaseType $xCraft = '

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

'; while ($reagents->iterate()) - $reqReag[] = ''.$reagents->names[$reagents->id].' ('.$reagentItems[$reagents->id].')'; + $reqReag[] = ''.$reagents->getField('name', true).' ('.$reagentItems[$reagents->id].')'; - $xCraft .= ''.Lang::$game['requires']." ".implode(", ", $reqReag).''; + $xCraft .= ''.Lang::$game['requires2']." ".implode(", ", $reqReag).''; } @@ -698,7 +708,7 @@ class ItemList extends BaseType $xMisc[] = ''.$this->curTpl['spellcharges_1'].' '.Lang::$item['charges'].''; if ($this->curTpl['SellPrice']) - $xMisc[] = ''.Lang::$item['sellPrice'].": ".Util::formatMoney($this->curTpl['SellPrice']).''; + $xMisc[] = ''.Lang::$item['sellPrice'].Lang::$colon.Util::formatMoney($this->curTpl['SellPrice']).''; // list required reagents if (isset($xCraft)) @@ -707,7 +717,8 @@ class ItemList extends BaseType if ($xMisc) $x .= implode('
', $xMisc); - $x .= '
'; + if (!$subT) + $x .= '
'; // heirloom tooltip scaling if (isset($this->ssd[$this->id])) @@ -747,7 +758,7 @@ class ItemList extends BaseType case INVTYPE_QUIVER: case INVTYPE_RELIC: return 0; - // Select point coefficient + // Select point coefficient case INVTYPE_HEAD: case INVTYPE_BODY: case INVTYPE_CHEST: @@ -796,7 +807,7 @@ class ItemList extends BaseType return $rpp['epic'.$suffixFactor]; case ITEM_QUALITY_LEGENDARY: case ITEM_QUALITY_ARTIFACT: - return 0; // not have random properties + return 0; // not have random properties default: break; } diff --git a/includes/class.skill.php b/includes/class.skill.php new file mode 100644 index 00000000..a22d3bda --- /dev/null +++ b/includes/class.skill.php @@ -0,0 +1,34 @@ +SelectRow(' + SELECT + name_loc0, + name_loc2, + name_loc3, + name_loc6, + name_loc8 + FROM + ?_skillLine + WHERE + id = ?d', + $id + ); + return Util::localizedString($n, 'name'); + } + + public function getListviewData() { } + public function addGlobalsToJScript(&$refs) { } + public function addRewardsToJScript(&$refs) { } + public function renderTooltip() { } + +} + +?> diff --git a/includes/utilities.php b/includes/utilities.php index 8114ca6a..c9b32068 100644 --- a/includes/utilities.php +++ b/includes/utilities.php @@ -99,7 +99,6 @@ abstract class BaseType $field = $resolveCondition($c[0], $supLink); else if ($c[0]) $field = '`'.implode('`.`', explode('.', Util::sqlEscape($c[0]))).'`'; - if (is_array($c[1])) { $val = implode(',', Util::sqlEscape($c[1])); @@ -366,6 +365,34 @@ class Lang return self::$game['rep'][REP_NEUTRAL]; } + public static function getRequiredItems($class, $mask, $short = true) + { + // not checking weapon / armor here. It's highly unlikely that they overlap + if ($short) + { + if ($class == 15) // misc - Mounts + return ''; + + if ($class == 4 && $mask == 0x001E) // all basic armor classes + return ''; + + foreach(Lang::$spell['subClassMasks'] as $m => $str) + if ($mask == $m) + return $str; + } + + if ($class == 15) // yeah hardcoded.. sue me! + return Lang::$spell['cat'][-5]; + + $tmp = []; + $strs = Lang::$spell[$class == 4 ? 'armorSubClass' : 'weaponSubClass']; + foreach ($strs as $k => $str) + if ($mask & 1 << $k && $str) + $tmp[] = $str; + + return implode(', ', $tmp); + } + public static function getStances($stanceMask) { $stanceMask &= 0xFC27909F; // clamp to available stances/forms.. @@ -535,7 +562,7 @@ class SmartyAoWoW extends Smarty public function notFound($subject) { $this->updatePageVars(array( - 'subject' => ucfirst($subject), + 'subject' => Util::ucFirst($subject), 'id' => intVal($this->_tpl_vars['query'][1]), 'notFound' => sprintf(Lang::$main['pageNotFound'], $subject), )); @@ -682,10 +709,17 @@ class Util public static $narrowResultString = 'sprintf(%s, %s, %s) + LANG.dash + LANG.lvnote_trynarrowing'; public static $setCriteriaString = "fi_setCriteria(%s, %s, %s);\n"; + public static $dfnString = '%s'; + public static $expansionString = array( // 3 & 4 unused .. obviously null, 'bc', 'wotlk', 'cata', 'mop' ); + public static $class2SpellFamily = array( + // null Warrior Paladin Hunter Rogue Priest DK Shaman Mage Warlock null Druid + null, 4, 10, 9, 8, 6, 15, 11, 3, 5, null, 7 + ); + // todo: translate and move to Lang public static $spellModOp = array( 0 => 'DAMAGE', @@ -940,7 +974,7 @@ class Util 152 => 'Unknown Effect', 153 => 'Create Tamed Pet', 154 => 'Discover Taxi', - 155 => 'Titan Grip', + 155 => 'Dual Wield 2H Weapons', 156 => 'Enchant Item Prismatic', 157 => 'Create Item 2', 158 => 'Milling', @@ -1662,6 +1696,16 @@ class Util return false; } + // default ucFirst doesn't convert UTF-8 chars + public static function ucFirst($str) + { + $len = mb_strlen($str, 'UTF-8') - 1; + $first = mb_substr($str, 0, 1, 'UTF-8'); + $rest = mb_substr($str, 1, $len, 'UTF-8'); + + return mb_strtoupper($first, 'UTF-8') . $rest; + } + // BaseType::_construct craaap! // todo: unify indizes public static function getIdFieldName($tpl) diff --git a/pages/achievement.php b/pages/achievement.php index 73498d90..64d3c254 100644 --- a/pages/achievement.php +++ b/pages/achievement.php @@ -57,7 +57,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $smarty->notFound(Lang::$achievement['achievement']); $pageData['path'] = []; - $pageData['title'] = [ucfirst(Lang::$achievement['achievement'])]; + $pageData['title'] = [Util::ucfirst(Lang::$achievement['achievement'])]; // create page title and path $curCat = $acv->getField('category'); @@ -80,18 +80,18 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) switch ($acv->getField('faction')) { case 0: - $pageData['page']['infoBox'][] = Lang::$main['side'].': '.Lang::$game['si'][SIDE_ALLIANCE].''; + $pageData['infoBox'][] = Lang::$main['side'].': '.Lang::$game['si'][SIDE_ALLIANCE].''; break; case 1: - $pageData['page']['infoBox'][] = Lang::$main['side'].': '.Lang::$game['si'][SIDE_HORDE].''; + $pageData['infoBox'][] = Lang::$main['side'].': '.Lang::$game['si'][SIDE_HORDE].''; break; default: // case 3 - $pageData['page']['infoBox'][] = Lang::$main['side'].': '.Lang::$game['si'][SIDE_BOTH]; + $pageData['infoBox'][] = Lang::$main['side'].': '.Lang::$game['si'][SIDE_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'))); + $pageData['infoBox'] = array_merge($pageData['infoBox'], Lang::getInfoBoxForFlags($acv->getField('cuFlags'))); // listview: "see also" $conditions = array( @@ -256,12 +256,12 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL: case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2: $crtSpl = new SpellList(array(['s.id', $obj])); - $crtSpl->addGlobalsToJscript($pageData); - $text = $crtName ? $crtName : $crtSpl->getField('name', true); + $text = !empty($crtName) ? $crtName : $crtSpl->getField('name', true); $tmp['link'] = array( 'href' => '?spell='.$obj, 'text' => $text ); + $crtSpl->addGlobalsToJscript($pageData); $tmp['icon'] = $iconId; $pageData['page']['icons'][] = array( 'itr' => $iconId++, @@ -275,7 +275,6 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) case ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM: case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM: $crtItm = new ItemList(array(['id', $obj])); - $crtItm->addGlobalsToJscript($pageData); $text = $crtName ? $crtName : $crtItm->getField('name', true); $tmp['link'] = array( 'href' => '?item='.$obj, @@ -283,6 +282,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) 'quality' => $crtItm->getField('Quality'), 'count' => $qty, ); + $crtItm->addGlobalsToJscript($pageData); $tmp['icon'] = $iconId; $pageData['page']['icons'][] = array( 'itr' => $iconId++, diff --git a/pages/achievements.php b/pages/achievements.php index 827cee89..bbd545e4 100644 --- a/pages/achievements.php +++ b/pages/achievements.php @@ -39,12 +39,11 @@ $validCats = array( if (!Util::isValidPage($validCats, $cats)) $smarty->error(); -if (!$smarty->loadCache($cacheKey, $pageData)) +if (!$smarty->loadCache($cacheKey, $pageData, $filter)) { // include child categories if current category is empty $condition = !$cats[0] ? null : (int)end($cats); $acvList = new AchievementList($condition ? [['category', $condition]] : [], true); - if (!$acvList->getMatches()) { $curCats = $catList = [$condition ? $condition : 0]; @@ -73,7 +72,7 @@ if (!$smarty->loadCache($cacheKey, $pageData)) $path[] = $cat['id']; $title[] = Util::localizedString($cat, 'name'); } - array_unshift($title, ucFirst(Lang::$achievement['achievements'])); + array_unshift($title, Util::ucFirst(Lang::$achievement['achievements'])); } // fill g_items, g_titles, g_achievements @@ -98,10 +97,9 @@ if (!$smarty->loadCache($cacheKey, $pageData)) if ($acvList->filterGetError()) $pageData['params']['_errors'] = '$1'; - $smarty->saveCache($cacheKey, $pageData); + $smarty->saveCache($cacheKey, $pageData, $filter); } - $page = array( 'tab' => 0, // for g_initHeader($tab) 'subCat' => $pageParam ? '='.$pageParam : '', diff --git a/pages/classes.php b/pages/classes.php index 275eaa82..59821a22 100644 --- a/pages/classes.php +++ b/pages/classes.php @@ -24,7 +24,7 @@ if (!$smarty->loadCache($cacheKey, $pageData)) $page = array( 'tab' => 0, // for g_initHeader($tab) - 'title' => ucFirst(Lang::$game['classes']), + 'title' => Util::ucFirst(Lang::$game['classes']), 'path' => "[0, 12]", ); diff --git a/pages/currencies.php b/pages/currencies.php index b84de3f6..fef33b79 100644 --- a/pages/currencies.php +++ b/pages/currencies.php @@ -7,7 +7,7 @@ if (!defined('AOWOW_REVISION')) $cat = Util::extractURLParams($pageParam)[0]; $path = [0, 15]; $validCats = [1, 2, 3, 22]; -$title = [ucFirst(Lang::$game['currencies'])]; +$title = [Util::ucFirst(Lang::$game['currencies'])]; $cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_CURRENCY, -1, isset($cat) ? $cat : -1, User::$localeId]); if ($cat !== null && !in_array($cat, $validCats)) diff --git a/pages/itemsets.php b/pages/itemsets.php index 992d5da1..84b17067 100644 --- a/pages/itemsets.php +++ b/pages/itemsets.php @@ -46,7 +46,7 @@ if (!$smarty->loadCache($cacheKey, $pageData)) $page = array( 'tab' => 0, // for g_initHeader($tab) 'subCat' => $pageParam ? '='.$pageParam : '', - 'title' => ucFirst(Lang::$game['itemsets']), + 'title' => Util::ucFirst(Lang::$game['itemsets']), 'path' => json_encode($path, JSON_NUMERIC_CHECK), 'reqJS' => array( array('path' => 'template/js/filters.js', 'conditional' => false), diff --git a/pages/pets.php b/pages/pets.php index b96586f1..9b593797 100644 --- a/pages/pets.php +++ b/pages/pets.php @@ -7,7 +7,7 @@ if (!defined('AOWOW_REVISION')) $cat = Util::extractURLParams($pageParam)[0]; $path = [0, 8]; $validCats = [0, 1, 2]; -$title = [ucFirst(Lang::$game['pets'])]; +$title = [Util::ucFirst(Lang::$game['pets'])]; $cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_PET, -1, isset($cat) ? $cat : -1, User::$localeId]); if (!in_array($cat, $validCats)) diff --git a/pages/races.php b/pages/races.php index 891ea837..97499477 100644 --- a/pages/races.php +++ b/pages/races.php @@ -24,7 +24,7 @@ if (!$smarty->loadCache($cacheKey, $pageData)) $page = array( 'tab' => 0, // for g_initHeader($tab) - 'title' => ucFirst(Lang::$game['races']), + 'title' => Util::ucFirst(Lang::$game['races']), 'path' => "[0, 13]", ); diff --git a/pages/title.php b/pages/title.php index 6c4d4f1d..037151b9 100644 --- a/pages/title.php +++ b/pages/title.php @@ -20,20 +20,19 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $title->reset(); $infobox = []; - $colon = User::$localeId == LOCALE_FR ? ' : ' : ': '; // Je suis un prick! <_< if ($title->getField('side') == SIDE_ALLIANCE) - $infobox[] = Lang::$main['side'].$colon.'[span class=alliance-icon]'.Lang::$game['si'][SIDE_ALLIANCE].'[/span]'; + $infobox[] = Lang::$main['side'].Lang::$colon.'[span class=alliance-icon]'.Lang::$game['si'][SIDE_ALLIANCE].'[/span]'; else if ($title->getField('side') == SIDE_HORDE) - $infobox[] = Lang::$main['side'].$colon.'[span class=horde-icon]'.Lang::$game['si'][SIDE_HORDE].'[/span]'; + $infobox[] = Lang::$main['side'].Lang::$colon.'[span class=horde-icon]'.Lang::$game['si'][SIDE_HORDE].'[/span]'; else - $infobox[] = Lang::$main['side'].$colon.Lang::$game['si'][SIDE_BOTH]; + $infobox[] = Lang::$main['side'].Lang::$colon.Lang::$game['si'][SIDE_BOTH]; if ($g = $title->getField('gender')) - $infobox[] = Lang::$main['gender'].$colon.'[span class='.($g == 2 ? 'female' : 'male').'-icon]'.Lang::$main['sex'][$g].'[/span]'; + $infobox[] = Lang::$main['gender'].Lang::$colon.'[span class='.($g == 2 ? 'female' : 'male').'-icon]'.Lang::$main['sex'][$g].'[/span]'; if ($e = $title->getField('eventId')) - $infobox[] = Lang::$game['eventShort'].$colon.'[url=?event='.$e.']'.WorldEvent::getName($e).'[/url]'; + $infobox[] = Lang::$game['eventShort'].Lang::$colon.'[url=?event='.$e.']'.WorldEvent::getName($e).'[/url]'; $pageData = array( 'page' => array( @@ -41,7 +40,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) 'id' => $id, 'expansion' => Util::$expansionString[$title->getField('expansion')] ), - 'infobox' => '[li][ul]'.implode('[/ul][ul]', $infobox).'[/ul][/li]', + 'infobox' => '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]', ); if (!empty($title->sources[$id])) @@ -81,14 +80,14 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) } } - $pageData['title'] = ucFirst(trim(str_replace('%s', '', str_replace(',', '', $title->getField('male', true))))); + $pageData['title'] = Util::ucFirst(trim(str_replace('%s', '', str_replace(',', '', $title->getField('male', true))))); $pageData['path'] = '[0, 10, '.$title->getField('category').']'; $smarty->saveCache($cacheKeyPage, $pageData); } $smarty->updatePageVars(array( - 'title' => $pageData['title']." - ".ucfirst(Lang::$game['title']), + 'title' => $pageData['title']." - ".Util::ucfirst(Lang::$game['title']), 'path' => $pageData['path'], 'tab' => 0, // for g_initHeader($tab) 'type' => TYPE_TITLE, // 11:Titles diff --git a/pages/titles.php b/pages/titles.php index e3a4287b..5925aa96 100644 --- a/pages/titles.php +++ b/pages/titles.php @@ -7,7 +7,7 @@ if (!defined('AOWOW_REVISION')) $cat = Util::extractURLParams($pageParam)[0]; $path = [0, 10]; $validCats = [0, 1, 2, 3, 4, 5, 6]; -$title = [ucFirst(Lang::$game['titles'])]; +$title = [Util::ucFirst(Lang::$game['titles'])]; $cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_TITLE, -1, isset($cat) ? $cat : -1, User::$localeId]); if (!in_array($cat, $validCats)) diff --git a/template/achievement.tpl b/template/achievement.tpl index e04e16e8..58fffe09 100644 --- a/template/achievement.tpl +++ b/template/achievement.tpl @@ -19,7 +19,7 @@