Armax / Pokemon-GO-node-api

Pokemon GO api node.js library
MIT License
875 stars 198 forks source link

EvolvePokemon : error regarding cp_multiplier #254

Closed litil closed 7 years ago

litil commented 7 years ago

I have an issue with the EvolvePokemon method. When I tried to evolve a pokemon, I had an error regarding the id field, I fixed it thanks to the comment from in this issue : #194 .

Now, I have the same kind of error, but this time regarding the cp_multiplier : Error: Illegal wire type for field Message.Field .ResponseEnvelop.Pokemon.cp_multiplier: 5 (1 expected)

I tried to replace int32 cp_multiplier with float cp_multiplier but I had "Illegal buffer" error.

Any idea? thanks

ameyer commented 7 years ago

Here is the proto I have been using.

proto file

And the function I use:

function evolve(pokemon){
    var id  = pokemon.id;
    var cp = pokemon.cp;
    var pokemon_id = pokemon.pokemon_id;

    pokeAPI.EvolvePokemon(id, function(err, result){
        if (err){
            printError("evolve",err);
        }else{
            if(result.Result ==  1){
                var pokemon = result.EvolvedPokemon

                console.log(chalk.blue("\tevolved to a "+monsters[pokemon.pokemon_type].name+" with the  CP of "+pokemon.cp));
            }else{
                console.log(result);
            }
        }
    });
}
litil commented 7 years ago

Thanks a lot @ameyer with this proto file, the evolve function works!