Adds highlighter logic, and myself to the roll call of contributors.
This commit is contained in:
parent
76d283870a
commit
d704e8d872
@ -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),
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
// @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@@] Uses the fill color of the portals to show those with one (or more) resonators due to decay within the next day.
|
// @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 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*
|
||||||
@ -23,15 +23,32 @@ window.plugin.portalHighlighterImminentDecay = function() {};
|
|||||||
|
|
||||||
window.plugin.portalHighlighterImminentDecay.highlight = function(data) {
|
window.plugin.portalHighlighterImminentDecay.highlight = function(data) {
|
||||||
var d = data.portal.options.details;
|
var d = data.portal.options.details;
|
||||||
var portal_deployment = 0;
|
|
||||||
if(getTeam(d) !== 0) {
|
if(getTeam(d) !== 0) {
|
||||||
if(window.getAvgResoDist(d) > 0 && window.getAvgResoDist(d) < window.HACK_RANGE*0.9) {
|
//Check the energy of every resonator.
|
||||||
portal_deployment = (window.HACK_RANGE - window.getAvgResoDist(d))/window.HACK_RANGE;
|
var resImminentDecayCount = 0;
|
||||||
}
|
var resCount = 0;
|
||||||
if(portal_deployment > 0) {
|
$.each(d.resonatorArray.resonators, function(ind, reso) {
|
||||||
var fill_opacity = portal_deployment*.85 + .15;
|
if(reso !== null) {
|
||||||
color = 'red';
|
var level = parseInt(reso.level);
|
||||||
var params = {fillColor: color, fillOpacity: fill_opacity};
|
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);
|
data.portal.setStyle(params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -39,7 +56,7 @@ window.plugin.portalHighlighterImminentDecay.highlight = function(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var setup = function() {
|
var setup = function() {
|
||||||
window.addPortalHighlighter('ImminentDecay', window.plugin.portalHighlighterImminentDecay.highlight);
|
window.addPortalHighlighter('Imminent Decay', window.plugin.portalHighlighterImminentDecay.highlight);
|
||||||
}
|
}
|
||||||
|
|
||||||
// PLUGIN END //////////////////////////////////////////////////////////
|
// PLUGIN END //////////////////////////////////////////////////////////
|
||||||
|
Loading…
x
Reference in New Issue
Block a user