Merge branch 'master' into new-map-data
Conflicts: plugins/portal-highlighter-mods.user.js
This commit is contained in:
commit
de608c3174
@ -4,6 +4,7 @@ So far, these people have contributed:
|
|||||||
[blakjakau](https://github.com/blakjakau),
|
[blakjakau](https://github.com/blakjakau),
|
||||||
[boombuler](https://github.com/boombuler),
|
[boombuler](https://github.com/boombuler),
|
||||||
[breunigs](https://github.com/breunigs),
|
[breunigs](https://github.com/breunigs),
|
||||||
|
[cathesaurus](https://github.com/cathesaurus),
|
||||||
[ccjon](https://github.com/ccjon),
|
[ccjon](https://github.com/ccjon),
|
||||||
[cmrn](https://github.com/cmrn),
|
[cmrn](https://github.com/cmrn),
|
||||||
[epf](https://github.com/epf),
|
[epf](https://github.com/epf),
|
||||||
@ -25,4 +26,4 @@ So far, these people have contributed:
|
|||||||
[vita10gy](https://github.com/vita10gy),
|
[vita10gy](https://github.com/vita10gy),
|
||||||
[Xelio](https://github.com/Xelio),
|
[Xelio](https://github.com/Xelio),
|
||||||
[ZauberNerd](https://github.com/ZauberNerd),
|
[ZauberNerd](https://github.com/ZauberNerd),
|
||||||
[waynn](https://github.com/waynn)
|
[waynn](https://github.com/waynn)
|
||||||
|
38
README.md
38
README.md
@ -8,17 +8,41 @@ I've created this one to continue some development.
|
|||||||
|
|
||||||
Just want to download/install IITC? Go to http://iitc.jonatkins.com/
|
Just want to download/install IITC? Go to http://iitc.jonatkins.com/
|
||||||
|
|
||||||
|
For keeping up with the latest news, release announcements, etc, Follow IITC on G+
|
||||||
|
https://plus.google.com/105383756361375410867/posts
|
||||||
|
|
||||||
|
If you have questions, need help or advice with IITC, the Google+ community is a good place to start.
|
||||||
|
https://plus.google.com/communities/105647403088015055797
|
||||||
|
|
||||||
|
Want to report a bug? Post it to the issues page
|
||||||
|
https://github.com/jonatkins/ingress-intel-total-conversion/issues
|
||||||
|
|
||||||
## Developers
|
## Developers
|
||||||
|
|
||||||
This Github page is for those interested in developing IITC further.
|
This Github page is for those interested in developing IITC further.
|
||||||
|
|
||||||
### Roadmap
|
### Quickstart
|
||||||
|
|
||||||
Assuming I don't get a takedown notice any time soon, the initial plans are:
|
To build the browser scripts from source you will need Python (either a late version 2.x, or 3.0+). It should
|
||||||
|
build correctly on Linux and Windows (and, probably, Macs, FreeBSD, etc)
|
||||||
|
|
||||||
1. **DONE** Make it easy to rebuild IITC for a new server - will make it easier for development, plus allow others to fork the project for their own use
|
Fork this project, clone to your local machine.
|
||||||
2. **DONE** Clean up version number handling. Add fork/build info to both IITC and the plugins
|
|
||||||
3. **DONE** Add separate meta.js files for update checking - reduces load on the web server
|
|
||||||
4. Get IITC Mobile working, and easily rebuilt for custom development builds/forks
|
|
||||||
|
|
||||||
Plus, of course, pulling in any patches/bugfixes.
|
Run the ```build.py local``` script to build the code.
|
||||||
|
|
||||||
|
If all goes well, output of the build will end up in ```build/local``` subfolder.
|
||||||
|
|
||||||
|
You can create a custom build settings file, ```localbuildsettings.py``` - look in the supplied
|
||||||
|
```buildsettings.py``` for details.
|
||||||
|
|
||||||
|
#### Mobile
|
||||||
|
|
||||||
|
To build the mobile app, along with python, you will need
|
||||||
|
|
||||||
|
- The Java JDK (development kit - the runtime JRE is not enough)
|
||||||
|
- The Android SDK
|
||||||
|
|
||||||
|
Run ``build.py mobile``` to build IITC Mobile in debug mode.
|
||||||
|
|
||||||
|
Note that part of the build.py process includes copying the IITC script files into the ```mobile/res``` subfolder.
|
||||||
|
If this isn't done (e.g. you build IITC Mobile directly from Eclipse) you will end up with a broken build.
|
||||||
|
64
plugins/portal-highlighter-imminent-decay.user.js
Normal file
64
plugins/portal-highlighter-imminent-decay.user.js
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
// ==UserScript==
|
||||||
|
// @id iitc-plugin-highlight-imminent-decay@cathesaurus
|
||||||
|
// @name IITC plugin: highlight portals with resonators about to decay
|
||||||
|
// @category Highlighter
|
||||||
|
// @version 0.1.0.@@DATETIMEVERSION@@
|
||||||
|
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
||||||
|
// @updateURL @@UPDATEURL@@
|
||||||
|
// @downloadURL @@DOWNLOADURL@@
|
||||||
|
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Uses the fill color of the portals to show resonators due to decay within the next day. Red = portal will decay completely, orange = portal will drop all links, yellow = one or more resonators will decay completely.
|
||||||
|
// @include https://www.ingress.com/intel*
|
||||||
|
// @include http://www.ingress.com/intel*
|
||||||
|
// @match https://www.ingress.com/intel*
|
||||||
|
// @match http://www.ingress.com/intel*
|
||||||
|
// @grant none
|
||||||
|
// ==/UserScript==
|
||||||
|
|
||||||
|
@@PLUGINSTART@@
|
||||||
|
|
||||||
|
// PLUGIN START ////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// use own namespace for plugin
|
||||||
|
window.plugin.portalHighlighterImminentDecay = function() {};
|
||||||
|
|
||||||
|
window.plugin.portalHighlighterImminentDecay.highlight = function(data) {
|
||||||
|
var d = data.portal.options.details;
|
||||||
|
if(getTeam(d) !== 0) {
|
||||||
|
//Check the energy of every resonator.
|
||||||
|
var resImminentDecayCount = 0;
|
||||||
|
var resCount = 0;
|
||||||
|
$.each(d.resonatorArray.resonators, function(ind, reso) {
|
||||||
|
if(reso !== null) {
|
||||||
|
var level = parseInt(reso.level);
|
||||||
|
var maxResonatorEnergy = window.RESO_NRG[level];
|
||||||
|
var currentResonatorEnergy = parseInt(reso.energyTotal);
|
||||||
|
if((currentResonatorEnergy / maxResonatorEnergy) < 0.15) {
|
||||||
|
resImminentDecayCount++;
|
||||||
|
}
|
||||||
|
resCount++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if(resImminentDecayCount > 0) {
|
||||||
|
if(resImminentDecayCount === resCount) {
|
||||||
|
var color = 'red';
|
||||||
|
} else if((resCount - resImminentDecayCount) < 3) {
|
||||||
|
color = 'orange';
|
||||||
|
} else {
|
||||||
|
color = 'yellow';
|
||||||
|
}
|
||||||
|
// Apply colour to portal.
|
||||||
|
var params = {fillColor: color, fillOpacity: 1};
|
||||||
|
data.portal.setStyle(params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
window.COLOR_SELECTED_PORTAL = '#f0f';
|
||||||
|
}
|
||||||
|
|
||||||
|
var setup = function() {
|
||||||
|
window.addPortalHighlighter('Imminent Decay', window.plugin.portalHighlighterImminentDecay.highlight);
|
||||||
|
}
|
||||||
|
|
||||||
|
// PLUGIN END //////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@@PLUGINEND@@
|
@ -57,19 +57,23 @@ window.plugin.portalHighligherMods.highlight = function(data, mod_type) {
|
|||||||
window.plugin.portalHighligherMods.highlightNoMods = function(data) {
|
window.plugin.portalHighligherMods.highlightNoMods = function(data) {
|
||||||
var d = data.portal.options.details;
|
var d = data.portal.options.details;
|
||||||
|
|
||||||
var mods = false;
|
var mods = 0;
|
||||||
$.each(d.portalV2.linkedModArray, function(ind, mod) {
|
$.each(d.portalV2.linkedModArray, function(ind, mod) {
|
||||||
if(mod !== null) {
|
if(mod !== null) {
|
||||||
mods = true;
|
mods += 1;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if(!mods) {
|
if(mods == 0) {
|
||||||
var fill_opacity = .6;
|
var fill_opacity = .6;
|
||||||
var color = 'red';
|
var color = 'red';
|
||||||
var params = {fillColor: color, fillOpacity: fill_opacity};
|
var params = {fillColor: color, fillOpacity: fill_opacity};
|
||||||
data.portal.setStyle(params);
|
data.portal.setStyle(params);
|
||||||
|
} else if(mods <4) {
|
||||||
|
var fill_opacity = .6;
|
||||||
|
var color = 'yellow';
|
||||||
|
var params = {fillColor: color, fillOpacity: fill_opacity};
|
||||||
|
data.portal.setStyle(params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ window.plugin.scoreboard.resetTeam = function(team) {
|
|||||||
scores[team]['count_links'] = 0;
|
scores[team]['count_links'] = 0;
|
||||||
scores[team]['count_portals'] = 0;
|
scores[team]['count_portals'] = 0;
|
||||||
scores[team]['count_resonators'] = 0;
|
scores[team]['count_resonators'] = 0;
|
||||||
|
scores[team]['count_mods'] = 0;
|
||||||
scores[team]['link_length'] = 0;
|
scores[team]['link_length'] = 0;
|
||||||
scores[team]['field_area'] = 0;
|
scores[team]['field_area'] = 0;
|
||||||
scores[team]['largest'] = {};
|
scores[team]['largest'] = {};
|
||||||
@ -50,7 +51,7 @@ window.plugin.scoreboard.initPlayer = function(player, team) {
|
|||||||
scores[player]['link_length'] = 0;
|
scores[player]['link_length'] = 0;
|
||||||
scores[player]['field_area'] = 0;
|
scores[player]['field_area'] = 0;
|
||||||
|
|
||||||
// scores[player]['count_shields'] = 0;
|
scores[player]['count_mods'] = 0;
|
||||||
scores[player]['largest'] = {};
|
scores[player]['largest'] = {};
|
||||||
window.plugin.scoreboard.playerGuids.push(player);
|
window.plugin.scoreboard.playerGuids.push(player);
|
||||||
}
|
}
|
||||||
@ -67,8 +68,6 @@ window.plugin.scoreboard.compileStats = function() {
|
|||||||
$.each(window.fields, function(qk, val) {
|
$.each(window.fields, function(qk, val) {
|
||||||
|
|
||||||
var team = getTeam(val.options.data);
|
var team = getTeam(val.options.data);
|
||||||
var player = val.options.data.creator.creatorGuid;
|
|
||||||
window.plugin.scoreboard.initPlayer(player,team);
|
|
||||||
|
|
||||||
// Google sends fields long since dead in the data. This makes sure it's still actually up.
|
// Google sends fields long since dead in the data. This makes sure it's still actually up.
|
||||||
if(window.portals[val.options.vertices.vertexA.guid] !== undefined ||
|
if(window.portals[val.options.vertices.vertexA.guid] !== undefined ||
|
||||||
@ -77,25 +76,9 @@ window.plugin.scoreboard.compileStats = function() {
|
|||||||
|
|
||||||
var fieldArea = window.plugin.scoreboard.fieldArea(val);
|
var fieldArea = window.plugin.scoreboard.fieldArea(val);
|
||||||
somethingInView = true;
|
somethingInView = true;
|
||||||
scores['team'][team]['mu'] += parseInt(val.options.data.entityScore.entityScore);
|
|
||||||
scores['player'][player]['mu'] += parseInt(val.options.data.entityScore.entityScore);
|
|
||||||
scores['team'][team]['count_fields']++;
|
scores['team'][team]['count_fields']++;
|
||||||
scores['player'][player]['count_fields']++;
|
|
||||||
scores['team'][team]['field_area'] += fieldArea;
|
scores['team'][team]['field_area'] += fieldArea;
|
||||||
scores['player'][player]['field_area'] += fieldArea;
|
|
||||||
val.options.data.fieldArea = fieldArea;
|
val.options.data.fieldArea = fieldArea;
|
||||||
var largestMu = scores['team'][team]['largest']['mu'];
|
|
||||||
if(largestMu === undefined || parseInt(largestMu.options.data.entityScore.entityScore) < parseInt(val.options.data.entityScore.entityScore)) {
|
|
||||||
largestMu = val;
|
|
||||||
}
|
|
||||||
scores['team'][team]['largest']['mu'] = largestMu;
|
|
||||||
|
|
||||||
//var largestMu = scores['player'][player]['largest']['mu'];
|
|
||||||
//if(largestMu === undefined || parseInt(largestMu.options.data.entityScore.entityScore) < parseInt(val.options.data.entityScore.entityScore)) {
|
|
||||||
// largestMu = val;
|
|
||||||
//}
|
|
||||||
//scores['player'][player]['largest']['mu'] = largestMu;
|
|
||||||
|
|
||||||
var largestArea = scores['team'][team]['largest']['field_area'];
|
var largestArea = scores['team'][team]['largest']['field_area'];
|
||||||
if(largestArea === undefined || largestArea.options.data.fieldArea < val.options.data.fieldArea) {
|
if(largestArea === undefined || largestArea.options.data.fieldArea < val.options.data.fieldArea) {
|
||||||
largestArea = val;
|
largestArea = val;
|
||||||
@ -107,30 +90,19 @@ window.plugin.scoreboard.compileStats = function() {
|
|||||||
$.each(window.links, function(qk, link) {
|
$.each(window.links, function(qk, link) {
|
||||||
somethingInView = true;
|
somethingInView = true;
|
||||||
var team = getTeam(link.options.data);
|
var team = getTeam(link.options.data);
|
||||||
if(link.options.data.creator !== undefined) {
|
|
||||||
var player = link.options.data.creator.creatorGuid;
|
scores['team'][team]['count_links']++;
|
||||||
window.plugin.scoreboard.initPlayer(player, team);
|
|
||||||
scores['team'][team]['count_links']++;
|
var linkLength = window.plugin.scoreboard.portalDistance(link.options.data.edge.destinationPortalLocation,link.options.data.edge.originPortalLocation);
|
||||||
scores['player'][player]['count_links']++;
|
scores['team'][team]['link_length'] += linkLength;
|
||||||
|
|
||||||
var linkLength = window.plugin.scoreboard.portalDistance(link.options.data.edge.destinationPortalLocation,link.options.data.edge.originPortalLocation);
|
var largestLink = scores['team'][team]['largest']['link'];
|
||||||
scores['team'][team]['link_length'] += linkLength;
|
if(largestLink === undefined || largestLink.distance < linkLength) {
|
||||||
scores['player'][player]['link_length'] += linkLength;
|
largestLink = {};
|
||||||
|
largestLink.distance = linkLength;
|
||||||
var largestLink = scores['team'][team]['largest']['link'];
|
|
||||||
if(largestLink === undefined || largestLink.distance < linkLength) {
|
|
||||||
largestLink = {};
|
|
||||||
largestLink.distance = linkLength;
|
|
||||||
largestLink.player = player;
|
|
||||||
}
|
|
||||||
scores['team'][team]['largest']['link'] = largestLink;
|
|
||||||
|
|
||||||
//var largestLink = scores['player'][player]['largest']['link'];
|
|
||||||
//if(largestLink === undefined || largestLink < linkLength) {
|
|
||||||
// largestLink = linkLength;
|
|
||||||
//}
|
|
||||||
//scores['player'][player]['largest']['link'] = largestLink;
|
|
||||||
}
|
}
|
||||||
|
scores['team'][team]['largest']['link'] = largestLink;
|
||||||
|
|
||||||
});
|
});
|
||||||
$.each(window.portals, function(qk, portal) {
|
$.each(window.portals, function(qk, portal) {
|
||||||
somethingInView = true;
|
somethingInView = true;
|
||||||
@ -142,13 +114,14 @@ window.plugin.scoreboard.compileStats = function() {
|
|||||||
scores['team'][team]['count_portals']++;
|
scores['team'][team]['count_portals']++;
|
||||||
scores['player'][player]['count_portals']++;
|
scores['player'][player]['count_portals']++;
|
||||||
|
|
||||||
//$.each(portal.options.details.portalV2.linkedModArray, function(ind, mod) {
|
$.each(portal.options.details.portalV2.linkedModArray, function(ind, mod) {
|
||||||
// if(mod !== null) {
|
if(mod !== null) {
|
||||||
// somethingInView = true;
|
window.plugin.scoreboard.initPlayer(mod.installingUser, team);
|
||||||
// scores['team'][team]['count_shields']++;
|
somethingInView = true;
|
||||||
// scores['player'][mod.installingUser]['count_shields']++;
|
scores['team'][team]['count_mods']++;
|
||||||
// }
|
scores['player'][mod.installingUser]['count_mods']++;
|
||||||
//});
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$.each(portal.options.details.resonatorArray.resonators, function(ind, reso) {
|
$.each(portal.options.details.resonatorArray.resonators, function(ind, reso) {
|
||||||
if(reso !== null) {
|
if(reso !== null) {
|
||||||
@ -163,18 +136,6 @@ window.plugin.scoreboard.compileStats = function() {
|
|||||||
return somethingInView;
|
return somethingInView;
|
||||||
};
|
};
|
||||||
|
|
||||||
window.plugin.scoreboard.percentSpan = function(percent, cssClass) {
|
|
||||||
var retVal = '';
|
|
||||||
if(percent > 0) {
|
|
||||||
retVal += '<span class="' + cssClass + ' mu_score" style="width:' + percent +'%;">' + percent;
|
|
||||||
if(percent >= 7) { // anything less than this and the text doesnt fit in the span.
|
|
||||||
retVal += '%';
|
|
||||||
}
|
|
||||||
retVal += '</span>';
|
|
||||||
}
|
|
||||||
return retVal;
|
|
||||||
};
|
|
||||||
|
|
||||||
window.plugin.scoreboard.teamTableRow = function(field,title) {
|
window.plugin.scoreboard.teamTableRow = function(field,title) {
|
||||||
var scores = window.plugin.scoreboard.scores['team'];
|
var scores = window.plugin.scoreboard.scores['team'];
|
||||||
var retVal = '<tr><td>'
|
var retVal = '<tr><td>'
|
||||||
@ -189,27 +150,6 @@ window.plugin.scoreboard.teamTableRow = function(field,title) {
|
|||||||
return retVal;
|
return retVal;
|
||||||
};
|
};
|
||||||
|
|
||||||
window.plugin.scoreboard.fieldInfo = function(field) {
|
|
||||||
var title = '';
|
|
||||||
var retVal = '';
|
|
||||||
|
|
||||||
if(field !== undefined) {
|
|
||||||
var portal = window.portals[field.options.vertices.vertexA.guid];
|
|
||||||
if(portal !== undefined) {
|
|
||||||
title = ' @' + portal.options.details.portalV2.descriptiveText.TITLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
retVal = '<div title="' + title + '">'
|
|
||||||
+ window.digits(field.options.data.entityScore.entityScore)
|
|
||||||
+ ' - ' + window.getPlayerName(field.options.data.creator.creatorGuid)
|
|
||||||
+ '</div>';
|
|
||||||
|
|
||||||
} else {
|
|
||||||
retVal = 'N/A';
|
|
||||||
}
|
|
||||||
return retVal;
|
|
||||||
};
|
|
||||||
|
|
||||||
window.plugin.scoreboard.fieldInfoArea = function(field) {
|
window.plugin.scoreboard.fieldInfoArea = function(field) {
|
||||||
var title = '';
|
var title = '';
|
||||||
var retVal = '';
|
var retVal = '';
|
||||||
@ -222,7 +162,6 @@ window.plugin.scoreboard.fieldInfoArea = function(field) {
|
|||||||
|
|
||||||
retVal = '<div title="' + title + '">'
|
retVal = '<div title="' + title + '">'
|
||||||
+ window.digits(Math.round(field.options.data.fieldArea))
|
+ window.digits(Math.round(field.options.data.fieldArea))
|
||||||
+ ' - ' + window.getPlayerName(field.options.data.creator.creatorGuid)
|
|
||||||
+ '</div>';
|
+ '</div>';
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -239,7 +178,7 @@ window.plugin.scoreboard.playerTableRow = function(playerGuid) {
|
|||||||
+ window.getPlayerName(playerGuid);
|
+ window.getPlayerName(playerGuid);
|
||||||
+ '</td>';
|
+ '</td>';
|
||||||
|
|
||||||
$.each(['mu','count_fields','field_area','count_links','link_length','count_portals','count_resonators'], function(i, field) {
|
$.each(['count_portals','count_resonators','count_mods'], function(i, field) {
|
||||||
retVal += '<td class="number">'
|
retVal += '<td class="number">'
|
||||||
+ window.digits(Math.round(scores[playerGuid][field]))
|
+ window.digits(Math.round(scores[playerGuid][field]))
|
||||||
+ '</td>';
|
+ '</td>';
|
||||||
@ -266,13 +205,9 @@ window.plugin.scoreboard.playerTable = function(sortBy) {
|
|||||||
var sort = window.plugin.scoreboard.playerTableSort;
|
var sort = window.plugin.scoreboard.playerTableSort;
|
||||||
var scoreHtml = '<table>'
|
var scoreHtml = '<table>'
|
||||||
+ '<tr><th ' + sort('names', sortBy) + '>Player</th>'
|
+ '<tr><th ' + sort('names', sortBy) + '>Player</th>'
|
||||||
+ '<th ' + sort('mu', sortBy) + '>Mu</th>'
|
|
||||||
+ '<th ' + sort('count_fields', sortBy) + '>Field #</th>'
|
|
||||||
+ '<th ' + sort('field_area', sortBy) + '>Field (km²)</th>'
|
|
||||||
+ '<th ' + sort('count_links', sortBy) + '>Link #</th>'
|
|
||||||
+ '<th ' + sort('link_length', sortBy) + '>Link (m)</th>'
|
|
||||||
+ '<th ' + sort('count_portals', sortBy) + '>Portals</th>'
|
+ '<th ' + sort('count_portals', sortBy) + '>Portals</th>'
|
||||||
+ '<th ' + sort('count_resonators', sortBy) + '>Resonators</th></tr>';
|
+ '<th ' + sort('count_resonators', sortBy) + '>Resonators</th>'
|
||||||
|
+ '<th ' + sort('count_mods', sortBy) + '>Mods</th></tr>';
|
||||||
$.each(window.plugin.scoreboard.playerGuids, function(index, guid) {
|
$.each(window.plugin.scoreboard.playerGuids, function(index, guid) {
|
||||||
scoreHtml += window.plugin.scoreboard.playerTableRow(guid);
|
scoreHtml += window.plugin.scoreboard.playerTableRow(guid);
|
||||||
});
|
});
|
||||||
@ -294,43 +229,23 @@ window.plugin.scoreboard.display = function() {
|
|||||||
|
|
||||||
var somethingInView = window.plugin.scoreboard.compileStats();
|
var somethingInView = window.plugin.scoreboard.compileStats();
|
||||||
var scores = window.plugin.scoreboard.scores;
|
var scores = window.plugin.scoreboard.scores;
|
||||||
var resMu = scores['team'][TEAM_RES]['mu'];
|
|
||||||
var enlMu = scores['team'][TEAM_ENL]['mu'];
|
|
||||||
var scoreHtml = '';
|
var scoreHtml = '';
|
||||||
var title = '';
|
var title = '';
|
||||||
|
|
||||||
if(somethingInView) {
|
if(somethingInView) {
|
||||||
|
scoreHtml += '<table>'
|
||||||
if(resMu + enlMu > 0) {
|
|
||||||
var resMuPercent = Math.round((resMu / (resMu + enlMu)) * 100);
|
|
||||||
scoreHtml += '<div class="mu_score" title="Resistance: ' + resMu + ' MU Enlightenment: ' + enlMu + ' MU">'
|
|
||||||
+ window.plugin.scoreboard.percentSpan(resMuPercent, 'res')
|
|
||||||
+ window.plugin.scoreboard.percentSpan(100-resMuPercent, 'enl')
|
|
||||||
+ '</div>';
|
|
||||||
title = window.digits(resMu) + ' R (' + resMuPercent + '%), ' + window.digits(enlMu) + ' E (' + (100-resMuPercent) + '%)';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
title = 'no MU in view';
|
|
||||||
}
|
|
||||||
|
|
||||||
scoreHtml += '<table>'
|
|
||||||
+ '<tr><th></th><th class="number">Resistance</th><th class="number">Enlightened</th><th class="number">Total</th></tr>'
|
+ '<tr><th></th><th class="number">Resistance</th><th class="number">Enlightened</th><th class="number">Total</th></tr>'
|
||||||
+ window.plugin.scoreboard.teamTableRow('mu','Mu')
|
|
||||||
+ window.plugin.scoreboard.teamTableRow('count_fields','Field #')
|
+ window.plugin.scoreboard.teamTableRow('count_fields','Field #')
|
||||||
+ window.plugin.scoreboard.teamTableRow('field_area','Field (km²)')
|
+ window.plugin.scoreboard.teamTableRow('field_area','Field (km²)')
|
||||||
+ window.plugin.scoreboard.teamTableRow('count_links','Link #')
|
+ window.plugin.scoreboard.teamTableRow('count_links','Link #')
|
||||||
+ window.plugin.scoreboard.teamTableRow('link_length','Link (m)')
|
+ window.plugin.scoreboard.teamTableRow('link_length','Link (m)')
|
||||||
+ window.plugin.scoreboard.teamTableRow('count_portals','Portals')
|
+ window.plugin.scoreboard.teamTableRow('count_portals','Portals')
|
||||||
+ window.plugin.scoreboard.teamTableRow('count_resonators','Resonators')
|
+ window.plugin.scoreboard.teamTableRow('count_resonators','Resonators')
|
||||||
|
+ window.plugin.scoreboard.teamTableRow('count_mods','Mods')
|
||||||
+ '</table>';
|
+ '</table>';
|
||||||
|
|
||||||
scoreHtml += '<table>'
|
scoreHtml += '<table>'
|
||||||
+ '<tr><th></th><th>Resistance</th><th>Enlightened</th></tr>'
|
+ '<tr><th></th><th>Resistance</th><th>Enlightened</th></tr>'
|
||||||
+ '<tr><td>Largest Field (Mu)</td><td>'
|
|
||||||
+ window.plugin.scoreboard.fieldInfo(scores['team'][TEAM_RES]['largest']['mu'])
|
|
||||||
+ '</td><td>'
|
|
||||||
+ window.plugin.scoreboard.fieldInfo(scores['team'][TEAM_ENL]['largest']['mu'])
|
|
||||||
+ '</td></tr>'
|
|
||||||
+ '<tr><td>Largest Field (km²)</td><td>'
|
+ '<tr><td>Largest Field (km²)</td><td>'
|
||||||
+ window.plugin.scoreboard.fieldInfoArea(scores['team'][TEAM_RES]['largest']['field_area'])
|
+ window.plugin.scoreboard.fieldInfoArea(scores['team'][TEAM_RES]['largest']['field_area'])
|
||||||
+ '</td><td>'
|
+ '</td><td>'
|
||||||
@ -341,9 +256,7 @@ window.plugin.scoreboard.display = function() {
|
|||||||
scoreHtml += 'N/A';
|
scoreHtml += 'N/A';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
scoreHtml += window.digits(Math.round(scores['team'][TEAM_RES]['largest']['link']['distance']))
|
scoreHtml += window.digits(Math.round(scores['team'][TEAM_RES]['largest']['link']['distance']));
|
||||||
+ ' - '
|
|
||||||
+ window.getPlayerName(scores['team'][TEAM_RES]['largest']['link']['player']);
|
|
||||||
}
|
}
|
||||||
scoreHtml += '</td><td>';
|
scoreHtml += '</td><td>';
|
||||||
|
|
||||||
@ -351,14 +264,12 @@ window.plugin.scoreboard.display = function() {
|
|||||||
scoreHtml += 'N/A';
|
scoreHtml += 'N/A';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
scoreHtml += window.digits(Math.round(scores['team'][TEAM_ENL]['largest']['link']['distance']))
|
scoreHtml += window.digits(Math.round(scores['team'][TEAM_ENL]['largest']['link']['distance']));
|
||||||
+ ' - '
|
|
||||||
+ window.getPlayerName(scores['team'][TEAM_ENL]['largest']['link']['player']);
|
|
||||||
}
|
}
|
||||||
scoreHtml += '</td></tr>'
|
scoreHtml += '</td></tr>'
|
||||||
+ '</table>'
|
+ '</table>'
|
||||||
+ '<div id="players">'
|
+ '<div id="players">'
|
||||||
+ window.plugin.scoreboard.playerTable('mu')
|
+ window.plugin.scoreboard.playerTable('count_portals')
|
||||||
+ '</div>';
|
+ '</div>';
|
||||||
|
|
||||||
scoreHtml += '<div class="disclaimer">Click on player table headers to sort by that column. '
|
scoreHtml += '<div class="disclaimer">Click on player table headers to sort by that column. '
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// @id iitc-plugin-zaprange@zaso
|
// @id iitc-plugin-zaprange@zaso
|
||||||
// @name IITC plugin: Zaprange
|
// @name IITC plugin: Zaprange
|
||||||
// @category Layer
|
// @category Layer
|
||||||
// @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@@
|
||||||
@ -16,84 +16,101 @@
|
|||||||
|
|
||||||
@@PLUGINSTART@@
|
@@PLUGINSTART@@
|
||||||
|
|
||||||
// PLUGIN START ////////////////////////////////////////////////////////
|
// PLUGIN START ///////////////////////////////////////////////////////
|
||||||
|
|
||||||
// use own namespace for plugin
|
// use own namespace for plugin
|
||||||
window.plugin.zaprange = function() {};
|
window.plugin.zaprange = function() {};
|
||||||
|
window.plugin.zaprange.zapLayers = {};
|
||||||
|
window.plugin.zaprange.MIN_MAP_ZOOM = 16;
|
||||||
|
|
||||||
window.plugin.zaprange.zapLayers = {};
|
window.plugin.zaprange.portalAdded = function(data) {
|
||||||
window.plugin.zaprange.MIN_MAP_ZOOM = 15;
|
data.portal.on('add', function() {
|
||||||
|
window.plugin.zaprange.draw(this.options.guid, this.options.details.controllingTeam.team);
|
||||||
|
});
|
||||||
|
|
||||||
|
data.portal.on('remove', function() {
|
||||||
window.plugin.zaprange.portalAdded = function(data) {
|
window.plugin.zaprange.remove(this.options.guid, this.options.details.controllingTeam.team);
|
||||||
data.portal.on('add', function() {
|
});
|
||||||
window.plugin.zaprange.draw(this.options.guid);
|
|
||||||
});
|
|
||||||
|
|
||||||
data.portal.on('remove', function() {
|
|
||||||
window.plugin.zaprange.remove(this.options.guid);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
window.plugin.zaprange.remove = function(guid) {
|
|
||||||
var previousLayer = window.plugin.zaprange.zapLayers[guid];
|
|
||||||
if(previousLayer) {
|
|
||||||
window.plugin.zaprange.zapCircleHolderGroup.removeLayer(previousLayer);
|
|
||||||
delete window.plugin.zaprange.zapLayers[guid];
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
window.plugin.zaprange.draw = function(guid) {
|
window.plugin.zaprange.remove = function(guid, faction) {
|
||||||
var d = window.portals[guid];
|
var previousLayer = window.plugin.zaprange.zapLayers[guid];
|
||||||
var dd = d.options.details;
|
if(previousLayer) {
|
||||||
|
if(faction === 'ENLIGHTENED') {
|
||||||
if(dd.controllingTeam.team !== "NEUTRAL") {
|
window.plugin.zaprange.zapCircleEnlHolderGroup.removeLayer(previousLayer);
|
||||||
var coo = d._latlng;
|
} else {
|
||||||
var latlng = new L.LatLng(coo.lat,coo.lng);
|
window.plugin.zaprange.zapCircleResHolderGroup.removeLayer(previousLayer);
|
||||||
var portalLevel = parseInt(getPortalLevel(dd));
|
}
|
||||||
var optCircle = {color:'red',opacity:0.7,fill:true,fillColor:'red',fillOpacity:0.1,weight:1,clickable:false, dashArray: [10,6]};
|
delete window.plugin.zaprange.zapLayers[guid];
|
||||||
var range = (5*portalLevel)+35;
|
|
||||||
|
|
||||||
var circle = new L.Circle(latlng, range, optCircle);
|
|
||||||
window.plugin.zaprange.zapLayers[guid] = circle;
|
|
||||||
circle.addTo(window.plugin.zaprange.zapCircleHolderGroup);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
window.plugin.zaprange.showOrHide = function() {
|
|
||||||
var ctrl = $('.leaflet-control-layers-selector + span:contains("Portal Attack Range")').parent();
|
|
||||||
if (map.getZoom() >= window.plugin.zaprange.MIN_MAP_ZOOM) {
|
|
||||||
// show the layer
|
|
||||||
if(!window.plugin.zaprange.zapLayerHolderGroup.hasLayer(window.plugin.zaprange.zapCircleHolderGroup)) {
|
|
||||||
window.plugin.zaprange.zapLayerHolderGroup.addLayer(window.plugin.zaprange.zapCircleHolderGroup);
|
|
||||||
}
|
}
|
||||||
ctrl.removeClass('disabled').attr('title', '');
|
|
||||||
} else {
|
|
||||||
// hide the layer
|
|
||||||
if(window.plugin.zaprange.zapLayerHolderGroup.hasLayer(window.plugin.zaprange.zapCircleHolderGroup)) {
|
|
||||||
window.plugin.zaprange.zapLayerHolderGroup.removeLayer(window.plugin.zaprange.zapCircleHolderGroup);
|
|
||||||
}
|
|
||||||
ctrl.addClass('disabled').attr('title', 'Zoom in to show those.');
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var setup = function() {
|
window.plugin.zaprange.draw = function(guid, faction) {
|
||||||
// this layer is added to tha layer chooser, to be toggled on/off
|
var d = window.portals[guid];
|
||||||
window.plugin.zaprange.zapLayerHolderGroup = new L.LayerGroup();
|
|
||||||
|
|
||||||
// this layer is added into the above layer, and removed from it when we zoom out too far
|
if(faction !== "NEUTRAL") {
|
||||||
window.plugin.zaprange.zapCircleHolderGroup = new L.LayerGroup();
|
var coo = d._latlng;
|
||||||
|
var latlng = new L.LatLng(coo.lat,coo.lng);
|
||||||
|
var portalLevel = parseInt(getPortalLevel(d.options.details));
|
||||||
|
var optCircle = {color:'red',opacity:0.7,fillColor:'red',fillOpacity:0.1,weight:1,clickable:false, dashArray: [10,6]};
|
||||||
|
var range = (5*portalLevel)+35;
|
||||||
|
|
||||||
window.plugin.zaprange.zapLayerHolderGroup.addLayer(window.plugin.zaprange.zapCircleHolderGroup);
|
var circle = new L.Circle(latlng, range, optCircle);
|
||||||
|
|
||||||
window.addLayerGroup('Portal Attack Range', window.plugin.zaprange.zapLayerHolderGroup, true);
|
if(faction === 'ENLIGHTENED') {
|
||||||
window.addHook('portalAdded', window.plugin.zaprange.portalAdded);
|
circle.addTo(window.plugin.zaprange.zapCircleEnlHolderGroup);
|
||||||
|
} else {
|
||||||
|
circle.addTo(window.plugin.zaprange.zapCircleResHolderGroup);
|
||||||
|
}
|
||||||
|
window.plugin.zaprange.zapLayers[guid] = circle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
map.on('zoomend', window.plugin.zaprange.showOrHide);
|
window.plugin.zaprange.showOrHide = function() {
|
||||||
|
if(map.getZoom() >= window.plugin.zaprange.MIN_MAP_ZOOM) {
|
||||||
|
// show the layer
|
||||||
|
if(!window.plugin.zaprange.zapLayerEnlHolderGroup.hasLayer(window.plugin.zaprange.zapCircleEnlHolderGroup)) {
|
||||||
|
window.plugin.zaprange.zapLayerEnlHolderGroup.addLayer(window.plugin.zaprange.zapCircleEnlHolderGroup);
|
||||||
|
$('.leaflet-control-layers-list span:contains("Zaprange Enlightened")').parent('label').removeClass('disabled').attr('title', '');
|
||||||
|
}
|
||||||
|
if(!window.plugin.zaprange.zapLayerResHolderGroup.hasLayer(window.plugin.zaprange.zapCircleResHolderGroup)) {
|
||||||
|
window.plugin.zaprange.zapLayerResHolderGroup.addLayer(window.plugin.zaprange.zapCircleResHolderGroup);
|
||||||
|
$('.leaflet-control-layers-list span:contains("Zaprange Resistance")').parent('label').removeClass('disabled').attr('title', '');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// hide the layer
|
||||||
|
if(window.plugin.zaprange.zapLayerEnlHolderGroup.hasLayer(window.plugin.zaprange.zapCircleEnlHolderGroup)) {
|
||||||
|
window.plugin.zaprange.zapLayerEnlHolderGroup.removeLayer(window.plugin.zaprange.zapCircleEnlHolderGroup);
|
||||||
|
$('.leaflet-control-layers-list span:contains("Zaprange Enlightened")').parent('label').addClass('disabled').attr('title', 'Zoom in to show those.');
|
||||||
|
}
|
||||||
|
if(window.plugin.zaprange.zapLayerResHolderGroup.hasLayer(window.plugin.zaprange.zapCircleResHolderGroup)) {
|
||||||
|
window.plugin.zaprange.zapLayerResHolderGroup.removeLayer(window.plugin.zaprange.zapCircleResHolderGroup);
|
||||||
|
$('.leaflet-control-layers-list span:contains("Zaprange Resistance")').parent('label').addClass('disabled').attr('title', 'Zoom in to show those.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
window.plugin.zaprange.showOrHide();
|
var setup = function() {
|
||||||
|
// this layer is added to the layer chooser, to be toggled on/off
|
||||||
|
window.plugin.zaprange.zapLayerEnlHolderGroup = new L.LayerGroup();
|
||||||
|
window.plugin.zaprange.zapLayerResHolderGroup = new L.LayerGroup();
|
||||||
|
|
||||||
}
|
// this layer is added into the above layer, and removed from it when we zoom out too far
|
||||||
|
window.plugin.zaprange.zapCircleEnlHolderGroup = new L.LayerGroup();
|
||||||
|
window.plugin.zaprange.zapCircleResHolderGroup = new L.LayerGroup();
|
||||||
|
|
||||||
|
window.plugin.zaprange.zapLayerEnlHolderGroup.addLayer(window.plugin.zaprange.zapCircleEnlHolderGroup);
|
||||||
|
window.plugin.zaprange.zapLayerResHolderGroup.addLayer(window.plugin.zaprange.zapCircleResHolderGroup);
|
||||||
|
|
||||||
|
window.addLayerGroup('Zaprange Enlightened', window.plugin.zaprange.zapLayerEnlHolderGroup, true);
|
||||||
|
window.addLayerGroup('Zaprange Resistance', window.plugin.zaprange.zapLayerResHolderGroup, true);
|
||||||
|
|
||||||
|
window.addHook('portalAdded', window.plugin.zaprange.portalAdded);
|
||||||
|
|
||||||
|
map.on('zoomend', window.plugin.zaprange.showOrHide);
|
||||||
|
|
||||||
|
window.plugin.zaprange.showOrHide();
|
||||||
|
}
|
||||||
|
|
||||||
// PLUGIN END //////////////////////////////////////////////////////////
|
// PLUGIN END //////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user