Browse Source

Merge branch '76-augment-friendly-stat-names' into 'staging'

Git didn't include the client part of Fix #76. Added it now

See merge request !50
tags/v0.1.2^2
Big Bad Waffle 7 years ago
parent
commit
9419890a77
3 changed files with 57 additions and 44 deletions
  1. +47
    -0
      src/client/js/misc/statTranslations.js
  2. +5
    -3
      src/client/ui/templates/smithing/smithing.js
  3. +5
    -41
      src/client/ui/templates/tooltipItem/tooltipItem.js

+ 47
- 0
src/client/js/misc/statTranslations.js View File

@@ -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];
}
};
});

+ 5
- 3
src/client/ui/templates/smithing/smithing.js View File

@@ -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 += '<br /> ' + a;
msg.msg += '<br /> ' + ((a.value > 0) ? '+' : '-') + a.value + ' ' + statTranslations.translate(a.stat);
});

events.emit('onGetAnnouncement', msg);


+ 5
- 41
src/client/ui/templates/tooltipItem/tooltipItem.js View File

@@ -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];
}
};
});

Loading…
Cancel
Save