extract TILES_PER_EDGE and ZOOM_TO_LEVEL from stock intel

Niantic have been tweaking the values after server overload during Shonin - I expect them to change again...
This commit is contained in:
Jon Atkins 2015-03-28 18:27:06 +00:00
parent a169176bad
commit 96190be481
2 changed files with 63 additions and 3 deletions

View File

@ -10,9 +10,6 @@ window.extractFromStock = function() {
// extract the former nemesis.dashboard.config.CURRENT_VERSION from the code
var reVersion = new RegExp('[a-z]=[a-z].getData\\(\\);[a-z].v="([a-f0-9]{40})";');
// we also extract all top-level arrays of strings, for botguard
var arrays = [];
var minified = new RegExp('^[a-zA-Z$][a-zA-Z$0-9]$');
// required for botguard
@ -57,8 +54,66 @@ window.extractFromStock = function() {
}
}
}
} //end 'if .prototype'
if (topObject && Array.isArray && Array.isArray(topObject)) {
// find all non-zero length arrays containing just numbers
if (topObject.length>0) {
var justInts = true;
for (var i=0; i<topObject.length; i++) {
if (typeof(topObject[i]) !== 'number' || topObject[i] != parseInt(topObject[i])) {
justInts = false;
break;
}
}
if (justInts) {
// current lengths are: 17: ZOOM_TO_LEVEL, 16: TILES_PER_EDGE
// however, slightly longer or shorter are a possibility in the future
if (topObject.length >= 15 && topObject.length <= 18) {
// a reasonable array length for tile parameters
// need to find two types:
// a. portal level limits. decreasing numbers, starting at 8
// b. tiles per edge. increasing numbers. current max is 9000
if (topObject[0] == 8) {
// check for tile levels
var decreasing = true;
for (var i=1; i<topObject.length; i++) {
if (topObject[i-1] < topObject[i]) {
decreasing = false;
break;
}
}
if (decreasing) {
console.log ('int array '+topLevel+' looks like ZOOM_TO_LEVEL: '+JSON.stringify(topObject));
window.niantic_params.ZOOM_TO_LEVEL = topObject;
}
} // end if (topObject[0] == 8)
if (topObject[topObject.length-1] == 9000) {
var increasing = true;
for (var i=1; i<topObject.length; i++) {
if (topObject[i-1] > topObject[i]) {
increasing = false;
break;
}
}
if (increasing) {
console.log ('int array '+topLevel+' looks like TILES_PER_EDGE: '+JSON.stringify(topObject));
window.niantic_params.TILES_PER_EDGE = topObject;
}
} //end if (topObject[topObject.length-1] == 9000) {
}
}
}
}
// finding the required method names for the botguard interface code
if(topObject && typeof topObject == "object" && Object.getPrototypeOf(topObject) == requestPrototype) {
var methodKey = Object

View File

@ -19,6 +19,11 @@ window.getMapZoomTileParameters = function(zoom) {
// var ZOOM_TO_LEVEL = [8, 8, 8, 8, 7, 7, 7, 6, 6, 5, 4, 4, 3, 2, 2, 1, 1];
var ZOOM_TO_LEVEL = [8, 8, 8, 8, 8, 8, 7, 7, 6, 6, 5, 4, 3, 2, 2, 1, 1];
if (niantic_params.ZOOM_TO_LEVEL && niantic_params.TILES_PER_EDGE) {
ZOOM_TO_LEVEL = niantic_params.ZOOM_TO_LEVEL;
ZOOM_TO_TILES_PER_EDGE = niantic_params.TILES_PER_EDGE;
}
// the current API allows the client to request a minimum portal level. the ZOOM_TO_LEVEL list are minimums
// however, in my view, this can return excessive numbers of portals in many cases. let's try an optional reduction
// of detail level at some zoom levels