more work on fixing things for the 2014-05-23 changes
it's a big job - much is still broken
This commit is contained in:
parent
589fd83b93
commit
b595af30ad
@ -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 && details.controllingTeam.team);
|
return teamStringToId(details.team);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.teamStringToId = function(teamStr) {
|
window.teamStringToId = function(teamStr) {
|
||||||
|
@ -61,7 +61,7 @@ window.findPortalLatLng = function(guid) {
|
|||||||
// not found in portals - try the cached (and possibly stale) details - good enough for location
|
// not found in portals - try the cached (and possibly stale) details - good enough for location
|
||||||
var details = portalDetail.get(guid);
|
var details = portalDetail.get(guid);
|
||||||
if (details) {
|
if (details) {
|
||||||
return L.latLng (details.locationE6.latE6/1E6, details.locationE6.lngE6/1E6);
|
return L.latLng (details.latE6/1E6, details.lngE6/1E6);
|
||||||
}
|
}
|
||||||
|
|
||||||
// now try searching through fields
|
// now try searching through fields
|
||||||
|
@ -28,9 +28,7 @@ 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) {
|
||||||
// the details had the team removed(!) - so we have to use the team in the summary data
|
data = getPortalSummaryData(details);
|
||||||
// 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -42,7 +40,7 @@ window.renderPortalDetails = function(guid) {
|
|||||||
var statusDetails = details ? '' : '<div id="portalStatus">Loading details...</div>';
|
var statusDetails = details ? '' : '<div id="portalStatus">Loading details...</div>';
|
||||||
|
|
||||||
|
|
||||||
var img = fixPortalImageUrl(details ? details.imageByUrl && details.imageByUrl.imageUrl : data.image);
|
var img = fixPortalImageUrl(details ? details.image : data.image);
|
||||||
var title = data.title;
|
var title = data.title;
|
||||||
|
|
||||||
var lat = data.latE6/1E6;
|
var lat = data.latE6/1E6;
|
||||||
@ -165,10 +163,8 @@ window.getPortalMiscDetails = function(guid,d) {
|
|||||||
if (d) {
|
if (d) {
|
||||||
|
|
||||||
// collect some random data that’s not worth to put in an own method
|
// collect some random data that’s not worth to put in an own method
|
||||||
var links = {incoming: 0, outgoing: 0};
|
var linkInfo = getPortalLinks(guid);
|
||||||
$.each(d.portalV2.linkedEdges||[], function(ind, link) {
|
var links = {incoming: linkInfo.in.length, outgoing: linkInfo.out.length};
|
||||||
links[link.isOrigin ? 'outgoing' : 'incoming']++;
|
|
||||||
});
|
|
||||||
|
|
||||||
function linkExpl(t) { return '<tt title="'+links.outgoing+' links out (8 max)\n'+links.incoming+' links in\n('+(links.outgoing+links.incoming)+' total)">'+t+'</tt>'; }
|
function linkExpl(t) { return '<tt title="'+links.outgoing+' links out (8 max)\n'+links.incoming+' links in\n('+(links.outgoing+links.incoming)+' total)">'+t+'</tt>'; }
|
||||||
var linksText = [linkExpl('links'), linkExpl(links.outgoing+' out / '+links.incoming+' in')];
|
var linksText = [linkExpl('links'), linkExpl(links.outgoing+' out / '+links.incoming+' in')];
|
||||||
@ -189,6 +185,8 @@ window.getPortalMiscDetails = function(guid,d) {
|
|||||||
|
|
||||||
var linkedFields = ['fields', fieldCount];
|
var linkedFields = ['fields', fieldCount];
|
||||||
|
|
||||||
|
var linkCount = getPortalLinksCount(guid);
|
||||||
|
|
||||||
// collect and html-ify random data
|
// collect and html-ify random data
|
||||||
var randDetailsData = [];
|
var randDetailsData = [];
|
||||||
if (playerText && sinceText) {
|
if (playerText && sinceText) {
|
||||||
@ -197,9 +195,9 @@ window.getPortalMiscDetails = function(guid,d) {
|
|||||||
|
|
||||||
randDetailsData.push (
|
randDetailsData.push (
|
||||||
getRangeText(d), getEnergyText(d),
|
getRangeText(d), getEnergyText(d),
|
||||||
linksText, getAvgResoDistText(d),
|
linksText, ['-','-'],
|
||||||
linkedFields, getAttackApGainText(d,fieldCount),
|
linkedFields, getAttackApGainText(d,fieldCount,linkCount),
|
||||||
getHackDetailsText(d), getMitigationText(d)
|
getHackDetailsText(d), getMitigationText(d,linkCount)
|
||||||
);
|
);
|
||||||
|
|
||||||
// artifact details
|
// artifact details
|
||||||
|
@ -24,20 +24,22 @@ window.getRangeText = function(d) {
|
|||||||
|
|
||||||
// generates description text from details for portal
|
// generates description text from details for portal
|
||||||
window.getPortalDescriptionFromDetails = function(details) {
|
window.getPortalDescriptionFromDetails = function(details) {
|
||||||
var descObj = details.descriptiveText.map;
|
return details.title || '(untitled)';
|
||||||
// FIXME: also get real description?
|
|
||||||
var desc = descObj.TITLE;
|
// var descObj = details.descriptiveText.map;
|
||||||
if(descObj.ADDRESS)
|
// // FIXME: also get real description?
|
||||||
desc += '\n' + descObj.ADDRESS;
|
// var desc = descObj.TITLE;
|
||||||
// if(descObj.ATTRIBUTION)
|
// if(descObj.ADDRESS)
|
||||||
// desc += '\nby '+descObj.ATTRIBUTION+' ('+descObj.ATTRIBUTION_LINK+')';
|
// desc += '\n' + descObj.ADDRESS;
|
||||||
return desc;
|
//// if(descObj.ATTRIBUTION)
|
||||||
|
//// desc += '\nby '+descObj.ATTRIBUTION+' ('+descObj.ATTRIBUTION_LINK+')';
|
||||||
|
// return desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grabs more info, including the submitter name for the current main
|
// Grabs more info, including the submitter name for the current main
|
||||||
// portal image
|
// portal image
|
||||||
window.getPortalDescriptionFromDetailsExtended = function(details) {
|
window.getPortalDescriptionFromDetailsExtended = function(details) {
|
||||||
var descObj = details.descriptiveText.map;
|
var descObj = details.title;
|
||||||
var photoStreamObj = details.photoStreamInfo;
|
var photoStreamObj = details.photoStreamInfo;
|
||||||
|
|
||||||
var submitterObj = new Object();
|
var submitterObj = new Object();
|
||||||
@ -79,7 +81,7 @@ window.getModDetails = function(d) {
|
|||||||
var mods = [];
|
var mods = [];
|
||||||
var modsTitle = [];
|
var modsTitle = [];
|
||||||
var modsColor = [];
|
var modsColor = [];
|
||||||
$.each(d.portalV2.linkedModArray, function(ind, mod) {
|
$.each(d.mods, function(ind, mod) {
|
||||||
var modName = '';
|
var modName = '';
|
||||||
var modTooltip = '';
|
var modTooltip = '';
|
||||||
var modColor = '#000';
|
var modColor = '#000';
|
||||||
@ -88,13 +90,7 @@ window.getModDetails = function(d) {
|
|||||||
// all mods seem to follow the same pattern for the data structure
|
// all mods seem to follow the same pattern for the data structure
|
||||||
// but let's try and make this robust enough to handle possible future differences
|
// but let's try and make this robust enough to handle possible future differences
|
||||||
|
|
||||||
if (mod.displayName) {
|
modName = mod.name || '(unknown mod)';
|
||||||
modName = mod.displayName;
|
|
||||||
} else if (mod.type) {
|
|
||||||
modName = mod.type;
|
|
||||||
} else {
|
|
||||||
modName = '(unknown mod)';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mod.rarity) {
|
if (mod.rarity) {
|
||||||
modName = mod.rarity.capitalize().replace(/_/g,' ') + ' ' + modName;
|
modName = mod.rarity.capitalize().replace(/_/g,' ') + ' ' + modName;
|
||||||
@ -137,10 +133,12 @@ window.getModDetails = function(d) {
|
|||||||
modsColor.push(modColor);
|
modsColor.push(modColor);
|
||||||
});
|
});
|
||||||
|
|
||||||
var t = '<span'+(modsTitle[0].length ? ' title="'+modsTitle[0]+'"' : '')+' style="color:'+modsColor[0]+'">'+mods[0]+'</span>'
|
|
||||||
+ '<span'+(modsTitle[1].length ? ' title="'+modsTitle[1]+'"' : '')+' style="color:'+modsColor[1]+'">'+mods[1]+'</span>'
|
var t = '';
|
||||||
+ '<span'+(modsTitle[2].length ? ' title="'+modsTitle[2]+'"' : '')+' style="color:'+modsColor[2]+'">'+mods[2]+'</span>'
|
for (var i=0; i<mods.length; i++) {
|
||||||
+ '<span'+(modsTitle[3].length ? ' title="'+modsTitle[3]+'"' : '')+' style="color:'+modsColor[3]+'">'+mods[3]+'</span>'
|
t += '<span'+(modsTitle[i].length ? ' title="'+modsTitle[i]+'"' : '')+' style="color:'+modsColor[i]+'">'+mods[i]+'</span>'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
@ -153,10 +151,6 @@ window.getEnergyText = function(d) {
|
|||||||
return ['energy', '<tt title="'+inf+'">' + fill + '</tt>'];
|
return ['energy', '<tt title="'+inf+'">' + fill + '</tt>'];
|
||||||
}
|
}
|
||||||
|
|
||||||
window.getAvgResoDistText = function(d) {
|
|
||||||
var avgDist = Math.round(10*getAvgResoDist(d))/10;
|
|
||||||
return ['res dist', avgDist + ' m'];
|
|
||||||
}
|
|
||||||
|
|
||||||
window.getResonatorDetails = function(d) {
|
window.getResonatorDetails = function(d) {
|
||||||
var resoDetails = [];
|
var resoDetails = [];
|
||||||
@ -168,7 +162,7 @@ window.getResonatorDetails = function(d) {
|
|||||||
// SW S
|
// SW S
|
||||||
|
|
||||||
$.each([2, 1, 3, 0, 4, 7, 5, 6], function(ind, slot) {
|
$.each([2, 1, 3, 0, 4, 7, 5, 6], function(ind, slot) {
|
||||||
var reso = d.resonatorArray.resonators[slot];
|
var reso = d.resonators[slot];
|
||||||
if(!reso) {
|
if(!reso) {
|
||||||
resoDetails.push(renderResonatorDetails(slot, 0, 0, null, null));
|
resoDetails.push(renderResonatorDetails(slot, 0, 0, null, null));
|
||||||
return true;
|
return true;
|
||||||
@ -176,13 +170,12 @@ window.getResonatorDetails = function(d) {
|
|||||||
|
|
||||||
var l = parseInt(reso.level);
|
var l = parseInt(reso.level);
|
||||||
var v = parseInt(reso.energyTotal);
|
var v = parseInt(reso.energyTotal);
|
||||||
var nick = reso.ownerGuid;
|
var nick = reso.owner;
|
||||||
var dist = reso.distanceToPortal;
|
|
||||||
// if array order and slot order drift apart, at least the octant
|
// if array order and slot order drift apart, at least the octant
|
||||||
// naming will still be correct.
|
// naming will still be correct.
|
||||||
slot = parseInt(reso.slot);
|
slot = ind;
|
||||||
|
|
||||||
resoDetails.push(renderResonatorDetails(slot, l, v, dist, nick));
|
resoDetails.push(renderResonatorDetails(slot, l, v, null, nick));
|
||||||
});
|
});
|
||||||
return '<table id="resodetails">' + genFourColumnTable(resoDetails) + '</table>';
|
return '<table id="resodetails">' + genFourColumnTable(resoDetails) + '</table>';
|
||||||
|
|
||||||
@ -231,7 +224,7 @@ window.getAttackApGainText = function(d,fieldCount) {
|
|||||||
|
|
||||||
function tt(text) {
|
function tt(text) {
|
||||||
var t = '';
|
var t = '';
|
||||||
if (d.controllingTeam && PLAYER.team == d.controllingTeam.team) {
|
if (PLAYER.team == d.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 + ', ';
|
||||||
@ -266,8 +259,8 @@ window.getHackDetailsText = function(d) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
window.getMitigationText = function(d) {
|
window.getMitigationText = function(d,linkCount) {
|
||||||
var mitigationDetails = getPortalMitigationDetails(d);
|
var mitigationDetails = getPortalMitigationDetails(d,linkCount);
|
||||||
|
|
||||||
var mitigationShort = mitigationDetails.total;
|
var mitigationShort = mitigationDetails.total;
|
||||||
if (mitigationDetails.excess) mitigationShort += ' (+'+mitigationDetails.excess+')';
|
if (mitigationDetails.excess) mitigationShort += ' (+'+mitigationDetails.excess+')';
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
window.getPortalLevel = function(d) {
|
window.getPortalLevel = function(d) {
|
||||||
var lvl = 0;
|
var lvl = 0;
|
||||||
var hasReso = false;
|
var hasReso = false;
|
||||||
$.each(d.resonatorArray.resonators, function(ind, reso) {
|
$.each(d.resonators, function(ind, reso) {
|
||||||
if(!reso) return true;
|
if(!reso) return true;
|
||||||
lvl += parseInt(reso.level);
|
lvl += parseInt(reso.level);
|
||||||
hasReso = true;
|
hasReso = true;
|
||||||
@ -17,7 +17,7 @@ window.getPortalLevel = function(d) {
|
|||||||
|
|
||||||
window.getTotalPortalEnergy = function(d) {
|
window.getTotalPortalEnergy = function(d) {
|
||||||
var nrg = 0;
|
var nrg = 0;
|
||||||
$.each(d.resonatorArray.resonators, function(ind, reso) {
|
$.each(d.resonators, function(ind, reso) {
|
||||||
if(!reso) return true;
|
if(!reso) return true;
|
||||||
var level = parseInt(reso.level);
|
var level = parseInt(reso.level);
|
||||||
var max = RESO_NRG[level];
|
var max = RESO_NRG[level];
|
||||||
@ -31,7 +31,7 @@ window.getPortalEnergy = window.getTotalPortalEnergy;
|
|||||||
|
|
||||||
window.getCurrentPortalEnergy = function(d) {
|
window.getCurrentPortalEnergy = function(d) {
|
||||||
var nrg = 0;
|
var nrg = 0;
|
||||||
$.each(d.resonatorArray.resonators, function(ind, reso) {
|
$.each(d.resonators, function(ind, reso) {
|
||||||
if(!reso) return true;
|
if(!reso) return true;
|
||||||
nrg += parseInt(reso.energyTotal);
|
nrg += parseInt(reso.energyTotal);
|
||||||
});
|
});
|
||||||
@ -44,7 +44,7 @@ window.getPortalRange = function(d) {
|
|||||||
|
|
||||||
var lvl = 0;
|
var lvl = 0;
|
||||||
var resoMissing = false;
|
var resoMissing = false;
|
||||||
$.each(d.resonatorArray.resonators, function(ind, reso) {
|
$.each(d.resonators, function(ind, reso) {
|
||||||
if(!reso) {
|
if(!reso) {
|
||||||
resoMissing = true;
|
resoMissing = true;
|
||||||
return;
|
return;
|
||||||
@ -88,19 +88,7 @@ window.getLinkAmpRangeBoost = function(d) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
window.getAvgResoDist = function(d) {
|
window.getAttackApGain = function(d,fieldCount,linkCount) {
|
||||||
var sum = 0, resos = 0;
|
|
||||||
$.each(d.resonatorArray.resonators, function(ind, reso) {
|
|
||||||
if(!reso) return true;
|
|
||||||
var resDist = parseInt(reso.distanceToPortal);
|
|
||||||
if (resDist == 0) resDist = 0.01; // set a non-zero but very small distance for zero deployment distance. allows the return value to distinguish between zero deployment distance average and zero resonators
|
|
||||||
sum += resDist;
|
|
||||||
resos++;
|
|
||||||
});
|
|
||||||
return resos ? sum/resos : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
window.getAttackApGain = function(d,fieldCount) {
|
|
||||||
if (!fieldCount) fieldCount = 0;
|
if (!fieldCount) fieldCount = 0;
|
||||||
|
|
||||||
var resoCount = 0;
|
var resoCount = 0;
|
||||||
@ -110,13 +98,12 @@ window.getAttackApGain = function(d,fieldCount) {
|
|||||||
for(var n = PLAYER.level + 1; n < 9; n++) {
|
for(var n = PLAYER.level + 1; n < 9; n++) {
|
||||||
maxResonators[n] = 0;
|
maxResonators[n] = 0;
|
||||||
}
|
}
|
||||||
$.each(d.resonatorArray.resonators, function(ind, reso) {
|
$.each(d.resonators, function(ind, reso) {
|
||||||
if(!reso)
|
if(!reso)
|
||||||
return true;
|
return true;
|
||||||
resoCount += 1;
|
resoCount += 1;
|
||||||
var reslevel=parseInt(reso.level);
|
var reslevel=parseInt(reso.level);
|
||||||
// NOTE: reso.ownerGuid is actually the name - no player GUIDs are visible in the protocol any more
|
if(reso.owner === PLAYER.nickname) {
|
||||||
if(reso.ownerGuid === PLAYER.nickname) {
|
|
||||||
if(maxResonators[reslevel] > 0) {
|
if(maxResonators[reslevel] > 0) {
|
||||||
maxResonators[reslevel] -= 1;
|
maxResonators[reslevel] -= 1;
|
||||||
}
|
}
|
||||||
@ -125,8 +112,6 @@ window.getAttackApGain = function(d,fieldCount) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var linkCount = d.portalV2.linkedEdges ? d.portalV2.linkedEdges.length : 0;
|
|
||||||
|
|
||||||
|
|
||||||
var resoAp = resoCount * DESTROY_RESONATOR;
|
var resoAp = resoCount * DESTROY_RESONATOR;
|
||||||
var linkAp = linkCount * DESTROY_LINK;
|
var linkAp = linkCount * DESTROY_LINK;
|
||||||
@ -162,8 +147,8 @@ 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(d.controllingTeam && PLAYER.team === d.controllingTeam.team) {
|
if(PLAYER.team === d.team) {
|
||||||
var resonators_on_portal = d.resonatorArray.resonators;
|
var resonators_on_portal = d.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
|
||||||
var player_resontators = new Array();
|
var player_resontators = new Array();
|
||||||
@ -171,8 +156,7 @@ window.potentialPortalLevel = function(d) {
|
|||||||
player_resontators[i] = i > PLAYER.level ? 0 : MAX_RESO_PER_PLAYER[i];
|
player_resontators[i] = i > PLAYER.level ? 0 : MAX_RESO_PER_PLAYER[i];
|
||||||
}
|
}
|
||||||
$.each(resonators_on_portal, function(ind, reso) {
|
$.each(resonators_on_portal, function(ind, reso) {
|
||||||
// NOTE: reso.ownerGuid is actually the player name - GUIDs are not in the protocol any more
|
if(reso !== null && reso.owner === window.PLAYER.nickname) {
|
||||||
if(reso !== null && reso.ownerGuid === window.PLAYER.nickname) {
|
|
||||||
player_resontators[reso.level]--;
|
player_resontators[reso.level]--;
|
||||||
}
|
}
|
||||||
resonator_levels.push(reso === null ? 0 : reso.level);
|
resonator_levels.push(reso === null ? 0 : reso.level);
|
||||||
@ -217,7 +201,7 @@ window.fixPortalImageUrl = function(url) {
|
|||||||
window.getPortalModsByType = function(d, type) {
|
window.getPortalModsByType = function(d, type) {
|
||||||
var mods = [];
|
var mods = [];
|
||||||
|
|
||||||
$.each(d.portalV2.linkedModArray || [], function(i,mod) {
|
$.each(d.mods || [], function(i,mod) {
|
||||||
if (mod && mod.type == type) mods.push(mod);
|
if (mod && mod.type == type) mods.push(mod);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -264,16 +248,15 @@ window.getPortalShieldMitigation = function(d) {
|
|||||||
return mitigation;
|
return mitigation;
|
||||||
}
|
}
|
||||||
|
|
||||||
window.getPortalLinksMitigation = function(d) {
|
window.getPortalLinksMitigation = function(linkCount) {
|
||||||
var links = (d.portalV2.linkedEdges||[]).length;
|
var mitigation = Math.round(400/9*Math.atan(linkCount/Math.E));
|
||||||
var mitigation = Math.round(400/9*Math.atan(links/Math.E));
|
|
||||||
return mitigation;
|
return mitigation;
|
||||||
}
|
}
|
||||||
|
|
||||||
window.getPortalMitigationDetails = function(d) {
|
window.getPortalMitigationDetails = function(d,linkCount) {
|
||||||
var mitigation = {
|
var mitigation = {
|
||||||
shields: getPortalShieldMitigation(d),
|
shields: getPortalShieldMitigation(d),
|
||||||
links: getPortalLinksMitigation(d)
|
links: getPortalLinksMitigation(linkCount)
|
||||||
};
|
};
|
||||||
|
|
||||||
// mitigation is limited to 95% (as confirmed by Brandon Badger on G+)
|
// mitigation is limited to 95% (as confirmed by Brandon Badger on G+)
|
||||||
@ -311,16 +294,16 @@ 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,probableTeamStr) {
|
window.getPortalSummaryData = function(d) {
|
||||||
|
|
||||||
// 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 = 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
|
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.resonators) {
|
||||||
for (var x in d.resonatorArray.resonators) {
|
for (var x in d.resonators) {
|
||||||
if (d.resonatorArray.resonators[x]) resCount++;
|
if (d.resonators[x]) resCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var maxEnergy = getTotalPortalEnergy(d);
|
var maxEnergy = getTotalPortalEnergy(d);
|
||||||
@ -329,13 +312,13 @@ window.getPortalSummaryData = function(d,probableTeamStr) {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
level: level,
|
level: level,
|
||||||
title: d.descriptiveText.map.TITLE,
|
title: d.title,
|
||||||
image: d.imageByUrl && d.imageByUrl.imageUrl,
|
image: d.image,
|
||||||
resCount: resCount,
|
resCount: resCount,
|
||||||
latE6: d.locationE6.latE6,
|
latE6: d.latE6,
|
||||||
health: health,
|
health: health,
|
||||||
team: d.controllingTeam ? d.controllingTeam.team : probableTeamStr,
|
team: d.team,
|
||||||
lngE6: d.locationE6.lngE6,
|
lngE6: d.lngE6,
|
||||||
type: 'portal'
|
type: 'portal'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ window.smartphoneInfo = function(data) {
|
|||||||
var className = TEAM_TO_CSS[getTeam(details)];
|
var className = TEAM_TO_CSS[getTeam(details)];
|
||||||
if(OCTANTS[i] === 'N')
|
if(OCTANTS[i] === 'N')
|
||||||
className += ' north'
|
className += ' north'
|
||||||
var reso = details.resonatorArray.resonators[i];
|
var reso = details.resonators[i];
|
||||||
if(reso) {
|
if(reso) {
|
||||||
l = parseInt(reso.level);
|
l = parseInt(reso.level);
|
||||||
v = parseInt(reso.energyTotal);
|
v = parseInt(reso.energyTotal);
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @id iitc-plugin-draw-resonators@xelio
|
// @id iitc-plugin-draw-resonators@xelio
|
||||||
// @name IITC plugin: Draw resonators
|
// @name IITC plugin: Draw resonators
|
||||||
// @category Layer
|
// @category Deleted
|
||||||
// @version 0.5.0.@@DATETIMEVERSION@@
|
// @version 0.6.0.@@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@@
|
||||||
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Draw resonators on map for currently selected portal.
|
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Resonator deployment distance data is no longer available, as of 2014-05-23
|
||||||
// @include https://www.ingress.com/intel*
|
// @include https://www.ingress.com/intel*
|
||||||
// @include http://www.ingress.com/intel*
|
// @include http://www.ingress.com/intel*
|
||||||
// @match https://www.ingress.com/intel*
|
// @match https://www.ingress.com/intel*
|
||||||
@ -14,133 +14,3 @@
|
|||||||
// @grant none
|
// @grant none
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
@@PLUGINSTART@@
|
|
||||||
|
|
||||||
// PLUGIN START ////////////////////////////////////////////////////////
|
|
||||||
window.RESONATOR_MIN_ZOOM = 16;
|
|
||||||
|
|
||||||
// use own namespace for plugin
|
|
||||||
window.plugin.drawResonators = function() {};
|
|
||||||
|
|
||||||
window.plugin.drawResonators.levelLayerGroup = null;
|
|
||||||
|
|
||||||
window.plugin.drawResonators.portalSelected = function(data) {
|
|
||||||
// new portal selected - clear any existing resonators..
|
|
||||||
window.plugin.drawResonators.levelLayerGroup.clearLayers();
|
|
||||||
|
|
||||||
// then, if a portal is selected...
|
|
||||||
if (data.selectedPortalGuid) {
|
|
||||||
// draw it's resonators if we have it's details
|
|
||||||
var details = portalDetail.get(data.selectedPortalGuid);
|
|
||||||
if (details) {
|
|
||||||
window.plugin.drawResonators.drawData(details);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
window.plugin.drawResonators.portalDetailLoaded = function(data) {
|
|
||||||
// the detailed data for a portal was just loaded - if this is the selected portal, draw them
|
|
||||||
|
|
||||||
if (data.guid == window.selectedPortal) {
|
|
||||||
window.plugin.drawResonators.levelLayerGroup.clearLayers();
|
|
||||||
window.plugin.drawResonators.drawData(data.details);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
window.plugin.drawResonators.drawData = function(portalDetails) {
|
|
||||||
if(window.map.getZoom() < window.RESONATOR_MIN_ZOOM) return;
|
|
||||||
|
|
||||||
var portalLatLng = [portalDetails.locationE6.latE6/1E6, portalDetails.locationE6.lngE6/1E6];
|
|
||||||
for(var i in portalDetails.resonatorArray.resonators) {
|
|
||||||
resoData = portalDetails.resonatorArray.resonators[i];
|
|
||||||
if(resoData === null) continue;
|
|
||||||
|
|
||||||
var resoLatLng = window.plugin.drawResonators.getResonatorLatLng(resoData.distanceToPortal, resoData.slot, portalLatLng);
|
|
||||||
|
|
||||||
var resoMarker = window.plugin.drawResonators.createResoMarker(resoData, resoLatLng);
|
|
||||||
var connMarker = window.plugin.drawResonators.createConnMarker(resoData, resoLatLng, portalLatLng);
|
|
||||||
|
|
||||||
window.plugin.drawResonators.levelLayerGroup.addLayer(resoMarker);
|
|
||||||
window.plugin.drawResonators.levelLayerGroup.addLayer(connMarker);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
window.plugin.drawResonators.getResonatorLatLng = function(dist, slot, portalLatLng) {
|
|
||||||
// offset in meters
|
|
||||||
var dn = dist*SLOT_TO_LAT[slot];
|
|
||||||
var de = dist*SLOT_TO_LNG[slot];
|
|
||||||
|
|
||||||
// Coordinate offset in radians
|
|
||||||
var dLat = dn/EARTH_RADIUS;
|
|
||||||
var dLon = de/(EARTH_RADIUS*Math.cos(Math.PI/180*portalLatLng[0]));
|
|
||||||
|
|
||||||
// OffsetPosition, decimal degrees
|
|
||||||
var lat0 = portalLatLng[0] + dLat * 180/Math.PI;
|
|
||||||
var lon0 = portalLatLng[1] + dLon * 180/Math.PI;
|
|
||||||
|
|
||||||
return [lat0, lon0];
|
|
||||||
}
|
|
||||||
|
|
||||||
window.plugin.drawResonators.createResoMarker = function(resoData, resoLatLng) {
|
|
||||||
var resoProperty = {
|
|
||||||
fillColor: COLORS_LVL[resoData.level],
|
|
||||||
fillOpacity: resoData.energyTotal/RESO_NRG[resoData.level],
|
|
||||||
color: '#aaa',
|
|
||||||
weight: 1,
|
|
||||||
radius: 3,
|
|
||||||
opacity: 1,
|
|
||||||
clickable: false};
|
|
||||||
resoProperty.type = 'resonator';
|
|
||||||
resoProperty.details = resoData;
|
|
||||||
var reso = L.circleMarker(resoLatLng, resoProperty);
|
|
||||||
return reso;
|
|
||||||
}
|
|
||||||
|
|
||||||
window.plugin.drawResonators.createConnMarker = function(resoData, resoLatLng, portalLatLng) {
|
|
||||||
var connProperty = {
|
|
||||||
opacity: 0.25,
|
|
||||||
weight: 2,
|
|
||||||
color: '#FFA000',
|
|
||||||
dashArray: '0,10' + (new Array(25).join(',8,4')),
|
|
||||||
fill: false,
|
|
||||||
clickable: false};
|
|
||||||
connProperty.type = 'connector';
|
|
||||||
connProperty.details = resoData;
|
|
||||||
var conn = L.polyline([portalLatLng, resoLatLng], connProperty);
|
|
||||||
return conn;
|
|
||||||
}
|
|
||||||
|
|
||||||
window.plugin.drawResonators.zoomListener = function() {
|
|
||||||
var ctrl = $('.leaflet-control-layers-selector + span:contains("Resonators")').parent();
|
|
||||||
if(window.map.getZoom() < window.RESONATOR_MIN_ZOOM) {
|
|
||||||
window.plugin.drawResonators.levelLayerGroup.clearLayers();
|
|
||||||
ctrl.addClass('disabled').attr('title', 'Zoom in to show those.');
|
|
||||||
} else {
|
|
||||||
ctrl.removeClass('disabled').attr('title', 'Select a portal to draw resos');
|
|
||||||
window.plugin.drawResonators.levelLayerGroup.clearLayers();
|
|
||||||
if (window.selectedPortal) {
|
|
||||||
var details = portalDetail.get(window.selectedPortal);
|
|
||||||
if (details) {
|
|
||||||
window.plugin.drawResonators.drawData(details);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
var setup = function() {
|
|
||||||
|
|
||||||
window.plugin.drawResonators.levelLayerGroup = new L.LayerGroup();
|
|
||||||
|
|
||||||
window.addLayerGroup('Resonators', window.plugin.drawResonators.levelLayerGroup, true);
|
|
||||||
|
|
||||||
window.addHook('portalSelected', window.plugin.drawResonators.portalSelected);
|
|
||||||
window.addHook('portalDetailLoaded', window.plugin.drawResonators.portalDetailLoaded);
|
|
||||||
|
|
||||||
window.map.on('zoomend', function() {
|
|
||||||
window.plugin.drawResonators.zoomListener();
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
// PLUGIN END //////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
@@PLUGINEND@@
|
|
||||||
|
@ -134,7 +134,7 @@ window.plugin.guessPlayerLevels.extractPortalData = function(data) {
|
|||||||
|
|
||||||
var owner = data.details.captured && data.details.captured.capturingPlayerId || "";
|
var owner = data.details.captured && data.details.captured.capturingPlayerId || "";
|
||||||
var ownerModCount = 0;
|
var ownerModCount = 0;
|
||||||
data.details.portalV2.linkedModArray.forEach(function(mod) {
|
data.details.mods.forEach(function(mod) {
|
||||||
if(mod && mod.installingUser == owner)
|
if(mod && mod.installingUser == owner)
|
||||||
ownerModCount++;
|
ownerModCount++;
|
||||||
});
|
});
|
||||||
@ -144,12 +144,12 @@ window.plugin.guessPlayerLevels.extractPortalData = function(data) {
|
|||||||
$.each(r, function(ind, reso) {
|
$.each(r, function(ind, reso) {
|
||||||
if(!reso) return true;
|
if(!reso) return true;
|
||||||
|
|
||||||
if(!players[reso.ownerGuid]) players[reso.ownerGuid] = [];
|
if(!players[reso.owner]) players[reso.owner] = [];
|
||||||
|
|
||||||
if(players[reso.ownerGuid][reso.level] === undefined)
|
if(players[reso.owner][reso.level] === undefined)
|
||||||
players[reso.ownerGuid][reso.level] = 1
|
players[reso.owner][reso.level] = 1
|
||||||
else
|
else
|
||||||
players[reso.ownerGuid][reso.level]++;
|
players[reso.owner][reso.level]++;
|
||||||
});
|
});
|
||||||
|
|
||||||
for(nickname in players) {
|
for(nickname in players) {
|
||||||
@ -422,7 +422,7 @@ window.plugin.guessPlayerLevels.guess = function() {
|
|||||||
var r = details.resonatorArray.resonators;
|
var r = details.resonatorArray.resonators;
|
||||||
$.each(r, function(ind, reso) {
|
$.each(r, function(ind, reso) {
|
||||||
if(!reso) return true;
|
if(!reso) return true;
|
||||||
var nick = reso.ownerGuid;
|
var nick = reso.owner;
|
||||||
if(isSystemPlayer(nick)) return true;
|
if(isSystemPlayer(nick)) return true;
|
||||||
|
|
||||||
var lvl = window.plugin.guessPlayerLevels.fetchLevelDetailsByPlayer(nick).min;
|
var lvl = window.plugin.guessPlayerLevels.fetchLevelDetailsByPlayer(nick).min;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// @id iitc-plugin-ipas-link@graphracer
|
// @id iitc-plugin-ipas-link@graphracer
|
||||||
// @name IITC Plugin: simulate an attack on portal
|
// @name IITC Plugin: simulate an attack on portal
|
||||||
// @category Portal Info
|
// @category Portal Info
|
||||||
// @version 0.2.1.@@DATETIMEVERSION@@
|
// @version 0.2.2.@@DATETIMEVERSION@@
|
||||||
// @namespace https://github.com/xosofox/IPAS
|
// @namespace https://github.com/xosofox/IPAS
|
||||||
// @updateURL @@UPDATEURL@@
|
// @updateURL @@UPDATEURL@@
|
||||||
// @downloadURL @@DOWNLOADURL@@
|
// @downloadURL @@DOWNLOADURL@@
|
||||||
@ -35,14 +35,14 @@ window.plugin.ipasLink.getHash = function (p) {
|
|||||||
var hashParts = [];
|
var hashParts = [];
|
||||||
$.each(details.resonatorArray.resonators, function (ind, reso) {
|
$.each(details.resonatorArray.resonators, function (ind, reso) {
|
||||||
if (reso)
|
if (reso)
|
||||||
hashParts.push(reso.level + "," + reso.distanceToPortal + "," + reso.energyTotal);
|
hashParts.push(reso.level + ",-1," + reso.energyTotal);
|
||||||
else
|
else
|
||||||
hashParts.push("1,20,0");
|
hashParts.push("1,20,0");
|
||||||
});
|
});
|
||||||
var resos = hashParts.join(";");
|
var resos = hashParts.join(";");
|
||||||
|
|
||||||
hashParts = [];
|
hashParts = [];
|
||||||
$.each(details.portalV2.linkedModArray, function (ind, mod) {
|
$.each(details.mods, function (ind, mod) {
|
||||||
// s - shields
|
// s - shields
|
||||||
// h - heat sink
|
// h - heat sink
|
||||||
// i - intentionally left in
|
// i - intentionally left in
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @id iitc-plugin-show-address@vita10gy
|
// @id iitc-plugin-show-address@vita10gy
|
||||||
// @name IITC plugin: show portal address in sidebar
|
// @name IITC plugin: show portal address in sidebar
|
||||||
// @category Portal Info
|
// @category Deleted
|
||||||
// @version 0.2.4.@@DATETIMEVERSION@@
|
// @version 0.3.0.@@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@@
|
||||||
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Portal address will show in the sidebar.
|
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Address no longer available, as of Niantic changes 2014-05-23
|
||||||
// @include https://www.ingress.com/intel*
|
// @include https://www.ingress.com/intel*
|
||||||
// @include http://www.ingress.com/intel*
|
// @include http://www.ingress.com/intel*
|
||||||
// @match https://www.ingress.com/intel*
|
// @match https://www.ingress.com/intel*
|
||||||
@ -14,35 +14,3 @@
|
|||||||
// @grant none
|
// @grant none
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
@@PLUGINSTART@@
|
|
||||||
|
|
||||||
// PLUGIN START ////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// use own namespace for plugin
|
|
||||||
window.plugin.portalAddress = function() {};
|
|
||||||
|
|
||||||
window.plugin.portalAddress.portalDetail = function(data) {
|
|
||||||
// If there's 4 sets of comma delimited info the last one is the
|
|
||||||
// country, so get rid of it. If the country is in the [2] then it
|
|
||||||
// doesn't matter because address is usually short enough to fit.
|
|
||||||
var d = data.portalDetails;
|
|
||||||
var address = d.descriptiveText.map.ADDRESS;
|
|
||||||
if (address) {
|
|
||||||
address = address.split(',').splice(0,3).join(',');
|
|
||||||
$('.imgpreview').append('<div id="address">'+address+'</div>');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
var setup = function() {
|
|
||||||
window.addHook('portalDetailsUpdated', window.plugin.portalAddress.portalDetail);
|
|
||||||
$('head').append('<style>' +
|
|
||||||
'.res #address { border: 1px solid #0076b6; }' +
|
|
||||||
'.enl #address { border: 1px solid #017f01; }' +
|
|
||||||
'#address { position: absolute; bottom: 0; left: 5px; right: 8px; padding: 3px; font-size: 11px; background-color: rgba(0, 0, 0, 0.7); text-align: center; overflow: hidden; }' +
|
|
||||||
'</style>');
|
|
||||||
}
|
|
||||||
|
|
||||||
// PLUGIN END //////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
@@PLUGINEND@@
|
|
||||||
|
@ -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.2.@@DATETIMEVERSION@@
|
// @version 0.2.0.@@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@@
|
||||||
@ -41,11 +41,17 @@ window.plugin.showLinkedPortal.portalDetail = function (data) {
|
|||||||
// if (data.portalDetails.controllingTeam.team == 'NEUTRAL')
|
// if (data.portalDetails.controllingTeam.team == 'NEUTRAL')
|
||||||
// return;
|
// return;
|
||||||
|
|
||||||
var d = data.portalDetails.portalV2,
|
var portalLinks = getPortalLinks(data.guid);
|
||||||
c = 1;
|
|
||||||
//get linked portals
|
var c = 1;
|
||||||
$(d.linkedEdges).each(function () {
|
|
||||||
var portalInfo = window.plugin.showLinkedPortal.getPortalByGuid(this.otherPortalGuid, this.isOrigin);
|
$(portalLinks.out).each(function () {
|
||||||
|
var portalInfo = window.plugin.showLinkedPortal.getPortalByGuid(this.otherPortalGuid, true);
|
||||||
|
$('#portaldetails').append('<div class="showLinkedPortalLink showLinkedPortalLink' + c + '" id="showLinkedPortalLink_' + c + '" data-guid="' + this.otherPortalGuid + '">' + portalInfo + '</div>');
|
||||||
|
c = c + 1;
|
||||||
|
});
|
||||||
|
$(portalLinks.in).each(function () {
|
||||||
|
var portalInfo = window.plugin.showLinkedPortal.getPortalByGuid(this.otherPortalGuid, false);
|
||||||
$('#portaldetails').append('<div class="showLinkedPortalLink showLinkedPortalLink' + c + '" id="showLinkedPortalLink_' + c + '" data-guid="' + this.otherPortalGuid + '">' + portalInfo + '</div>');
|
$('#portaldetails').append('<div class="showLinkedPortalLink showLinkedPortalLink' + c + '" id="showLinkedPortalLink_' + c + '" data-guid="' + this.otherPortalGuid + '">' + portalInfo + '</div>');
|
||||||
c = c + 1;
|
c = c + 1;
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user