Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Help Required] How to get Move Names? #39

Closed
cglatot opened this issue Jul 27, 2016 · 6 comments
Closed

[Help Required] How to get Move Names? #39

cglatot opened this issue Jul 27, 2016 · 6 comments

Comments

@cglatot
Copy link

cglatot commented Jul 27, 2016

Hi, firstly thanks for the API, it's really useful.

I'm having some problems referencing the Move Names, though. I am using:

`party = session.checkInventory().party
myParty = []

# Get the party and put it into a nicer list
for pokemon in party:
    IvPercent = ((pokemon.individual_attack + pokemon.individual_defense + pokemon.individual_stamina)*100)/45
    L = [pokedex[pokemon.pokemon_id],pokemon.cp,pokemon.individual_attack,pokemon.individual_defense,pokemon.individual_stamina,IvPercent,pokemon.move_1,pokemon.move_2]`

Everything works okay, except for the move_1and move_2. These show up as numbers instead of the names of the moves. I've tried digging through the code, but I cannot figure out how the session.checkInventory().party gets the Move names.

Any help would be very much appreciated.

@rubenvereecken
Copy link
Owner

That's because the moves are actually numbers. Our protobuf library doesn't map the numbers back to strings (as a comparison, I use a Node library that does). @dmadisetti do you know of any python objects we could try for string enums? They're tremendously useful.

At the Enhanced project we have a Node module that combines all kinds of Pokemon data that we can then use. It's JS, but you could maybe use the JSON files. Check out this one for example for fast moves: https://github.com/PokemonGo-Enhanced/node-pokemongo-data/blob/master/special-moves.json

Careful though, we have two separate move files.

@cglatot
Copy link
Author

cglatot commented Jul 27, 2016

This API library does have the ability to convert the numbers to names, though. If you just run session.checkInventory() and output it you get a bunch of information. And for each Pokemon in your party you get the following:

`id: xxxxxxxxxxxxxxx

pokemon_id: MAGIKARP
cp: 145
stamina: 32
stamina_max: 32
move_1: SPLASH_FAST
move_2: STRUGGLE
height_m: 0.792643606663
weight_kg: 8.24328136444
individual_attack: 14
individual_defense: 13
individual_stamina: 15
cp_multiplier: 0.597400009632
pokeball: ITEM_POKE_BALL
captured_cell_id: xxxxxxxxxxxxx
creation_time_ms: 1469450301788
nickname: "93-14/13/15"
from_fort: 1`

So it seems there is a way to do it. I just can't find how they are doing it.

@rubenvereecken
Copy link
Owner

rubenvereecken commented Jul 27, 2016

Eh terribly sorry. Lemme check

Nice Magikarp btw, pretty good stats.

@cglatot
Copy link
Author

cglatot commented Jul 27, 2016

Haha thanks. There is actually a better one that is 15/14/14!

My bot / test account is infinitely better than my real one :(

@krzys-h
Copy link

krzys-h commented Jul 27, 2016

You can get the names directly from protobufs:

>>> import POGOProtos.Enums.PokemonMove_pb2 as PokemonMove_pb2
>>> PokemonMove_pb2.PokemonMove.Name(231)
'SPLASH_FAST'

@cglatot
Copy link
Author

cglatot commented Jul 27, 2016

Thank you! Works perfectly :D

@cglatot cglatot closed this as completed Jul 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants