From d9936ab1d617b9ba88ba096613e35148766744ea Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Fri, 28 Jun 2013 17:14:35 +0100 Subject: [PATCH] display portal mod stats in a more useful format (however, it doesn't take account of how multiple mods of a type stack - some are linear add, others multiply percentages) --- code/portal_detail_display_tools.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/code/portal_detail_display_tools.js b/code/portal_detail_display_tools.js index f0c4d6d3..f9886389 100644 --- a/code/portal_detail_display_tools.js +++ b/code/portal_detail_display_tools.js @@ -59,7 +59,19 @@ window.getModDetails = function(d) { modTooltip += 'Stats:'; for (var key in mod.stats) { if (!mod.stats.hasOwnProperty(key)) continue; - modTooltip += '\n+' + mod.stats[key] + ' ' + key.capitalize().replace(/_/g,' '); + var val = mod.stats[key]; + + if (key === 'REMOVAL_STICKINESS' && val == 0) continue; // stat on all mods recently - unknown meaning, not displayed in stock client + + // special formatting for known mod stats, where the display of the raw value is less useful + if (mod.type === 'HEATSINK' && key === 'HACK_SPEED') val = (val/10000)+'%'; // 500000 = 50% + else if (mod.type === 'FORCE_AMP' && key === 'FORCE_AMPLIFIER') val = (val/1000)+'x'; // 2000 = 2x + else if (mod.type === 'LINK_AMPLIFIER' && key === 'LINK_RANGE_MULTIPLIER') val = (val/1000)+'x' // 2000 = 2x + else if (mod.type === 'TURRET' && key === 'HIT_BONUS') val = (val/10000)+'%'; // 2000 = 0.2% (although this seems pretty small to be useful?) + else if (mod.type === 'TURRET' && key === 'ATTACK_FREQUENCY') val = (val/1000)+'x' // 2000 = 2x + // else display unmodified. correct for shield mitigation and multihack - unknown for future/other mods + + modTooltip += '\n+' + val + ' ' + key.capitalize().replace(/_/g,' '); } }