Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- iv = Array.apply(null, new Array(252)).map(Number.prototype.valueOf,1);
- r = Array.apply(null, new Array(252)).map(Number.prototype.valueOf,0);
- known_despawns = [];
- iv[113] = -45; r[113] = 1.2;
- iv[114] = -45; r[114] = 5;
- iv[129] = -3; r[129] = 1.2;
- iv[130] = -4; r[130] = 1.2;
- iv[147] = -3; r[147] = 1.2;
- iv[148] = -3; r[148] = 1.2;
- home_lat = 0; home_lng = 0;
- console.log('Initialised')
- var timer = setInterval(function() {
- b = [];
- for (i = 0, len = this.pokemons.length; i < len; i++) {
- test = this.pokemons[i];
- test_iv = (test.attack + test.defence + test.stamina) - 45;
- if (test_iv >= iv[test.id]) {
- test_x = Math.abs(test.center.lat - home_lat)*110.574;
- test_y = Math.abs(test.center.lng - home_lng)*69.298;
- if (test_x*test_x + test_y*test_y < r[test.id]*r[test.id]) {
- test.r = Math.sqrt(test_x*test_x + test_y*test_y);
- test.iv = test_iv;
- b.push(test);
- }
- }
- }
- for (i = 0, len = b.length; i < len; i++) {
- if (known_despawns.indexOf(b[i].despawn) != -1) { continue; }
- var date = new Date(b[i].despawn*1000);
- var hours = date.getHours();
- var minutes = "0" + date.getMinutes();
- var seconds = "0" + date.getSeconds();
- var test_time = hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2);
- notif = 'Pokémon | #'+b[i].id+' | '+b[i].iv+' | '+b[i].r.toFixed(2)+'km | '+test_time;
- url = 'http://www.google.com/maps/place/' + b[i].center.lat + ',' + b[i].center.lng;
- var xhr = new XMLHttpRequest();
- xhr.open('POST', "https://api.pushbullet.com/v2/pushes", true);
- xhr.setRequestHeader('Access-Token', '0');
- xhr.setRequestHeader('Content-Type', 'application/json');
- xhr.send('{"body":"' + url + '","title":"' + notif + '","type":"note"}');
- console.log(notif);
- known_despawns.push(b[i].despawn)
- }
- var date = new Date();
- var hours = date.getHours();
- var minutes = "0" + date.getMinutes();
- var seconds = "0" + date.getSeconds();
- var ahora = hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2);
- console.log('Ran at '+ahora)
- }, 30 * 1000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement