diff --git a/code/portal_detail_display.js b/code/portal_detail_display.js
index c5e72641..22d4120f 100644
--- a/code/portal_detail_display.js
+++ b/code/portal_detail_display.js
@@ -169,15 +169,15 @@ window.getPortalMiscDetails = function(guid,d) {
function linkExpl(t) { return ''+t+''; }
var linksText = [linkExpl('links'), linkExpl(links.outgoing+' out / '+links.incoming+' in')];
- var player = d.captured && d.captured.capturingPlayerId
- ? '' + d.captured.capturingPlayerId + ''
+ var player = d.owner
+ ? '' + d.owner + ''
: null;
var playerText = player ? ['owner', player] : null;
- var time = d.captured
- ? ''
- + unixTimeToString(d.captured.capturedTime) + ''
+ var time = d.capturedTime
+ ? ''
+ + unixTimeToString(d.capturedTime) + ''
: null;
var sinceText = time ? ['since', time] : null;
diff --git a/code/portal_detail_display_tools.js b/code/portal_detail_display_tools.js
index 48e9496b..389a46c9 100644
--- a/code/portal_detail_display_tools.js
+++ b/code/portal_detail_display_tools.js
@@ -110,11 +110,11 @@ window.getModDetails = function(d) {
// 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
+ if (key === 'HACK_SPEED') val = (val/10000)+'%'; // 500000 = 50%
+ else if (key === 'FORCE_AMPLIFIER') val = (val/1000)+'x'; // 2000 = 2x
+ else if (key === 'LINK_RANGE_MULTIPLIER') val = (val/1000)+'x' // 2000 = 2x
+ else if (key === 'HIT_BONUS') val = (val/10000)+'%'; // 2000 = 0.2% (although this seems pretty small to be useful?)
+ else if (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,' ');
@@ -169,7 +169,7 @@ window.getResonatorDetails = function(d) {
}
var l = parseInt(reso.level);
- var v = parseInt(reso.energyTotal);
+ var v = parseInt(reso.energy);
var nick = reso.owner;
// if array order and slot order drift apart, at least the octant
// naming will still be correct.
@@ -218,8 +218,8 @@ window.renderResonatorDetails = function(slot, level, nrg, dist, nick) {
}
// calculate AP gain from destroying portal and then capturing it by deploying resonators
-window.getAttackApGainText = function(d,fieldCount) {
- var breakdown = getAttackApGain(d,fieldCount);
+window.getAttackApGainText = function(d,fieldCount,linkCount) {
+ var breakdown = getAttackApGain(d,fieldCount,linkCount);
var totalGain = breakdown.enemyAp;
function tt(text) {
diff --git a/code/portal_info.js b/code/portal_info.js
index ccef2f25..96c25915 100644
--- a/code/portal_info.js
+++ b/code/portal_info.js
@@ -33,7 +33,7 @@ window.getCurrentPortalEnergy = function(d) {
var nrg = 0;
$.each(d.resonators, function(ind, reso) {
if(!reso) return true;
- nrg += parseInt(reso.energyTotal);
+ nrg += parseInt(reso.energy);
});
return nrg;
}
@@ -201,11 +201,7 @@ window.fixPortalImageUrl = function(url) {
window.getPortalModsByType = function(d, type) {
var mods = [];
- $.each(d.mods || [], function(i,mod) {
- if (mod && mod.type == type) mods.push(mod);
- });
-
- var sortKey = {
+ var typeToStat = {
RES_SHIELD: 'MITIGATION',
FORCE_AMP: 'FORCE_AMPLIFIER',
TURRET: 'HIT_BONUS', // and/or ATTACK_FREQUENCY??
@@ -214,23 +210,17 @@ window.getPortalModsByType = function(d, type) {
LINK_AMPLIFIER: 'LINK_RANGE_MULTIPLIER'
};
- // prefer to sort mods by stat - so if stats change (as they have for shields and turrets) we still put the highest first
- if (sortKey[type]) {
- // we have a stat type to sort by
- var key = sortKey[type];
+ var stat = typeToStat[type];
- mods.sort (function(a,b) {
- return b.stats[key] - a.stats[key];
- });
- } else {
- // no known stat type - sort by rarity
- mods.sort (function(a,b) {
- // rarity values are COMMON, RARE and VERY_RARE. handy, as that's alphabetical order!
- if (a.rarity < b.rarity) return -1;
- if (a.rarity > b.rarity) return 1;
- return 0;
- });
- }
+ $.each(d.mods || [], function(i,mod) {
+ if (mod && mod.stats.hasOwnProperty(stat)) mods.push(mod);
+ });
+
+
+ // sorting mods by the stat keeps code simpler, when calculating combined mod effects
+ mods.sort (function(a,b) {
+ return b.stats[stat] - a.stats[stat];
+ });
return mods;
}
diff --git a/code/smartphone.js b/code/smartphone.js
index 0cb6ed97..6e5e2454 100644
--- a/code/smartphone.js
+++ b/code/smartphone.js
@@ -98,7 +98,7 @@ window.smartphoneInfo = function(data) {
var reso = details.resonators[i];
if(reso) {
l = parseInt(reso.level);
- v = parseInt(reso.energyTotal);
+ v = parseInt(reso.energy);
max = RESO_NRG[l];
perc = v/max*100;
}
diff --git a/plugins/guess-player-levels.user.js b/plugins/guess-player-levels.user.js
index fa2e1a83..cfbb27e4 100644
--- a/plugins/guess-player-levels.user.js
+++ b/plugins/guess-player-levels.user.js
@@ -132,7 +132,7 @@ window.plugin.guessPlayerLevels.extractPortalData = function(data) {
Hint: This can only happen to the owner of the portal, so resonators by other players can be used to determine
their minimal level */
- var owner = data.details.captured && data.details.captured.capturingPlayerId || "";
+ var owner = data.details.owner && data.details.owner || "";
var ownerModCount = 0;
data.details.mods.forEach(function(mod) {
if(mod && mod.installingUser == owner)
@@ -435,7 +435,7 @@ window.plugin.guessPlayerLevels.guess = function() {
});
if(details.captured) {
- var nick = details.captured.capturingPlayerId
+ var nick = details.owner;
if(isSystemPlayer(nick)) return true;
var lvl = window.plugin.guessPlayerLevels.fetchLevelDetailsByPlayer(nick).min;
if(!lvl) return true;