Advertisement
Pyorot

LondonPogoMap/Pushbullet Bot 1.0

Mar 15th, 2017
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. iv = Array.apply(null, new Array(252)).map(Number.prototype.valueOf,1);
  2. r = Array.apply(null, new Array(252)).map(Number.prototype.valueOf,0);
  3. known_despawns = [];
  4.  
  5. iv[113] = -45; r[113] = 1.2;
  6. iv[114] = -45; r[114] = 5;
  7. iv[129] = -3;  r[129] = 1.2;
  8. iv[130] = -4;  r[130] = 1.2;
  9. iv[147] = -3;  r[147] = 1.2;
  10. iv[148] = -3;  r[148] = 1.2;
  11. home_lat = 0; home_lng = 0;
  12. console.log('Initialised')
  13.  
  14. var timer = setInterval(function() {
  15.  
  16. b = [];
  17.  
  18. for (i = 0, len = this.pokemons.length; i < len; i++) {
  19.     test = this.pokemons[i];
  20.     test_iv = (test.attack + test.defence + test.stamina) - 45;
  21.     if (test_iv >= iv[test.id]) {
  22.         test_x = Math.abs(test.center.lat - home_lat)*110.574;
  23.         test_y = Math.abs(test.center.lng - home_lng)*69.298;
  24.         if (test_x*test_x + test_y*test_y < r[test.id]*r[test.id]) {
  25.             test.r = Math.sqrt(test_x*test_x + test_y*test_y);
  26.             test.iv = test_iv;
  27.             b.push(test);
  28.         }
  29.     }          
  30. }
  31.  
  32. for (i = 0, len = b.length; i < len; i++) {
  33.     if (known_despawns.indexOf(b[i].despawn) != -1) { continue; }
  34.     var date = new Date(b[i].despawn*1000);
  35.     var hours = date.getHours();
  36.     var minutes = "0" + date.getMinutes();
  37.     var seconds = "0" + date.getSeconds();
  38.     var test_time = hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2);
  39.     notif = 'Pokémon | #'+b[i].id+' | '+b[i].iv+' | '+b[i].r.toFixed(2)+'km | '+test_time;
  40.     url = 'http://www.google.com/maps/place/' + b[i].center.lat + ',' + b[i].center.lng;
  41.  
  42.     var xhr = new XMLHttpRequest();
  43.     xhr.open('POST', "https://api.pushbullet.com/v2/pushes", true);
  44.     xhr.setRequestHeader('Access-Token', '0');
  45.     xhr.setRequestHeader('Content-Type', 'application/json');
  46.     xhr.send('{"body":"' + url + '","title":"' + notif + '","type":"note"}');
  47.     console.log(notif);
  48.     known_despawns.push(b[i].despawn)
  49. }
  50.  
  51. var date = new Date();
  52. var hours = date.getHours();
  53. var minutes = "0" + date.getMinutes();
  54. var seconds = "0" + date.getSeconds();
  55. var ahora = hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2);
  56. console.log('Ran at '+ahora)
  57. }, 30 * 1000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement