From 595bd04d97c79ead074096d39f1fba17be91a7dd Mon Sep 17 00:00:00 2001 From: Big Bad Waffle Date: Sun, 26 Feb 2017 08:13:30 +0200 Subject: [PATCH] Git didn't include the client part of Fix #76. Added it now --- src/client/js/misc/statTranslations.js | 47 +++++++++++++++++++ src/client/ui/templates/smithing/smithing.js | 8 ++-- .../ui/templates/tooltipItem/tooltipItem.js | 46 ++---------------- 3 files changed, 57 insertions(+), 44 deletions(-) create mode 100644 src/client/js/misc/statTranslations.js diff --git a/src/client/js/misc/statTranslations.js b/src/client/js/misc/statTranslations.js new file mode 100644 index 00000000..00f6d92a --- /dev/null +++ b/src/client/js/misc/statTranslations.js @@ -0,0 +1,47 @@ +define([ + +], function( + +) { + var stats = { + 'vit': 'vitality', + 'hpMax': 'vitality', + 'regenHp': 'health regeneration', + 'manaMax': 'maximum mana', + 'regenMana': 'mana regeneration', + 'str': 'strength', + 'int': 'intellect', + 'dex': 'dexterity', + 'armor': 'armor', + 'addCritChance': 'increased crit chance', + 'magicFind': 'magic find', + 'sprintChance': 'sprint chance', + 'dmgPercent': 'to all damage', + 'allAttributes': 'to all attributes', + 'xpIncrease': 'additional xp per kill', + + 'elementArcanePercent': 'increased arcane damage', + 'elementFrostPercent': 'increased frost damage', + 'elementFirePercent': 'increased fire damage', + 'elementHolyPercent': 'increased holy damage', + 'elementPhysicalPercent': 'increased physical damage', + 'elementPoisonPercent': 'increased poison damage', + + 'elementArcaneResist': 'arcane resistance', + 'elementFrostResist': 'frost resistance', + 'elementFireResist': 'fire resistance', + 'elementHolyResist': 'holy resistance', + 'elementPhysicalResist': 'physical resistance', + 'elementPoisonResist': 'poison resistance', + 'elementAllResist': 'all resistance', + + //This stat is used for gambling when you can't see the stats + 'stats': 'stats' + }; + + return { + translate: function(stat) { + return stats[stat]; + } + }; +}); \ No newline at end of file diff --git a/src/client/ui/templates/smithing/smithing.js b/src/client/ui/templates/smithing/smithing.js index e2994310..91d17dec 100644 --- a/src/client/ui/templates/smithing/smithing.js +++ b/src/client/ui/templates/smithing/smithing.js @@ -3,13 +3,15 @@ define([ 'js/system/client', 'html!ui/templates/smithing/template', 'css!ui/templates/smithing/styles', - 'html!/ui/templates/smithing/templateItem' + 'html!/ui/templates/smithing/templateItem', + 'js/misc/statTranslations' ], function( events, client, template, styles, - templateItem + templateItem, + statTranslations ) { return { tpl: template, @@ -89,7 +91,7 @@ define([ } result.addStatMsgs.forEach(function(a) { - msg.msg += '
' + a; + msg.msg += '
' + ((a.value > 0) ? '+' : '-') + a.value + ' ' + statTranslations.translate(a.stat); }); events.emit('onGetAnnouncement', msg); diff --git a/src/client/ui/templates/tooltipItem/tooltipItem.js b/src/client/ui/templates/tooltipItem/tooltipItem.js index f7157c13..1f3f279d 100644 --- a/src/client/ui/templates/tooltipItem/tooltipItem.js +++ b/src/client/ui/templates/tooltipItem/tooltipItem.js @@ -2,12 +2,14 @@ define([ 'js/system/events', 'css!ui/templates/tooltipItem/styles', 'html!ui/templates/tooltipItem/template', - 'html!ui/templates/tooltipItem/templateTooltip' + 'html!ui/templates/tooltipItem/templateTooltip', + 'js/misc/statTranslations' ], function( events, styles, template, - tplTooltip + tplTooltip, + statTranslations ) { return { tpl: template, @@ -59,7 +61,7 @@ define([ stats = Object.keys(tempStats) .map(function(s) { - var statName = this.mapStat(s); + var statName = statTranslations.translate(s); var value = tempStats[s]; if (['addCritChance', 'sprintChance', 'dmgPercent', 'xpIncrease'].indexOf(s) > -1) @@ -216,44 +218,6 @@ define([ if (!canAfford) this.tooltip.find('.worth').addClass('no-afford'); - }, - - mapStat: function(stat) { - return { - 'vit': 'vitality', - 'hpMax': 'vitality', - 'regenHp': 'health regeneration', - 'manaMax': 'maximum mana', - 'regenMana': 'mana regeneration', - 'str': 'strength', - 'int': 'intellect', - 'dex': 'dexterity', - 'armor': 'armor', - 'addCritChance': 'increased crit chance', - 'magicFind': 'magic find', - 'sprintChance': 'sprint chance', - 'dmgPercent': 'to all damage', - 'allAttributes': 'to all attributes', - 'xpIncrease': 'additional xp per kill', - - 'elementArcanePercent': 'increased arcane damage', - 'elementFrostPercent': 'increased frost damage', - 'elementFirePercent': 'increased fire damage', - 'elementHolyPercent': 'increased holy damage', - 'elementPhysicalPercent': 'increased physical damage', - 'elementPoisonPercent': 'increased poison damage', - - 'elementArcaneResist': 'arcane resistance', - 'elementFrostResist': 'frost resistance', - 'elementFireResist': 'fire resistance', - 'elementHolyResist': 'holy resistance', - 'elementPhysicalResist': 'physical resistance', - 'elementPoisonResist': 'poison resistance', - 'elementAllResist': 'all resistance', - - //This stat is used for gambling when you can't see the stats - 'stats': 'stats' - }[stat]; } }; }); \ No newline at end of file