Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- var http = require('http');
- http.createServer(function(req, res) {
- res.writeHead(200, {
- 'Content-Type': 'text/html'
- });
- var Pokeio = require('./poke.io');
- //Set environment variables or replace placeholder text
- var location = {
- type: 'name',
- name: process.env.PGO_LOCATION || 'A.L. Dyserinckstraat, Haarlem, Nederland'
- };
- var username = process.env.PGO_USERNAME || 'kurtcabain1@gmail.com';
- var password = process.env.PGO_PASSWORD || '112112112';
- var provider = process.env.PGO_PROVIDER || 'google';
- Pokeio.init(username, password, location, provider, function(err) {
- if (err) throw err;
- console.log('[i] Current location: ' + Pokeio.playerInfo.locationName);
- console.log('[i] lat/long/alt: : ' + Pokeio.playerInfo.latitude + ' ' + Pokeio.playerInfo.longitude + ' ' + Pokeio.playerInfo.altitude);
- Pokeio.GetProfile(function(err, profile) {
- if (err) throw err;
- console.log('[i] Username: ' + profile.username);
- console.log('[i] Poke Storage: ' + profile.poke_storage);
- console.log('[i] Item Storage: ' + profile.item_storage);
- var poke = 0;
- if (profile.currency[0].amount) {
- poke = profile.currency[0].amount;
- }
- console.log('[i] Pokecoin: ' + poke);
- console.log('[i] Stardust: ' + profile.currency[1].amount);
- Pokeio.Heartbeat(function(err,hb) {
- if(err) {
- console.log(err);
- }
- for (var i = hb.cells.length - 1; i >= 0; i--) {
- if(hb.cells[i].NearbyPokemon[0]) {
- //console.log(Pokeio.pokemonlist[0])
- var pokemon = Pokeio.pokemonlist[parseInt(hb.cells[i].NearbyPokemon[0].PokedexNumber)-1]
- console.log('[+] There is a ' + pokemon.name + ' at ' + hb.cells[i].NearbyPokemon[0].DistanceMeters.toString() + ' meters');
- res.write
- }
- }
- });
- });
- });
- res.write('<!doctype html>\n<html lang="en">\n' +
- '\n<meta charset="utf-8">\n<title>Test web page on node.js</title>\n' +
- '<style type="text/css">* {font-family:arial, sans-serif;}</style>\n' +
- '\n\n<h1>Euro 2012 teams</h1>\n' +
- '<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>' +
- '\n\n');
- res.end();
- }).listen(8888, '127.0.0.1');
- console.log('Server running at http://127.0.0.1:8888');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement