plugin guess-player-levels: take account of reso max deploy range when guessing level from attack notifications - which also means this is now an accurate guess

This commit is contained in:
Jon Atkins 2015-02-09 18:44:42 +00:00
parent 6fc7bbe4df
commit 02199d2f1b

View File

@ -2,7 +2,7 @@
// @id iitc-plugin-guess-player-levels@breunigs
// @name IITC plugin: guess player level
// @category Info
// @version 0.5.5.@@DATETIMEVERSION@@
// @version 0.5.6.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
@ -309,9 +309,18 @@ window.plugin.guessPlayerLevels.handleAttackData = function(nick, latlngs) {
}
var burster = window.plugin.guessPlayerLevels.BURSTER_RANGES;
for(var i=1; i<burster.length; i++) {
if(range > burster[i]) {
window.plugin.guessPlayerLevels.savePlayerLevel(nick, Math.min(i+1, MAX_PORTAL_LEVEL), false);
// res can be up to 40m from a portal, so attack notifications for portals, say, 100m apart could
// actually be a weapn range as low as 20m. however, typical deployments are a bit less than 40m, and resonators
// can only be deployed on the 8 compass points. a value of 40m x 2 would never be wrong
var reso_range_correction = 40*2;
// however, the full correction often under-estimates.
for(var i=burster.length-1; i>=1; i--) {
if(range >= (burster[i]+reso_range_correction)) {
window.plugin.guessPlayerLevels.savePlayerLevel(nick, Math.min(i+1, MAX_PORTAL_LEVEL), true);
break;
}
}