niantic removed controllingTeam from the portal details - we have to use the team from the summary data
This commit is contained in:
parent
460e8562f2
commit
86327fa578
@ -8,7 +8,7 @@
|
|||||||
// given the entity detail data, returns the team the entity belongs
|
// given the entity detail data, returns the team the entity belongs
|
||||||
// to. Uses TEAM_* enum values.
|
// to. Uses TEAM_* enum values.
|
||||||
window.getTeam = function(details) {
|
window.getTeam = function(details) {
|
||||||
return teamStringToId(details.controllingTeam.team);
|
return teamStringToId(details.controllingTeam && details.controllingTeam.team);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.teamStringToId = function(teamStr) {
|
window.teamStringToId = function(teamStr) {
|
||||||
|
@ -28,7 +28,9 @@ window.renderPortalDetails = function(guid) {
|
|||||||
|
|
||||||
// details and data can get out of sync. if we have details, construct a matching 'data'
|
// details and data can get out of sync. if we have details, construct a matching 'data'
|
||||||
if (details) {
|
if (details) {
|
||||||
data = getPortalSummaryData(details);
|
// the details had the team removed(!) - so we have to use the team in the summary data
|
||||||
|
// however - this can easily be out of date in areas of heavy activity - so could be just plain wrong!
|
||||||
|
data = getPortalSummaryData(details, data && data.team);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ window.getAttackApGainText = function(d,fieldCount) {
|
|||||||
|
|
||||||
function tt(text) {
|
function tt(text) {
|
||||||
var t = '';
|
var t = '';
|
||||||
if (PLAYER.team == d.controllingTeam.team) {
|
if (d.controllingTeam && PLAYER.team == d.controllingTeam.team) {
|
||||||
totalGain = breakdown.friendlyAp;
|
totalGain = breakdown.friendlyAp;
|
||||||
t += 'Friendly AP:\t' + breakdown.friendlyAp + '\n';
|
t += 'Friendly AP:\t' + breakdown.friendlyAp + '\n';
|
||||||
t += ' Deploy ' + breakdown.deployCount + ', ';
|
t += ' Deploy ' + breakdown.deployCount + ', ';
|
||||||
|
@ -162,7 +162,7 @@ window.potentialPortalLevel = function(d) {
|
|||||||
var current_level = getPortalLevel(d);
|
var current_level = getPortalLevel(d);
|
||||||
var potential_level = current_level;
|
var potential_level = current_level;
|
||||||
|
|
||||||
if(PLAYER.team === d.controllingTeam.team) {
|
if(d.controllingTeam && PLAYER.team === d.controllingTeam.team) {
|
||||||
var resonators_on_portal = d.resonatorArray.resonators;
|
var resonators_on_portal = d.resonatorArray.resonators;
|
||||||
var resonator_levels = new Array();
|
var resonator_levels = new Array();
|
||||||
// figure out how many of each of these resonators can be placed by the player
|
// figure out how many of each of these resonators can be placed by the player
|
||||||
@ -311,10 +311,12 @@ window.getPortalHackDetails = function(d) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// given a detailed portal structure, return summary portal data, as seen in the map tile data
|
// given a detailed portal structure, return summary portal data, as seen in the map tile data
|
||||||
window.getPortalSummaryData = function(d) {
|
window.getPortalSummaryData = function(d,probableTeamStr) {
|
||||||
|
|
||||||
// NOTE: the summary data reports unclaimed portals as level 1 - not zero as elsewhere in IITC
|
// NOTE: the summary data reports unclaimed portals as level 1 - not zero as elsewhere in IITC
|
||||||
var level = d.controllingTeam.team == "NEUTRAL" ? 1 : parseInt(getPortalLevel(d));
|
var level = parseInt(getPortalLevel(d));
|
||||||
|
if (level == 0) level = 1; //niantic returns neutral portals as level 1, not 0 as used throughout IITC elsewhere
|
||||||
|
|
||||||
var resCount = 0;
|
var resCount = 0;
|
||||||
if (d.resonatorArray && d.resonatorArray.resonators) {
|
if (d.resonatorArray && d.resonatorArray.resonators) {
|
||||||
for (var x in d.resonatorArray.resonators) {
|
for (var x in d.resonatorArray.resonators) {
|
||||||
@ -332,7 +334,7 @@ window.getPortalSummaryData = function(d) {
|
|||||||
resCount: resCount,
|
resCount: resCount,
|
||||||
latE6: d.locationE6.latE6,
|
latE6: d.locationE6.latE6,
|
||||||
health: health,
|
health: health,
|
||||||
team: d.controllingTeam.team,
|
team: d.controllingTeam ? d.controllingTeam.team : probableTeamStr,
|
||||||
lngE6: d.locationE6.lngE6,
|
lngE6: d.locationE6.lngE6,
|
||||||
type: 'portal'
|
type: 'portal'
|
||||||
};
|
};
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// @id iitc-plugin-show-linked-portals@fstopienski
|
// @id iitc-plugin-show-linked-portals@fstopienski
|
||||||
// @name IITC plugin: Show linked portals
|
// @name IITC plugin: Show linked portals
|
||||||
// @category Portal Info
|
// @category Portal Info
|
||||||
// @version 0.1.1.@@DATETIMEVERSION@@
|
// @version 0.1.2.@@DATETIMEVERSION@@
|
||||||
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
||||||
// @updateURL @@UPDATEURL@@
|
// @updateURL @@UPDATEURL@@
|
||||||
// @downloadURL @@DOWNLOADURL@@
|
// @downloadURL @@DOWNLOADURL@@
|
||||||
@ -38,8 +38,8 @@ window.plugin.showLinkedPortal.portalDetail = function (data) {
|
|||||||
|
|
||||||
// don't render linked portal data if portal is neutral.
|
// don't render linked portal data if portal is neutral.
|
||||||
// (the data can remain sometimes - when a portal decays?)
|
// (the data can remain sometimes - when a portal decays?)
|
||||||
if (data.portalDetails.controllingTeam.team == 'NEUTRAL')
|
// if (data.portalDetails.controllingTeam.team == 'NEUTRAL')
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
var d = data.portalDetails.portalV2,
|
var d = data.portalDetails.portalV2,
|
||||||
c = 1;
|
c = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user