Advertisement
Guest User

Untitled

a guest
Aug 4th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. 'use strict';
  2.  
  3. /*
  4. This example script repeatedly queries the area near the given coordinates for
  5. catchable Pokémon. It uses the pogodev hashing server to provide the encrypted
  6. request signature.
  7. */
  8.  
  9. const pogobuf = require('pogobuf'),
  10. POGOProtos = require('node-pogo-protos'),
  11. bluebird = require('bluebird');
  12.  
  13. // Note: To avoid getting softbanned, change these coordinates to something close to where you
  14. // last used your account
  15. const lat = 37.7876146,
  16. lng = -122.3884353;
  17.  
  18. const username = 'your-google-username',
  19. password = 'your-google-password',
  20. hashingKey = 'your-pogodev-hashing-key';
  21.  
  22. let client;
  23.  
  24. new pogobuf.GoogleLogin().login(username, password).then(token => {
  25. client = new pogobuf.Client({
  26. authType: 'google',
  27. authToken: token,
  28. version: 5100, // Use API version 0.51 (minimum version for hashing server)
  29. useHashingServer: true,
  30. hashingKey: hashingKey
  31. });
  32. client.setPosition(lat, lng);
  33. return client.init();
  34. }).then(() => {
  35. console.log('Authenticated, waiting for first map refresh (30s)');
  36. setInterval(() => {
  37. const cellIDs = pogobuf.Utils.getCellIDs(lat, lng, 5, 17);
  38. return bluebird.resolve(client.getMapObjects(cellIDs, Array(cellIDs.length).fill(0))).then(mapObjects => {
  39. return mapObjects.map_cells;
  40. }).each(cell => {
  41. console.log('Cell ' + cell.s2_cell_id.toString());
  42. console.log('Has ' + cell.catchable_pokemons.length + ' catchable Pokemon');
  43. return bluebird.resolve(cell.catchable_pokemons).each(catchablePokemon => {
  44. console.log(' - A ' + pogobuf.Utils.getEnumKeyByValue(POGOProtos.Enums.PokemonId,
  45. catchablePokemon.pokemon_id) + ' is asking you to catch it.');
  46. });
  47. });
  48. }, 30 * 1000);
  49. }).catch(console.error);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement