Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2016
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. 'use strict';
  2.  
  3. var http = require('http');
  4. http.createServer(function(req, res) {
  5. res.writeHead(200, {
  6. 'Content-Type': 'text/html'
  7. });
  8.  
  9.  
  10.  
  11. var Pokeio = require('./poke.io');
  12.  
  13. //Set environment variables or replace placeholder text
  14. var location = {
  15. type: 'name',
  16. name: process.env.PGO_LOCATION || 'A.L. Dyserinckstraat, Haarlem, Nederland'
  17. };
  18.  
  19. var username = process.env.PGO_USERNAME || 'kurtcabain1@gmail.com';
  20. var password = process.env.PGO_PASSWORD || '112112112';
  21. var provider = process.env.PGO_PROVIDER || 'google';
  22.  
  23. Pokeio.init(username, password, location, provider, function(err) {
  24. if (err) throw err;
  25.  
  26. console.log('[i] Current location: ' + Pokeio.playerInfo.locationName);
  27. console.log('[i] lat/long/alt: : ' + Pokeio.playerInfo.latitude + ' ' + Pokeio.playerInfo.longitude + ' ' + Pokeio.playerInfo.altitude);
  28.  
  29. Pokeio.GetProfile(function(err, profile) {
  30. if (err) throw err;
  31.  
  32. console.log('[i] Username: ' + profile.username);
  33. console.log('[i] Poke Storage: ' + profile.poke_storage);
  34. console.log('[i] Item Storage: ' + profile.item_storage);
  35.  
  36. var poke = 0;
  37. if (profile.currency[0].amount) {
  38. poke = profile.currency[0].amount;
  39. }
  40.  
  41. console.log('[i] Pokecoin: ' + poke);
  42. console.log('[i] Stardust: ' + profile.currency[1].amount);
  43.  
  44.  
  45. Pokeio.Heartbeat(function(err,hb) {
  46. if(err) {
  47. console.log(err);
  48. }
  49.  
  50. for (var i = hb.cells.length - 1; i >= 0; i--) {
  51. if(hb.cells[i].NearbyPokemon[0]) {
  52. //console.log(Pokeio.pokemonlist[0])
  53. var pokemon = Pokeio.pokemonlist[parseInt(hb.cells[i].NearbyPokemon[0].PokedexNumber)-1]
  54. console.log('[+] There is a ' + pokemon.name + ' at ' + hb.cells[i].NearbyPokemon[0].DistanceMeters.toString() + ' meters');
  55. res.write
  56. }
  57. }
  58.  
  59. });
  60.  
  61. });
  62. });
  63.  
  64. res.write('<!doctype html>\n<html lang="en">\n' +
  65. '\n<meta charset="utf-8">\n<title>Test web page on node.js</title>\n' +
  66. '<style type="text/css">* {font-family:arial, sans-serif;}</style>\n' +
  67. '\n\n<h1>Euro 2012 teams</h1>\n' +
  68. '<div id="content"><p>The teams in Group D for Euro 2012 are:</p><ul><li>England</li><li>France</li><li>Sweden</li><li>Ukraine</li></ul></div>' +
  69. '\n\n');
  70. res.end();
  71. }).listen(8888, '127.0.0.1');
  72. console.log('Server running at http://127.0.0.1:8888');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement