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
|
||||
// to. Uses TEAM_* enum values.
|
||||
window.getTeam = function(details) {
|
||||
return teamStringToId(details.controllingTeam && details.controllingTeam.team);
|
||||
return teamStringToId(details.team);
|
||||
}
|
||||
|
||||
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
|
||||
var details = portalDetail.get(guid);
|
||||
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
|
||||
|
@ -28,9 +28,7 @@ window.renderPortalDetails = function(guid) {
|
||||
|
||||
// details and data can get out of sync. if we have details, construct a matching 'data'
|
||||
if (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);
|
||||
data = getPortalSummaryData(details);
|
||||
}
|
||||
|
||||
|
||||
@ -42,7 +40,7 @@ window.renderPortalDetails = function(guid) {
|
||||
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 lat = data.latE6/1E6;
|
||||
@ -165,10 +163,8 @@ window.getPortalMiscDetails = function(guid,d) {
|
||||
if (d) {
|
||||
|
||||
// collect some random data that’s not worth to put in an own method
|
||||
var links = {incoming: 0, outgoing: 0};
|
||||
$.each(d.portalV2.linkedEdges||[], function(ind, link) {
|
||||
links[link.isOrigin ? 'outgoing' : 'incoming']++;
|
||||
});
|
||||
var linkInfo = getPortalLinks(guid);
|
||||
var links = {incoming: linkInfo.in.length, outgoing: linkInfo.out.length};
|
||||
|
||||
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')];
|
||||
@ -189,6 +185,8 @@ window.getPortalMiscDetails = function(guid,d) {
|
||||
|
||||
var linkedFields = ['fields', fieldCount];
|
||||
|
||||
var linkCount = getPortalLinksCount(guid);
|
||||
|
||||
// collect and html-ify random data
|
||||
var randDetailsData = [];
|
||||
if (playerText && sinceText) {
|
||||
@ -197,9 +195,9 @@ window.getPortalMiscDetails = function(guid,d) {
|
||||
|
||||
randDetailsData.push (
|
||||
getRangeText(d), getEnergyText(d),
|
||||
linksText, getAvgResoDistText(d),
|
||||
linkedFields, getAttackApGainText(d,fieldCount),
|
||||
getHackDetailsText(d), getMitigationText(d)
|
||||
linksText, ['-','-'],
|
||||
linkedFields, getAttackApGainText(d,fieldCount,linkCount),
|
||||
getHackDetailsText(d), getMitigationText(d,linkCount)
|
||||
);
|
||||
|
||||
// artifact details
|
||||
|
@ -24,20 +24,22 @@ window.getRangeText = function(d) {
|
||||
|
||||
// generates description text from details for portal
|
||||
window.getPortalDescriptionFromDetails = function(details) {
|
||||
var descObj = details.descriptiveText.map;
|
||||
// FIXME: also get real description?
|
||||
var desc = descObj.TITLE;
|
||||
if(descObj.ADDRESS)
|
||||
desc += '\n' + descObj.ADDRESS;
|
||||
// if(descObj.ATTRIBUTION)
|
||||
// desc += '\nby '+descObj.ATTRIBUTION+' ('+descObj.ATTRIBUTION_LINK+')';
|
||||
return desc;
|
||||
return details.title || '(untitled)';
|
||||
|
||||
// var descObj = details.descriptiveText.map;
|
||||
// // FIXME: also get real description?
|
||||
// var desc = descObj.TITLE;
|
||||
// if(descObj.ADDRESS)
|
||||
// desc += '\n' + descObj.ADDRESS;
|
||||
//// if(descObj.ATTRIBUTION)
|
||||
//// desc += '\nby '+descObj.ATTRIBUTION+' ('+descObj.ATTRIBUTION_LINK+')';
|
||||
// return desc;
|
||||
}
|
||||
|
||||
// Grabs more info, including the submitter name for the current main
|
||||
// portal image
|
||||
window.getPortalDescriptionFromDetailsExtended = function(details) {
|
||||
var descObj = details.descriptiveText.map;
|
||||
var descObj = details.title;
|
||||
var photoStreamObj = details.photoStreamInfo;
|
||||
|
||||
var submitterObj = new Object();
|
||||
@ -79,7 +81,7 @@ window.getModDetails = function(d) {
|
||||
var mods = [];
|
||||
var modsTitle = [];
|
||||
var modsColor = [];
|
||||
$.each(d.portalV2.linkedModArray, function(ind, mod) {
|
||||
$.each(d.mods, function(ind, mod) {
|
||||
var modName = '';
|
||||
var modTooltip = '';
|
||||
var modColor = '#000';
|
||||
@ -88,13 +90,7 @@ window.getModDetails = function(d) {
|
||||
// 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
|
||||
|
||||
if (mod.displayName) {
|
||||
modName = mod.displayName;
|
||||
} else if (mod.type) {
|
||||
modName = mod.type;
|
||||
} else {
|
||||
modName = '(unknown mod)';
|
||||
}
|
||||
modName = mod.name || '(unknown mod)';
|
||||
|
||||
if (mod.rarity) {
|
||||
modName = mod.rarity.capitalize().replace(/_/g,' ') + ' ' + modName;
|
||||
@ -137,10 +133,12 @@ window.getModDetails = function(d) {
|
||||
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>'
|
||||
+ '<span'+(modsTitle[2].length ? ' title="'+modsTitle[2]+'"' : '')+' style="color:'+modsColor[2]+'">'+mods[2]+'</span>'
|
||||
+ '<span'+(modsTitle[3].length ? ' title="'+modsTitle[3]+'"' : '')+' style="color:'+modsColor[3]+'">'+mods[3]+'</span>'
|
||||
|
||||
var t = '';
|
||||
for (var i=0; i<mods.length; i++) {
|
||||
t += '<span'+(modsTitle[i].length ? ' title="'+modsTitle[i]+'"' : '')+' style="color:'+modsColor[i]+'">'+mods[i]+'</span>'
|
||||
}
|
||||
|
||||
|
||||
return t;
|
||||
}
|
||||
@ -153,10 +151,6 @@ window.getEnergyText = function(d) {
|
||||
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) {
|
||||
var resoDetails = [];
|
||||
@ -168,7 +162,7 @@ window.getResonatorDetails = function(d) {
|
||||
// SW S
|
||||
|
||||
$.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) {
|
||||
resoDetails.push(renderResonatorDetails(slot, 0, 0, null, null));
|
||||
return true;
|
||||
@ -176,13 +170,12 @@ window.getResonatorDetails = function(d) {
|
||||
|
||||
var l = parseInt(reso.level);
|
||||
var v = parseInt(reso.energyTotal);
|
||||
var nick = reso.ownerGuid;
|
||||
var dist = reso.distanceToPortal;
|
||||
var nick = reso.owner;
|
||||
// if array order and slot order drift apart, at least the octant
|
||||
// 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>';
|
||||
|
||||
@ -231,7 +224,7 @@ window.getAttackApGainText = function(d,fieldCount) {
|
||||
|
||||
function tt(text) {
|
||||
var t = '';
|
||||
if (d.controllingTeam && PLAYER.team == d.controllingTeam.team) {
|
||||
if (PLAYER.team == d.team) {
|
||||
totalGain = breakdown.friendlyAp;
|
||||
t += 'Friendly AP:\t' + breakdown.friendlyAp + '\n';
|
||||
t += ' Deploy ' + breakdown.deployCount + ', ';
|
||||
@ -266,8 +259,8 @@ window.getHackDetailsText = function(d) {
|
||||
}
|
||||
|
||||
|
||||
window.getMitigationText = function(d) {
|
||||
var mitigationDetails = getPortalMitigationDetails(d);
|
||||
window.getMitigationText = function(d,linkCount) {
|
||||
var mitigationDetails = getPortalMitigationDetails(d,linkCount);
|
||||
|
||||
var mitigationShort = mitigationDetails.total;
|
||||
if (mitigationDetails.excess) mitigationShort += ' (+'+mitigationDetails.excess+')';
|
||||
|
@ -7,7 +7,7 @@
|
||||
window.getPortalLevel = function(d) {
|
||||
var lvl = 0;
|
||||
var hasReso = false;
|
||||
$.each(d.resonatorArray.resonators, function(ind, reso) {
|
||||
$.each(d.resonators, function(ind, reso) {
|
||||
if(!reso) return true;
|
||||
lvl += parseInt(reso.level);
|
||||
hasReso = true;
|
||||
@ -17,7 +17,7 @@ window.getPortalLevel = function(d) {
|
||||
|
||||
window.getTotalPortalEnergy = function(d) {
|
||||
var nrg = 0;
|
||||
$.each(d.resonatorArray.resonators, function(ind, reso) {
|
||||
$.each(d.resonators, function(ind, reso) {
|
||||
if(!reso) return true;
|
||||
var level = parseInt(reso.level);
|
||||
var max = RESO_NRG[level];
|
||||
@ -31,7 +31,7 @@ window.getPortalEnergy = window.getTotalPortalEnergy;
|
||||
|
||||
window.getCurrentPortalEnergy = function(d) {
|
||||
var nrg = 0;
|
||||
$.each(d.resonatorArray.resonators, function(ind, reso) {
|
||||
$.each(d.resonators, function(ind, reso) {
|
||||
if(!reso) return true;
|
||||
nrg += parseInt(reso.energyTotal);
|
||||
});
|
||||
@ -44,7 +44,7 @@ window.getPortalRange = function(d) {
|
||||
|
||||
var lvl = 0;
|
||||
var resoMissing = false;
|
||||
$.each(d.resonatorArray.resonators, function(ind, reso) {
|
||||
$.each(d.resonators, function(ind, reso) {
|
||||
if(!reso) {
|
||||
resoMissing = true;
|
||||
return;
|
||||
@ -88,19 +88,7 @@ window.getLinkAmpRangeBoost = function(d) {
|
||||
}
|
||||
|
||||
|
||||
window.getAvgResoDist = function(d) {
|
||||
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) {
|
||||
window.getAttackApGain = function(d,fieldCount,linkCount) {
|
||||
if (!fieldCount) fieldCount = 0;
|
||||
|
||||
var resoCount = 0;
|
||||
@ -110,13 +98,12 @@ window.getAttackApGain = function(d,fieldCount) {
|
||||
for(var n = PLAYER.level + 1; n < 9; n++) {
|
||||
maxResonators[n] = 0;
|
||||
}
|
||||
$.each(d.resonatorArray.resonators, function(ind, reso) {
|
||||
$.each(d.resonators, function(ind, reso) {
|
||||
if(!reso)
|
||||
return true;
|
||||
resoCount += 1;
|
||||
var reslevel=parseInt(reso.level);
|
||||
// NOTE: reso.ownerGuid is actually the name - no player GUIDs are visible in the protocol any more
|
||||
if(reso.ownerGuid === PLAYER.nickname) {
|
||||
if(reso.owner === PLAYER.nickname) {
|
||||
if(maxResonators[reslevel] > 0) {
|
||||
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 linkAp = linkCount * DESTROY_LINK;
|
||||
@ -162,8 +147,8 @@ window.potentialPortalLevel = function(d) {
|
||||
var current_level = getPortalLevel(d);
|
||||
var potential_level = current_level;
|
||||
|
||||
if(d.controllingTeam && PLAYER.team === d.controllingTeam.team) {
|
||||
var resonators_on_portal = d.resonatorArray.resonators;
|
||||
if(PLAYER.team === d.team) {
|
||||
var resonators_on_portal = d.resonators;
|
||||
var resonator_levels = new Array();
|
||||
// figure out how many of each of these resonators can be placed by the player
|
||||
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];
|
||||
}
|
||||
$.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.ownerGuid === window.PLAYER.nickname) {
|
||||
if(reso !== null && reso.owner === window.PLAYER.nickname) {
|
||||
player_resontators[reso.level]--;
|
||||
}
|
||||
resonator_levels.push(reso === null ? 0 : reso.level);
|
||||
@ -217,7 +201,7 @@ window.fixPortalImageUrl = function(url) {
|
||||
window.getPortalModsByType = function(d, type) {
|
||||
var mods = [];
|
||||
|
||||
$.each(d.portalV2.linkedModArray || [], function(i,mod) {
|
||||
$.each(d.mods || [], function(i,mod) {
|
||||
if (mod && mod.type == type) mods.push(mod);
|
||||
});
|
||||
|
||||
@ -264,16 +248,15 @@ window.getPortalShieldMitigation = function(d) {
|
||||
return mitigation;
|
||||
}
|
||||
|
||||
window.getPortalLinksMitigation = function(d) {
|
||||
var links = (d.portalV2.linkedEdges||[]).length;
|
||||
var mitigation = Math.round(400/9*Math.atan(links/Math.E));
|
||||
window.getPortalLinksMitigation = function(linkCount) {
|
||||
var mitigation = Math.round(400/9*Math.atan(linkCount/Math.E));
|
||||
return mitigation;
|
||||
}
|
||||
|
||||
window.getPortalMitigationDetails = function(d) {
|
||||
window.getPortalMitigationDetails = function(d,linkCount) {
|
||||
var mitigation = {
|
||||
shields: getPortalShieldMitigation(d),
|
||||
links: getPortalLinksMitigation(d)
|
||||
links: getPortalLinksMitigation(linkCount)
|
||||
};
|
||||
|
||||
// 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
|
||||
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
|
||||
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;
|
||||
if (d.resonatorArray && d.resonatorArray.resonators) {
|
||||
for (var x in d.resonatorArray.resonators) {
|
||||
if (d.resonatorArray.resonators[x]) resCount++;
|
||||
if (d.resonators) {
|
||||
for (var x in d.resonators) {
|
||||
if (d.resonators[x]) resCount++;
|
||||
}
|
||||
}
|
||||
var maxEnergy = getTotalPortalEnergy(d);
|
||||
@ -329,13 +312,13 @@ window.getPortalSummaryData = function(d,probableTeamStr) {
|
||||
|
||||
return {
|
||||
level: level,
|
||||
title: d.descriptiveText.map.TITLE,
|
||||
image: d.imageByUrl && d.imageByUrl.imageUrl,
|
||||
title: d.title,
|
||||
image: d.image,
|
||||
resCount: resCount,
|
||||
latE6: d.locationE6.latE6,
|
||||
latE6: d.latE6,
|
||||
health: health,
|
||||
team: d.controllingTeam ? d.controllingTeam.team : probableTeamStr,
|
||||
lngE6: d.locationE6.lngE6,
|
||||
team: d.team,
|
||||
lngE6: d.lngE6,
|
||||
type: 'portal'
|
||||
};
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ window.smartphoneInfo = function(data) {
|
||||
var className = TEAM_TO_CSS[getTeam(details)];
|
||||
if(OCTANTS[i] === 'N')
|
||||
className += ' north'
|
||||
var reso = details.resonatorArray.resonators[i];
|
||||
var reso = details.resonators[i];
|
||||
if(reso) {
|
||||
l = parseInt(reso.level);
|
||||
v = parseInt(reso.energyTotal);
|
||||
|
@ -1,12 +1,12 @@
|
||||
// ==UserScript==
|
||||
// @id iitc-plugin-draw-resonators@xelio
|
||||
// @name IITC plugin: Draw resonators
|
||||
// @category Layer
|
||||
// @version 0.5.0.@@DATETIMEVERSION@@
|
||||
// @category Deleted
|
||||
// @version 0.6.0.@@DATETIMEVERSION@@
|
||||
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
||||
// @updateURL @@UPDATEURL@@
|
||||
// @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 http://www.ingress.com/intel*
|
||||
// @match https://www.ingress.com/intel*
|
||||
@ -14,133 +14,3 @@
|
||||
// @grant none
|
||||
// ==/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 ownerModCount = 0;
|
||||
data.details.portalV2.linkedModArray.forEach(function(mod) {
|
||||
data.details.mods.forEach(function(mod) {
|
||||
if(mod && mod.installingUser == owner)
|
||||
ownerModCount++;
|
||||
});
|
||||
@ -144,12 +144,12 @@ window.plugin.guessPlayerLevels.extractPortalData = function(data) {
|
||||
$.each(r, function(ind, reso) {
|
||||
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)
|
||||
players[reso.ownerGuid][reso.level] = 1
|
||||
if(players[reso.owner][reso.level] === undefined)
|
||||
players[reso.owner][reso.level] = 1
|
||||
else
|
||||
players[reso.ownerGuid][reso.level]++;
|
||||
players[reso.owner][reso.level]++;
|
||||
});
|
||||
|
||||
for(nickname in players) {
|
||||
@ -422,7 +422,7 @@ window.plugin.guessPlayerLevels.guess = function() {
|
||||
var r = details.resonatorArray.resonators;
|
||||
$.each(r, function(ind, reso) {
|
||||
if(!reso) return true;
|
||||
var nick = reso.ownerGuid;
|
||||
var nick = reso.owner;
|
||||
if(isSystemPlayer(nick)) return true;
|
||||
|
||||
var lvl = window.plugin.guessPlayerLevels.fetchLevelDetailsByPlayer(nick).min;
|
||||
|
@ -2,7 +2,7 @@
|
||||
// @id iitc-plugin-ipas-link@graphracer
|
||||
// @name IITC Plugin: simulate an attack on portal
|
||||
// @category Portal Info
|
||||
// @version 0.2.1.@@DATETIMEVERSION@@
|
||||
// @version 0.2.2.@@DATETIMEVERSION@@
|
||||
// @namespace https://github.com/xosofox/IPAS
|
||||
// @updateURL @@UPDATEURL@@
|
||||
// @downloadURL @@DOWNLOADURL@@
|
||||
@ -35,14 +35,14 @@ window.plugin.ipasLink.getHash = function (p) {
|
||||
var hashParts = [];
|
||||
$.each(details.resonatorArray.resonators, function (ind, reso) {
|
||||
if (reso)
|
||||
hashParts.push(reso.level + "," + reso.distanceToPortal + "," + reso.energyTotal);
|
||||
hashParts.push(reso.level + ",-1," + reso.energyTotal);
|
||||
else
|
||||
hashParts.push("1,20,0");
|
||||
});
|
||||
var resos = hashParts.join(";");
|
||||
|
||||
hashParts = [];
|
||||
$.each(details.portalV2.linkedModArray, function (ind, mod) {
|
||||
$.each(details.mods, function (ind, mod) {
|
||||
// s - shields
|
||||
// h - heat sink
|
||||
// i - intentionally left in
|
||||
|
@ -1,12 +1,12 @@
|
||||
// ==UserScript==
|
||||
// @id iitc-plugin-show-address@vita10gy
|
||||
// @name IITC plugin: show portal address in sidebar
|
||||
// @category Portal Info
|
||||
// @version 0.2.4.@@DATETIMEVERSION@@
|
||||
// @category Deleted
|
||||
// @version 0.3.0.@@DATETIMEVERSION@@
|
||||
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
||||
// @updateURL @@UPDATEURL@@
|
||||
// @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 http://www.ingress.com/intel*
|
||||
// @match https://www.ingress.com/intel*
|
||||
@ -14,35 +14,3 @@
|
||||
// @grant none
|
||||
// ==/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
|
||||
// @name IITC plugin: Show linked portals
|
||||
// @category Portal Info
|
||||
// @version 0.1.2.@@DATETIMEVERSION@@
|
||||
// @version 0.2.0.@@DATETIMEVERSION@@
|
||||
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
||||
// @updateURL @@UPDATEURL@@
|
||||
// @downloadURL @@DOWNLOADURL@@
|
||||
@ -41,11 +41,17 @@ window.plugin.showLinkedPortal.portalDetail = function (data) {
|
||||
// if (data.portalDetails.controllingTeam.team == 'NEUTRAL')
|
||||
// return;
|
||||
|
||||
var d = data.portalDetails.portalV2,
|
||||
c = 1;
|
||||
//get linked portals
|
||||
$(d.linkedEdges).each(function () {
|
||||
var portalInfo = window.plugin.showLinkedPortal.getPortalByGuid(this.otherPortalGuid, this.isOrigin);
|
||||
var portalLinks = getPortalLinks(data.guid);
|
||||
|
||||
var c = 1;
|
||||
|
||||
$(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>');
|
||||
c = c + 1;
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user