Pokemon-GO-node-api icon indicating copy to clipboard operation
Pokemon-GO-node-api copied to clipboard

[Question] How to get pokemon attacks ?

Open litil opened this issue 9 years ago • 3 comments

I've been playing with the lib for a few days and I'm trying to understand what mean all attributes I get in the GetInventory response. For a pokemon for example, I see : "pokemon_id":124, "cp":546, "stamina":61, "stamina_max":61, "move_1":222, "move_2":33, "individual_attack":15, "individual_defense":7, "individual_stamina":2, "cp_multiplier":0.4627983868122101, ...

How do I know the name and the strength of a pokemon's attacks? Is it related to move_X or individual_X ?

Also, how could I know how many candies I have for a pokemon family?

Thanks

litil avatar Aug 22 '16 13:08 litil

I don't know about the attacks, but you can get the candy like this

pokeAPI.GetInventory(function(err, inventory) {        
    var inventoryItems = inventory.inventory_delta.inventory_items;

    for(var i =0; i < inventoryItems.length; i++){
        var inventoryItem = inventoryItems[i];

        if(inventoryItem.inventory_item_data.pokemon_family){
            var pokemon = inventoryItem.inventory_item_data.pokemon_family;
            var id = pokemon['family_id'];
            var candy = pokemon['candy'];
        }
    }
});

ameyer avatar Aug 23 '16 04:08 ameyer

Thanks a lot @ameyer !

Anyone knows how to get pokemons' attacks details?

litil avatar Aug 24 '16 11:08 litil

@litil inside hb:

` // Show MapPokemons (catchable) & catch for (var i = hb.cells.length - 1; i >= 0; i--) { for (var j = hb.cells[i].MapPokemon.length - 1; j >= 0; j--) { // use async lib with each or eachSeries should be better :) var currentPokemon = hb.cells[i].MapPokemon[j];

                            (function (currentPokemon) {
                                var pokedexInfo = b.pokemonlist[parseInt(currentPokemon.PokedexTypeId) - 1];
                                console.log('[+] There is a ' + pokedexInfo.name + ' near!! I can try to catch it!' + currentPokemon.Latitude + "," + currentPokemon.Longitude);

                                b.EncounterPokemon(currentPokemon, function (suc, dat) {
                                    if (suc == "No result") return;
                                    //console.log('Encountering pokemon ' + pokedexInfo.name + '...');

                                    if (dat != null) {
                                        if (dat.WildPokemon != null) {
                                            console.log(chalk.bgYellow(">>> " + pokedexInfo.name + " | "+ dat.WildPokemon.pokemon.move_1 +" and "+ dat.WildPokemon.pokemon.move_2));
                                        }
                                    }
                                    //b.CatchPokemon(currentPokemon, 1, 1.950, 1, 1, function (xsuc, xdat) {
                                    //    var status = ['Unexpected error', 'Successful catch', 'Catch Escape', 'Catch Flee', 'Missed Catch'];
                                    //    console.log(status[xdat.Status]);
                                    //});
                                });
                            })(currentPokemon);`

Also check that #263 to get all correct response

Metalick avatar Oct 03 '16 05:10 Metalick