[Feature Request] Add a method to get how many times a pokemonId has been caught
How should I get how many times certain Pokemon was caught?
You mean something like this?
List<Pokemon> pokebank = //Get pokemons from your PokemonGo instance
Map<Integer, List<Pokemon>> pokemons = new HashMap<>();
pokebank.forEach((pokemon) -> {
int id = pokemon.getPokemonId().ordinal();
if (pokemons.containsKey(id)) {
pokemons.get(id).add(pokemon);
} else {
List<Pokemon> list = new ArrayList<>();
list.add(pokemon);
pokemons.put(id, list);
}
});
List<Pokemon> pidgeys = pokemons.get(PokemonIdOuterClass.PokemonId.PIDGEY_VALUE);
System.out.println("You have" + pidgeys.size() + " pidgeys");
@NAAVOO amount of certain pokemon you have in the inventory does not necessarily has to tell how many times you have caught that pokemon, namely due to transferring them.
I see that the API exposes following method: api.getPlayerProfile().getStats().getPokemonCaughtByType(); however the result would need to be further processed.
@NAAVOO no, but something like this playerProfile.getStats().getSmallRattataCaught(). And I'd like to have a method getPokemonByType(int type) which returns pokemon of certain type count.
getPokebank().getPokemonByType(PokemonId).size()
And for the other stats, the only stats you can get are defined here, so cant really know how many ratata you have caught.
Closed since its resolved. (dont hesitate to re-ask question within this issue)
My bad, actually there is a field to get those, but its seems the protos are not tested to get them, someone should change the type of the field to know if its actually possible to get them.
If someone is willing to help : we are talking about this field.
@thejavatar sorry i completely misread your question too, i think this info is available in the pokedex, getInventories().getPokedex().getPokedexEntry(id).getTimesCaptured(),
i dont think this is tested though.
@Grover-c13 ah nice, I didn't notice that one before. Thanks!