Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function notifyPB(title, body) {
- var xhr = new XMLHttpRequest();
- xhr.open('POST', "https://api.pushbullet.com/v2/pushes", true);
- xhr.setRequestHeader('Access-Token', access_token);
- xhr.setRequestHeader('Content-Type', 'application/json');
- xhr.send('{"body":"' + body + '","title":"' + title + '","type":"note"}');
- console.log(title);
- }
- function time(timecode) {
- if (typeof timecode == 'undefined') {var date = new Date();} else {var date = new Date(timecode);};
- var hours = date.getHours();
- var minutes = "0" + date.getMinutes();
- var seconds = "0" + date.getSeconds();
- return hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2);
- }
- iv = Array.apply(null, new Array(252)).map(Number.prototype.valueOf,-48);
- r = Array.apply(null, new Array(252)).map(Number.prototype.valueOf,0);
- known_despawns = [];
- iv[111] = -4; r[111] = 1.2;
- iv[112] = -6; r[112] = 0.8;
- iv[113] = -45; r[113] = 1.2;
- iv[114] = -45; r[114] = 5;
- iv[129] = -4; r[129] = 0.7;
- iv[130] = -4; r[130] = 1.2;
- iv[133] = -4; r[133] = 1.2;
- iv[143] = -45; r[143] = 0.5;
- iv[147] = -4; r[147] = 1.2;
- iv[148] = -3; r[148] = 1.2;
- iv[149] = -45; r[149] = 1.2;
- home_lat = 0; home_lng = 0;
- access_token = '0'
- notifyPB('Initialised', 'Home: http://www.google.com/maps/place/' + home_lat + ',' + home_lng);
- 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; }
- test_time = time(b[i].despawn*1000);
- notif = pokeDict[b[i].id].name+' | '+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;
- notifyPB(notif, url);
- known_despawns.push(b[i].despawn);
- }
- console.log('Ran at '+time())
- }, 30 * 1000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement