npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pokemongo-api

v1.8.3

Published

Pokemon Go API

Downloads

16

Readme

pokemongo-api

npm version Join the chat at https://gitter.im/gallexme/pokemongo-api Commitizen friendly

Pokemon Go API for nodejs

Query the Pokemon database for what you want.. This library covers all functions available in the api through Call() We are also working on porting all calls into functions,

Install

npm i -S pokemongo-api

Example

See /example folder for more complex examples

const Poke = new PokeAPI()

Poke.player.location = {
  latitude: parseFloat(lat),
  longitude: parseFloat(lng)
}

const api = await Poke.login(username, password, provider)

let player = await Poke.GetPlayer()
let inventory = await Poke.GetInventory()
let {items} = inventory

while( true ) {
  let objects = await Poke.GetMapObjects()

  // catchable pokemons from here?
  for (let pokemon of objects.catchable_pokemons) {
    await pokemon.encounter()
    await pokemon.catch()
  }

  // Gym's (are sorted by distance)
  for (let gym of objects.forts.gyms) {
    // We have a gym
    if (gym.withinRange) {
      // Do something with the gym
    }
  }

  // Checkpoint's (aka: pokestop) (are sorted by distance)
  for (let checkpoint of objects.forts.checkpoints) {
    if (!checkpoint.cooldown && checkpoint.withinRange) {
      // Collect pokestop rewards
      let res = await checkpoint.search()
    }
  }

  //just walk a little (1 - 15 meters..)
  await Poke.player.walkAround()
  await new Promise(resolve => setTimeout(resolve, 3000))
}

PokeAPI Options

You can specify some options and pass them in PokeAPI constructor:

const options
const Poke = new PokeAPI(options)
...
  {
      logging: boolean, // default true
      loginCache: boolean, // default true
      requestInterval: number, // default PAUSE_BETWEEN_REQUESTS read in settings.js
      socksProxy: { //default to undefined (no proxy)
          hostname: string,
          port: number
      }
  }

Player Object

{
  accessToken
  username
  password
  debug
  latitude
  longitude
  altitude
  provider
  experience
  prev_level_xp
  next_level_xp
  km_walked
  pokemons_encountered
  unique_pokedex_entries
  pokemons_captured
  evolutions
  poke_stop_visits
  pokeballs_thrown
  eggs_hatched
  big_magikarp_caught
  battle_attack_won
  battle_attack_total
  battle_defended_won
  battle_training_won
  battle_training_total
  prestige_raised_total
  prestige_dropped_total
  pokemon_deployed
  small_rattata_caught
}

Available functions

player.provider()
player.profileDetails()
player.location()
player.location()
player.profile()
player.createdDate()
player.pokeStorage()
player.itemsStorage()
player.currency()
player.Login()
player.walkAround()
player.walkToPoint()
player.hatchedEggs()
player.levelUpRewards()
player.checkAwardBadges()
player.collectDailyBonus()
player.collectDailyBonus()
player.settings()
player.itemTemplates()
player.remoteConfigVersion()

Available functions (more to come)

Pokemon object

{
  id
  pokemon_id
  cp
  stamina
  stamina_max
  move_1
  move_2
  deployed_fort_id
  owner_name
  is_egg
  egg_km_walked_target
  egg_km_walked_start
  origin
  height_m
  weight_kg
  individual_attack
  individual_defense
  individual_stamina
  cp_multiplier
  pokeball
  captured_cell_id
  battles_attacked
  battles_defended
  egg_incubator_id
  creation_time_ms
  num_upgrades
  additional_cp_multiplier
  favorite
  nickname
  from_fort
}

Available functions

pokemon.encounter()
pokemon.catch()
pokemon.encounterAndCatch()
pokemon.release()
pokemon.envolve()
pokemon.upgrade()
pokemon.setFavorite()
pokemon.nickname()

Fort object (Checkpoint and Gym)

{
  fort_id
  team_color
  pokemon_data
  name
  image_urls
  fp
  stamina
  max_stamina
  type
  latitude
  longitude
  description
  modifiers
}

Available functions

fort.isCheckpoint
fort.isGym
gym.isSameTeam()
gym.isNeutral()
gym.points()
gym.isInBattle()
gym.guardPokemon()
gym.details()
gym.recallPokemon()
gym.deployPokemon()
gym.startBattle()
gym.attack()
gym.instaWinBattle()
checkpoint.details()
checkpoint.search()