From 54695a9490f41bd565f0f59c098af0786b6c0a41 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Sat, 11 Jul 2015 15:17:34 +0200 Subject: [PATCH] Currency * expanded tooltips * moved cap from hardcoded to DB * can now set description (manually) Itemset * expanded tooltips Lang * number formating is now locale-aware --- includes/types/achievement.class.php | 2 +- includes/types/currency.class.php | 20 +++++- includes/types/item.class.php | 14 ++-- includes/types/itemset.class.php | 72 ++++++++++++++++++++- includes/types/spell.class.php | 2 +- includes/utilities.php | 2 +- localization/lang.class.php | 14 ++++ pages/currency.php | 53 +++++++++++++-- pages/itemset.php | 79 +++++++++++------------ pages/npc.php | 25 ++++--- pages/user.php | 2 +- setup/db_structure.sql | 1 + setup/tools/filegen/templates/power.js.in | 47 ++++++++++---- setup/tools/sqlgen/currencies.func.php | 4 +- setup/updates/1436619600_01.sql | 5 ++ static/css/basic.css | 25 +++---- 16 files changed, 271 insertions(+), 96 deletions(-) create mode 100644 setup/updates/1436619600_01.sql diff --git a/includes/types/achievement.class.php b/includes/types/achievement.class.php index 3a2c1224..24e49d37 100644 --- a/includes/types/achievement.class.php +++ b/includes/types/achievement.class.php @@ -207,7 +207,7 @@ class AchievementList extends BaseType } if ($crt['completionFlags'] & ACHIEVEMENT_CRITERIA_FLAG_MONEY_COUNTER) - $criteria .= '- '.Util::jsEscape($crtName).' '.number_format($crt['value2' ] / 10000).'
'; + $criteria .= '- '.Util::jsEscape($crtName).' '.Lang::nf($crt['value2' ] / 10000).'
'; else $criteria .= '- '.Util::jsEscape($crtName).'
'; diff --git a/includes/types/currency.class.php b/includes/types/currency.class.php index 8b219883..39700278 100644 --- a/includes/types/currency.class.php +++ b/includes/types/currency.class.php @@ -52,7 +52,25 @@ class CurrencyList extends BaseType return $data; } - public function renderTooltip() { } + public function renderTooltip() + { + if (!$this->curTpl) + return array(); + + $x = '
'; + $x .= ''.Util::jsEscape($this->getField('name', true)).'
'; + + // cata+ (or go fill it by hand) + if ($_ = $this->getField('description', true)) + $x .= '
'.Util::jsEscape($_).'
'; + + if ($_ = $this->getField('cap')) + $x .= '
'.Lang::currency('cap').Lang::main('colon').''.Lang::nf($_).'
'; + + $x .= '
'; + + return $x; + } } ?> diff --git a/includes/types/item.class.php b/includes/types/item.class.php index 768fe6a5..94bc4fdb 100644 --- a/includes/types/item.class.php +++ b/includes/types/item.class.php @@ -594,14 +594,14 @@ class ItemList extends BaseType $dps = $speed ? ($dmgmin1 + $dmgmax1) / (2 * $speed) : 0; if ($_class == ITEM_CLASS_AMMUNITION && $dmgmin1 && $dmgmax1) - $x .= Lang::item('addsDps').' '.number_format(($dmgmin1 + $dmgmax1) / 2, 1).' '.Lang::item('dps2').'
'; + $x .= Lang::item('addsDps').' '.Lang::nf(($dmgmin1 + $dmgmax1) / 2, 1).' '.Lang::item('dps2').'
'; else if ($dps) { if ($_class == ITEM_CLASS_WEAPON) { $x .= ''; $x .= ''; - $x .= ''; + $x .= ''; $x .= '
'.sprintf($this->curTpl['dmgType1'] ? Lang::item('damageMagic') : Lang::item('damagePhys'), $this->curTpl['dmgMin1'].' - '.$this->curTpl['dmgMax1'], Lang::game('sc', $this->curTpl['dmgType1'])).''.Lang::item('speed').' '.number_format($speed, 2).''.Lang::item('speed').' '.Lang::nf($speed, 2).'
'; } else @@ -612,7 +612,7 @@ class ItemList extends BaseType $x .= '+'.sprintf($this->curTpl['dmgType2'] ? Lang::item('damageMagic') : Lang::item('damagePhys'), $this->curTpl['dmgMin2'].' - '.$this->curTpl['dmgMax2'], Lang::game('sc', $this->curTpl['dmgType2'])).'
'; if ($_class == ITEM_CLASS_WEAPON) - $x .= '('.number_format($dps, 1).' '.Lang::item('dps').')
'; + $x .= '('.Lang::nf($dps, 1).' '.Lang::item('dps').')
'; // display FeralAttackPower if set if ($fap = $this->getFeralAP()) @@ -1363,8 +1363,8 @@ class ItemList extends BaseType if ($extraDPS = $this->getSSDMod('dps')) // dmg_x2 not used for heirlooms { $average = $extraDPS * $this->curTpl['delay'] / 1000; - $this->templates[$this->id]['dmgMin1'] = number_format(0.7 * $average); - $this->templates[$this->id]['dmgMax1'] = number_format(1.3 * $average); + $this->templates[$this->id]['dmgMin1'] = Lang::nf(0.7 * $average); + $this->templates[$this->id]['dmgMax1'] = Lang::nf(1.3 * $average); } // apply Spell Power from ScalingStatValue if set @@ -1520,8 +1520,8 @@ class ItemList extends BaseType $json['dmgtype1'] = $this->curTpl['dmgType1']; $json['dmgmin1'] = $this->curTpl['dmgMin1'] + $this->curTpl['dmgMin2']; $json['dmgmax1'] = $this->curTpl['dmgMax1'] + $this->curTpl['dmgMax2']; - $json['speed'] = number_format($this->curTpl['delay'] / 1000, 2); - $json['dps'] = !floatVal($json['speed']) ? 0 : number_format(($json['dmgmin1'] + $json['dmgmax1']) / (2 * $json['speed']), 1); + $json['speed'] = Lang::nf($this->curTpl['delay'] / 1000, 2); + $json['dps'] = !floatVal($json['speed']) ? 0 : Lang::nf(($json['dmgmin1'] + $json['dmgmax1']) / (2 * $json['speed']), 1); if (in_array($json['subclass'], [2, 3, 18, 19])) { diff --git a/includes/types/itemset.class.php b/includes/types/itemset.class.php index 3c9cf520..25deb811 100644 --- a/includes/types/itemset.class.php +++ b/includes/types/itemset.class.php @@ -88,7 +88,77 @@ class ItemsetList extends BaseType return $data; } - public function renderTooltip() { } + public function renderTooltip() + { + if (!$this->curTpl) + return array(); + + $x = '
'; + $x .= ''.Util::jsEscape($this->getField('name', true)).'
'; + + $nClasses = 0; + if ($_ = $this->getField('classMask')) + { + $cl = Lang::getClassString($_, $__, $nClasses); + $x .= Util::ucFirst($nClasses > 1 ? Lang::game('classes') : Lang::game('class')).Lang::main('colon').$cl.'
'; + } + + if ($_ = $this->getField('contentGroup')) + $x .= Util::jsEscape(Lang::itemset('notes', $_)).($this->getField('heroic') ? ' ('.Lang::item('heroic').')' : '').'
'; + + if (!$nClasses || !$this->getField('contentGroup')) + $x.= Lang::itemset('types', $this->getField('type')).'
'; + + if ($bonuses = $this->getBonuses()) + { + $x .= ''; + + foreach ($bonuses as $b) + $x .= '
'.$b['bonus'].' '.Lang::itemset('_pieces').Lang::main('colon').''.Util::jsEscape($b['desc']); + + $x .= '
'; + } + + $x .= '
'; + + return $x; + } + + public function getBonuses() + { + $spells = []; + for ($i = 1; $i < 9; $i++) + { + $spl = $this->getField('spell'.$i); + $qty = $this->getField('bonus'.$i); + + // cant use spell as index, would change order + if ($spl && $qty) + $spells[] = ['id' => $spl, 'bonus' => $qty]; + } + + // sort by required pieces ASC + usort($spells, function($a, $b) { + if ($a['bonus'] == $b['bonus']) + return 0; + + return ($a['bonus'] > $b['bonus']) ? 1 : -1; + }); + + $setSpells = new SpellList(array(['s.id', array_column($spells, 'id')])); + foreach ($setSpells->iterate() as $spellId => $__) + { + foreach ($spells as &$s) + { + if ($spellId != $s['id']) + continue; + + $s['desc'] = $setSpells->parseText('description', $this->getField('reqLevel') ?: MAX_LEVEL)[0]; + } + } + + return $spells; + } } diff --git a/includes/types/spell.class.php b/includes/types/spell.class.php index 4ede269f..8164bdb0 100644 --- a/includes/types/spell.class.php +++ b/includes/types/spell.class.php @@ -1174,7 +1174,7 @@ class SpellList extends BaseType // step 3: try to evaluate result $evaled = $this->resolveEvaluation($str); - $return = is_numeric($evaled) ? number_format($evaled, $precision, '.', '') : $evaled; + $return = is_numeric($evaled) ? Lang::nf($evaled, $precision) : $evaled; return $return.$suffix; } diff --git a/includes/utilities.php b/includes/utilities.php index 8b162347..ac0d24a0 100644 --- a/includes/utilities.php +++ b/includes/utilities.php @@ -1066,7 +1066,7 @@ class Util else $c = 2 / 52; - $result = number_format($val / Util::$gtCombatRatings[$type] / $c, 2); + $result = Lang::nf($val / Util::$gtCombatRatings[$type] / $c, 2); } if (!in_array($type, array(ITEM_MOD_DEFENSE_SKILL_RATING, ITEM_MOD_EXPERTISE_RATING))) diff --git a/localization/lang.class.php b/localization/lang.class.php index 5f775d37..1fb2ba66 100644 --- a/localization/lang.class.php +++ b/localization/lang.class.php @@ -322,6 +322,20 @@ class Lang return implode(', ', $tmp); } + + public static function nf($number, $decimals = 0) + { + // [decimal, thousand] + $seps = array( + LOCALE_EN => [',', '.'], + LOCALE_FR => [' ', ','], + LOCALE_DE => ['.', ','], + LOCALE_ES => ['.', ','], + LOCALE_RU => [' ', ','] + ); + + return number_format($number, $decimals, $seps[User::$localeId][1], $seps[User::$localeId][0]); + } } ?> \ No newline at end of file diff --git a/pages/currency.php b/pages/currency.php index 270c5d4b..fcc6706d 100644 --- a/pages/currency.php +++ b/pages/currency.php @@ -21,6 +21,10 @@ class CurrencyPage extends GenericPage { parent::__construct($pageCall, $id); + // temp locale + if ($this->mode == CACHE_TYPE_TOOLTIP && isset($_GET['domain'])) + Util::powerUseLocale($_GET['domain']); + $this->typeId = intVal($id); $this->subject = new CurrencyList(array(['id', $this->typeId])); @@ -52,10 +56,8 @@ class CurrencyPage extends GenericPage $infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags')); - if ($this->typeId == 103) // Arena Points - $infobox[] = Lang::currency('cap').Lang::main('colon').'10\'000'; - else if ($this->typeId == 104) // Honor - $infobox[] = Lang::currency('cap').Lang::main('colon').'75\'000'; + if ($_ = $this->subject->getField('cap')) + $infobox[] = Lang::currency('cap').Lang::main('colon').Lang::nf($_); /****************/ /* Main Content */ @@ -69,6 +71,9 @@ class CurrencyPage extends GenericPage BUTTON_LINKS => true ); + if ($_ = $this->subject->getField('description', true)) + $this->extraText = $_; + /**************/ /* Extra Tabs */ /**************/ @@ -224,6 +229,46 @@ class CurrencyPage extends GenericPage } } } + + protected function generateTooltip($asError = false) + { + if ($asError) + return '$WowheadPower.registerCurrency('.$this->typeId.', '.User::$localeId.', {});'; + + $x = '$WowheadPower.registerCurrency('.$this->typeId.', '.User::$localeId.", {\n"; + $x .= "\tname_".User::$localeString.": '".Util::jsEscape($this->subject->getField('name', true))."',\n"; + $x .= "\ticon: '".urlencode($this->subject->getField('iconString'))."',\n"; + $x .= "\ttooltip_".User::$localeString.": '".$this->subject->renderTooltip()."'\n"; + $x .= "});"; + + return $x; + } + + public function display($override = '') + { + if ($this->mode != CACHE_TYPE_TOOLTIP) + return parent::display($override); + + if (!$this->loadCache($tt)) + { + $tt = $this->generateTooltip(); + $this->saveCache($tt); + } + + header('Content-type: application/x-javascript; charset=utf-8'); + die($tt); + } + + public function notFound() + { + if ($this->mode != CACHE_TYPE_TOOLTIP) + return parent::notFound(Lang::game('currency'), Lang::currency('notFound')); + + header('Content-type: application/x-javascript; charset=utf-8'); + echo $this->generateTooltip(true); + exit(); + } + } ?> diff --git a/pages/itemset.php b/pages/itemset.php index 3d5ae9b7..e8983424 100644 --- a/pages/itemset.php +++ b/pages/itemset.php @@ -144,45 +144,6 @@ class ItemsetPage extends GenericPage ); } - // spells - $foo = []; - $spells = []; - for ($i = 1; $i < 9; $i++) - { - $spl = $this->subject->getField('spell'.$i); - $qty = $this->subject->getField('bonus'.$i); - - if ($spl && $qty) - { - $foo[] = $spl; - $spells[] = array( // cant use spell as index, would change order - 'id' => $spl, - 'bonus' => $qty, - 'desc' => '' - ); - } - } - - // sort by required pieces ASC - usort($spells, function($a, $b) { - if ($a['bonus'] == $b['bonus']) - return 0; - - return ($a['bonus'] > $b['bonus']) ? 1 : -1; - }); - - $setSpells = new SpellList(array(['s.id', $foo])); - foreach ($setSpells->iterate() as $spellId => $__) - { - foreach ($spells as &$s) - { - if ($spellId != $s['id']) - continue; - - $s['desc'] = $setSpells->parseText('description')[0]; - } - } - $skill = ''; if ($_sk = $this->subject->getField('skillId')) { @@ -195,7 +156,7 @@ class ItemsetPage extends GenericPage $this->unavailable = $this->subject->getField('cuFlags') & CUSTOM_UNAVAILABLE; $this->infobox = $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null; $this->pieces = $pieces; - $this->spells = $spells; + $this->spells = $this->subject->getBonuses(); $this->expansion = 0; $this->redButtons = array( BUTTON_WOWHEAD => $this->typeId > 0, // bool only @@ -266,6 +227,44 @@ class ItemsetPage extends GenericPage } } } + + protected function generateTooltip($asError = false) + { + if ($asError) + return '$WowheadPower.registerItemSet('.$this->typeId.', '.User::$localeId.', {});'; + + $x = '$WowheadPower.registerItemSet('.$this->typeId.', '.User::$localeId.", {\n"; + $x .= "\tname_".User::$localeString.": '".Util::jsEscape($this->subject->getField('name', true))."',\n"; + $x .= "\ttooltip_".User::$localeString.": '".$this->subject->renderTooltip()."'\n"; + $x .= "});"; + + return $x; + } + + public function display($override = '') + { + if ($this->mode != CACHE_TYPE_TOOLTIP) + return parent::display($override); + + if (!$this->loadCache($tt)) + { + $tt = $this->generateTooltip(); + $this->saveCache($tt); + } + + header('Content-type: application/x-javascript; charset=utf-8'); + die($tt); + } + + public function notFound() + { + if ($this->mode != CACHE_TYPE_TOOLTIP) + return parent::notFound(Lang::game('itemset'), Lang::itemset('notFound')); + + header('Content-type: application/x-javascript; charset=utf-8'); + echo $this->generateTooltip(true); + exit(); + } } diff --git a/pages/npc.php b/pages/npc.php index 6489b5de..566ec361 100644 --- a/pages/npc.php +++ b/pages/npc.php @@ -227,33 +227,32 @@ class NpcPage extends GenericPage } // > Stats - $_nf = function ($num) { return number_format($num, 0, '', '.'); }; $stats = []; $modes = []; // get difficulty versions if set $hint = '[tooltip name=%3$s][table cellspacing=10][tr]%1s[/tr][/table][/tooltip][span class=tip tooltip=%3$s]%2s[/span]'; $modeRow = '[tr][td]%s  [/td][td]%s[/td][/tr]'; // Health $health = $this->subject->getBaseStats('health'); - $stats['health'] = Util::ucFirst(Lang::spell('powerTypes', -2)).Lang::main('colon').($health[0] < $health[1] ? $_nf($health[0]).' - '.$_nf($health[1]) : $_nf($health[0])); + $stats['health'] = Util::ucFirst(Lang::spell('powerTypes', -2)).Lang::main('colon').($health[0] < $health[1] ? Lang::nf($health[0]).' - '.Lang::nf($health[1]) : Lang::nf($health[0])); // Mana (may be 0) $mana = $this->subject->getBaseStats('power'); - $stats['mana'] = $mana[0] ? Lang::spell('powerTypes', 0).Lang::main('colon').($mana[0] < $mana[1] ? $_nf($mana[0]).' - '.$_nf($mana[1]) : $_nf($mana[0])) : null; + $stats['mana'] = $mana[0] ? Lang::spell('powerTypes', 0).Lang::main('colon').($mana[0] < $mana[1] ? Lang::nf($mana[0]).' - '.Lang::nf($mana[1]) : Lang::nf($mana[0])) : null; // Armor $armor = $this->subject->getBaseStats('armor'); - $stats['armor'] = Lang::npc('armor').Lang::main('colon').($armor[0] < $armor[1] ? $_nf($armor[0]).' - '.$_nf($armor[1]) : $_nf($armor[0])); + $stats['armor'] = Lang::npc('armor').Lang::main('colon').($armor[0] < $armor[1] ? Lang::nf($armor[0]).' - '.Lang::nf($armor[1]) : Lang::nf($armor[0])); // Melee Damage $melee = $this->subject->getBaseStats('melee'); if ($_ = $this->subject->getField('dmgSchool')) // magic damage - $stats['melee'] = Lang::npc('melee').Lang::main('colon').$_nf($melee[0]).' - '.$_nf($melee[1]).' ('.Lang::game('sc', $_).')'; + $stats['melee'] = Lang::npc('melee').Lang::main('colon').Lang::nf($melee[0]).' - '.Lang::nf($melee[1]).' ('.Lang::game('sc', $_).')'; else // phys. damage - $stats['melee'] = Lang::npc('melee').Lang::main('colon').$_nf($melee[0]).' - '.$_nf($melee[1]); + $stats['melee'] = Lang::npc('melee').Lang::main('colon').Lang::nf($melee[0]).' - '.Lang::nf($melee[1]); // Ranged Damage $ranged = $this->subject->getBaseStats('ranged'); - $stats['ranged'] = Lang::npc('ranged').Lang::main('colon').$_nf($ranged[0]).' - '.$_nf($ranged[1]); + $stats['ranged'] = Lang::npc('ranged').Lang::main('colon').Lang::nf($ranged[0]).' - '.Lang::nf($ranged[1]); if (in_array($mapType, [1, 2])) // Dungeon or Raid { @@ -268,26 +267,26 @@ class NpcPage extends GenericPage // Health $health = $_altNPCs->getBaseStats('health'); - $modes['health'][] = sprintf($modeRow, $m, $health[0] < $health[1] ? $_nf($health[0]).' - '.$_nf($health[1]) : $_nf($health[0])); + $modes['health'][] = sprintf($modeRow, $m, $health[0] < $health[1] ? Lang::nf($health[0]).' - '.Lang::nf($health[1]) : Lang::nf($health[0])); // Mana (may be 0) $mana = $_altNPCs->getBaseStats('power'); - $modes['mana'][] = $mana[0] ? sprintf($modeRow, $m, $mana[0] < $mana[1] ? $_nf($mana[0]).' - '.$_nf($mana[1]) : $_nf($mana[0])) : null; + $modes['mana'][] = $mana[0] ? sprintf($modeRow, $m, $mana[0] < $mana[1] ? Lang::nf($mana[0]).' - '.Lang::nf($mana[1]) : Lang::nf($mana[0])) : null; // Armor $armor = $_altNPCs->getBaseStats('armor'); - $modes['armor'][] = sprintf($modeRow, $m, $armor[0] < $armor[1] ? $_nf($armor[0]).' - '.$_nf($armor[1]) : $_nf($armor[0])); + $modes['armor'][] = sprintf($modeRow, $m, $armor[0] < $armor[1] ? Lang::nf($armor[0]).' - '.Lang::nf($armor[1]) : Lang::nf($armor[0])); // Melee Damage $melee = $_altNPCs->getBaseStats('melee'); if ($_ = $_altNPCs->getField('dmgSchool')) // magic damage - $modes['melee'][] = sprintf($modeRow, $m, $_nf($melee[0]).' - '.$_nf($melee[1]).' ('.Lang::game('sc', $_).')'); + $modes['melee'][] = sprintf($modeRow, $m, Lang::nf($melee[0]).' - '.Lang::nf($melee[1]).' ('.Lang::game('sc', $_).')'); else // phys. damage - $modes['melee'][] = sprintf($modeRow, $m, $_nf($melee[0]).' - '.$_nf($melee[1])); + $modes['melee'][] = sprintf($modeRow, $m, Lang::nf($melee[0]).' - '.Lang::nf($melee[1])); // Ranged Damage $ranged = $_altNPCs->getBaseStats('ranged'); - $modes['ranged'][] = sprintf($modeRow, $m, $_nf($ranged[0]).' - '.$_nf($ranged[1])); + $modes['ranged'][] = sprintf($modeRow, $m, Lang::nf($ranged[0]).' - '.Lang::nf($ranged[1])); } } } diff --git a/pages/user.php b/pages/user.php index a0ec9730..19117ced 100644 --- a/pages/user.php +++ b/pages/user.php @@ -50,7 +50,7 @@ class UserPage extends GenericPage $infobox[] = Lang::user('lastLogin').Lang::main('colon').'[tooltip name=lastLogin]'.date('l, G:i:s', $this->user['prevLogin']).'[/tooltip][span class=tip tooltip=lastLogin]'.date(Lang::main('dateFmtShort'), $this->user['prevLogin']).'[/span]'; $infobox[] = Lang::user('userGroups').Lang::main('colon').($groups ? implode(', ', $groups) : Lang::account('groups', -1)); $infobox[] = Lang::user('consecVisits').Lang::main('colon').$this->user['consecutiveVisits']; - $infobox[] = Util::ucFirst(Lang::main('siteRep')).Lang::main('colon').number_format($this->user['sumRep']); + $infobox[] = Util::ucFirst(Lang::main('siteRep')).Lang::main('colon').Lang::nf($this->user['sumRep']); // contrib -> [url=http://www.wowhead.com/client]Data uploads: n [small]([tooltip=tooltip_totaldatauploads]xx.y MB[/tooltip])[/small][/url] diff --git a/setup/db_structure.sql b/setup/db_structure.sql index 1ecf4c50..e4f7af2b 100644 --- a/setup/db_structure.sql +++ b/setup/db_structure.sql @@ -513,6 +513,7 @@ CREATE TABLE `aowow_currencies` ( `cuFlags` int(10) unsigned NOT NULL, `iconId` mediumint(9) NOT NULL, `itemId` int(16) NOT NULL, + `cap` mediumint(8) unsigned NOT NULL, `name_loc0` varchar(64) NOT NULL, `name_loc2` varchar(64) NOT NULL, `name_loc3` varchar(64) NOT NULL, diff --git a/setup/tools/filegen/templates/power.js.in b/setup/tools/filegen/templates/power.js.in index 3a8b4248..34367b6b 100644 --- a/setup/tools/filegen/templates/power.js.in +++ b/setup/tools/filegen/templates/power.js.in @@ -27,13 +27,15 @@ if (typeof $WowheadPower == "undefined") { eventAttached = false, - npcs = {}, - objects = {}, - items = {}, - quests = {}, - spells = {}, + npcs = {}, + objects = {}, + items = {}, + quests = {}, + spells = {}, achievements = {}, - profiles = {}, + itemsets = {}, + currencies = {}, + profiles = {}, showLogo = 1, @@ -51,9 +53,11 @@ if (typeof $WowheadPower == "undefined") { TYPE_NPC = 1, TYPE_OBJECT = 2, TYPE_ITEM = 3, + TYPE_ITEMSET = 4, TYPE_QUEST = 5, TYPE_SPELL = 6, TYPE_ACHIEVEMENT = 10, + TYPE_CURRENCY = 17, TYPE_PROFILE = 100, CURSOR_HSPACE = 15, @@ -68,9 +72,11 @@ if (typeof $WowheadPower == "undefined") { 1: [npcs, "npc", "NPC" ], 2: [objects, "object", "Object" ], 3: [items, "item", "Item" ], + 4: [itemsets, "itemset", "Item Set" ], 5: [quests, "quest", "Quest" ], 6: [spells, "spell", "Spell" ], 10: [achievements, "achievement", "Achievement"], + 17: [currencies, "currency", "Currency" ], 100: [profiles, "profile", "Profile" ] }, SCALES = { @@ -90,7 +96,14 @@ if (typeof $WowheadPower == "undefined") { }; if (isRemote) { - var Locale = { id: 0, name: "enus" }; + var Locale = { + getId: function () { + return 0; + }, + getName: function () { + return "enus"; + } + } } function init() { @@ -248,8 +261,8 @@ if (typeof $WowheadPower == "undefined") { i2 = 3; if (t.href.indexOf("http://") == 0 || t.href.indexOf("https://") == 0) { i0 = 1; - // url = t.href.match(/^https?:\/\/(.+?)?\.?wowhead\.com(?:\:\d+)?\/\??(item|quest|spell|achievement|npc|object)=([0-9]+)/); - url = t.href.match(/^https?:\/\/(.*)\/?\??(item|quest|spell|achievement|npc|object)=([0-9]+)/); + // url = t.href.match(/^https?:\/\/(.+?)?\.?wowhead\.com(?:\:\d+)?\/\??(item|quest|spell|achievement|npc|object|itemset|currency)=(-?[0-9]+)/); + url = t.href.match(/^https?:\/\/(.*)\/?\??(item|quest|spell|achievement|npc|object|itemset|currency)=(-?[0-9]+)/); if (url == null) { // url = t.href.match(/^http:\/\/(.+?)?\.?wowhead\.com\/\?(profile)=([^&#]+)/) url = t.href.match(/^https?:\/\/(.*)\/?\??(profile)=([^&#]+)/); @@ -258,7 +271,7 @@ if (typeof $WowheadPower == "undefined") { showLogo = 0; } else { - url = t.href.match(/()\?(item|quest|spell|achievement|npc|object)=([0-9]+)/); + url = t.href.match(/()\?(item|quest|spell|achievement|npc|object|itemset|currency)=(-?[0-9]+)/); if (url == null) { url = t.href.match(/()\?(profile)=([^&#]+)/); } @@ -271,7 +284,7 @@ if (typeof $WowheadPower == "undefined") { i0 = 0; i1 = 1; i2 = 2; - url = t.rel.match(/(item|quest|spell|achievement|npc|object).?([0-9]+)/); + url = t.rel.match(/(item|quest|spell|achievement|npc|object|itemset|currency).?(-?[0-9]+)/); // if (url == null) { // sarjuuk: also matches 'profiler' and 'profiles' which screws with the language-menu workaround // url = t.rel.match(/(profile).?([^&#]+)/); // } @@ -700,6 +713,10 @@ if (typeof $WowheadPower == "undefined") { this.register(TYPE_NPC, id, locale, json); }; + this.registerCurrency = function (id, locale, json) { + this.register(TYPE_CURRENCY, id, locale, json) + }; + this.registerObject = function (id, locale, json) { this.register(TYPE_OBJECT, id, locale, json); }; @@ -708,6 +725,10 @@ if (typeof $WowheadPower == "undefined") { this.register(TYPE_ITEM, id, locale, json); }; + this.registerItemSet = function (id, locale, json) { + this.register(TYPE_ITEMSET, id, locale, json); + }; + this.registerQuest = function (id, locale, json) { this.register(TYPE_QUEST, id, locale, json); }; @@ -740,11 +761,11 @@ if (typeof $WowheadPower == "undefined") { }; this.requestItem = function (id, params) { - this.request(TYPE_ITEM, id, Locale.id, params); + this.request(TYPE_ITEM, id, Locale.getId(), params); }; this.requestSpell = function (id) { - this.request(TYPE_SPELL, id, Locale.id); + this.request(TYPE_SPELL, id, Locale.getId()); }; this.getStatus = function (type, id, locale) { diff --git a/setup/tools/sqlgen/currencies.func.php b/setup/tools/sqlgen/currencies.func.php index 5d45b716..7a2d43ec 100644 --- a/setup/tools/sqlgen/currencies.func.php +++ b/setup/tools/sqlgen/currencies.func.php @@ -18,7 +18,9 @@ $customData = array( 2 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW, 'category' => 3], 4 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW, 'category' => 3], 22 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW, 'category' => 3], - 141 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW, 'category' => 3] + 141 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW, 'category' => 3], + 103 => ['cap' => 10000], // Arena Points + 104 => ['cap' => 75000] // Honor Points ); $reqDBC = ['itemdisplayinfo', 'currencytypes']; diff --git a/setup/updates/1436619600_01.sql b/setup/updates/1436619600_01.sql new file mode 100644 index 00000000..1dca8932 --- /dev/null +++ b/setup/updates/1436619600_01.sql @@ -0,0 +1,5 @@ +ALTER TABLE `aowow_currencies` + ADD COLUMN `cap` MEDIUMINT UNSIGNED NOT NULL AFTER `itemId`; + +UPDATE `aowow_currencies` SET `cap` = 10000 WHERE `id` = 103; +UPDATE `aowow_currencies` SET `cap` = 75000 WHERE `id` = 104; diff --git a/static/css/basic.css b/static/css/basic.css index a66bced4..e8728564 100644 --- a/static/css/basic.css +++ b/static/css/basic.css @@ -83,18 +83,19 @@ a span.moneyitem, a span.moneysocketmeta, a span.moneysocketred, a span.moneysoc /* ITEM QUALITY COLORS */ /***********************/ -.q, .q a, .color-q, .wowhead-tooltip .q a { color: #ffd100 !important; } /* Default (yellow) */ -.q0, .q0 a, .color-q0, .wowhead-tooltip .q0 a { color: #9d9d9d !important; } /* Poor */ -.q1, .q1 a, .color-q1, .wowhead-tooltip .q1 a { color: #ffffff !important; } /* Common */ -.q2, .q2 a, .color-q2, .wowhead-tooltip .q2 a { color: #1eff00 !important; } /* Uncommon */ -.q3, .q3 a, .color-q3, .wowhead-tooltip .q3 a { color: #0070dd !important; } /* Rare */ -.q4, .q4 a, .color-q4, .wowhead-tooltip .q4 a { color: #a335ee !important; } /* Epic */ -.q5, .q5 a, .color-q5, .wowhead-tooltip .q5 a { color: #ff8000 !important; } /* Legendary */ -.q6, .q6 a, .color-q6, .wowhead-tooltip .q6 a { color: #e5cc80 !important; } /* Artifact */ -.q7, .q7 a, .color-q7, .wowhead-tooltip .q7 a { color: #e5cc80 !important; } /* Heirloom */ -.q8, .q8 a, .color-q8, .wowhead-tooltip .q8 a { color: #ffff98 !important; } /* Light yellow (item set bonuses) */ -.q9, .q9 a, .color-q9, .wowhead-tooltip .q9 a { color: #71d5ff !important; } /* Light blue (glyph type) */ -.q10, .q10 a, .color-q10, .wowhead-tooltip .q10 a { color: #ff4040 !important; } /* Red (requirement not met, error) */ + .q, .q a, .color-q, .wowhead-tooltip .q a { color: #ffd100 !important } /* Default (yellow) */ + .q0, .q0 a, .color-q0, .wowhead-tooltip .q0 a { color: #9d9d9d !important } /* Poor */ + .q1, .q1 a, .color-q1, .wowhead-tooltip .q1 a { color: #ffffff !important } /* Common */ + .q2, .q2 a, .color-q2, .wowhead-tooltip .q2 a { color: #1eff00 !important } /* Uncommon */ + .q3, .q3 a, .color-q3, .wowhead-tooltip .q3 a { color: #0070dd !important } /* Rare */ + .q4, .q4 a, .color-q4, .wowhead-tooltip .q4 a { color: #a335ee !important } /* Epic */ + .q5, .q5 a, .color-q5, .wowhead-tooltip .q5 a { color: #ff8000 !important } /* Legendary */ + .q6, .q6 a, .color-q6, .wowhead-tooltip .q6 a { color: #e5cc80 !important } /* Artifact */ + .q7, .q7 a, .color-q7, .wowhead-tooltip .q7 a { color: #e5cc80 !important } /* Heirloom */ + .q8, .q8 a, .color-q8, .wowhead-tooltip .q8 a { color: #ffff98 !important } /* Light yellow (item set bonuses) */ + .q9, .q9 a, .color-q9, .wowhead-tooltip .q9 a { color: #71d5ff !important } /* Light blue (glyph type) */ +.q10, .q10 a, .color-q10, .wowhead-tooltip .q10 a { color: #ff4040 !important } /* Red (requirement not met, error) */ +.q13, .q13 a, .color-q13, .wowhead-tooltip .q13 a { color: #ffff98 !important } /*********************/ /* DIFFICULTY COLORS */