PokeGOAPI-Java icon indicating copy to clipboard operation
PokeGOAPI-Java copied to clipboard

getCatchablePokemon method still returning 0 results

Open meher19 opened this issue 10 years ago • 43 comments

i updated api dependency to use the last version (0.3.4), but this method still return no results, i'm pretty sure in the location where i execute this methos there is many pokemons !

This is related to the closed issue : #486

Maybe i missed something to make it work again ?

meher19 avatar Aug 08 '16 12:08 meher19

Ok, this is strange maybe...but same code in eclipse works in android studio dont P.S. I used your fork

Luigik2806 avatar Aug 09 '16 18:08 Luigik2806

@FabianTerhorst How can you implement the SensorInfo part without using your pr? I am using reflection to set the values and all that but the only problem is setting the SensorInfo.

    try {

        SignatureOuterClass.Signature.SensorInfo sensorInfo = SignatureOuterClass.Signature.SensorInfo.newBuilder().build();
        Field field = sensorInfo.getClass().getField("angleNormalizedZ_");
        field.setAccessible(true);
        field.setInt(sensorInfo, 0);
    } catch (Exception e) {
        e.printStackTrace();
    }

mackenzieg avatar Aug 11 '16 00:08 mackenzieg

@mackenziejgoodwin its merged now, you can use the latest commit.

FabianTerhorst avatar Aug 11 '16 09:08 FabianTerhorst

@FabianTerhorst Despite the update I am still getting zero pokemon and zero pokestops...

Example:

    List<CatchablePokemon> pokemons = getBot().getPokemonGo().getMap().getCatchablePokemon();
    System.out.println(pokemons.size() + " Pokemon");
    if (pokemons != null) {
        if (pokemons.size() > 0) {
            CatchablePokemon catchablePokemon = pokemons.get(0);

            EncounterResult encounterResult = catchablePokemon.encounterPokemon();
            if (encounterResult.getCaptureProbability().getCaptureProbabilityCount() <= Config.getCatchChanceUseRazzberry())
                ; //TODO use razzberrry
            CatchResult catchResult = catchablePokemon.catchPokemon(Pokeball.POKEBALL);
            if (catchResult.getStatus().equals(CatchPokemonResponseOuterClass.CatchPokemonResponse.CatchStatus.CATCH_SUCCESS)) {
                System.out.println(Ansi.ansi().fg(Ansi.Color.GREEN).a("Caught a " + catchablePokemon.getPokemonId().name() + "!"));
            } else {
                System.out.println(Ansi.ansi().fg(Ansi.Color.GREEN).a("Error Catching pokemon " + catchablePokemon.getPokemonId().name() + "... Fled?"));
            }
        }


        Walk.setLocation(this.getBot());
    }

mackenzieg avatar Aug 11 '16 13:08 mackenzieg

you setted the Default device infos?

FabianTerhorst avatar Aug 11 '16 13:08 FabianTerhorst

@FabianTerhorst

    DeviceInfo deviceInfo = DeviceInfo.DEFAULT;
    pokemonGo.setDeviceInfo(deviceInfo);

    SensorInfo sensorInfo = new SensorInfo();
    sensorInfo.setAngleNormalizedZ(0);
    pokemonGo.setSensorInfo(sensorInfo);

mackenzieg avatar Aug 11 '16 13:08 mackenzieg

and without the sensorinfos, because im using for default now a ios device and i don´t know the sensor infos for ios.

FabianTerhorst avatar Aug 11 '16 13:08 FabianTerhorst

looks like niantic requires more infos now, because at the morning i got catchable pokemon back now with the same request im only getting pokestops back

FabianTerhorst avatar Aug 11 '16 13:08 FabianTerhorst

Im getting 1 back everytime when i change the location a little bit.

FabianTerhorst avatar Aug 11 '16 13:08 FabianTerhorst

At this place there isn´t more then one so its ok.

FabianTerhorst avatar Aug 11 '16 13:08 FabianTerhorst

@FabianTerhorst What is your location because no matter what location I set it returns 0. My Code: https://github.com/mackenziejgoodwin/PokemonGoBot/blob/master/src/main/java/com/pokemongobot/PokemonGoBot.java https://github.com/mackenziejgoodwin/PokemonGoBot/blob/master/src/main/java/com/pokemongobot/tasks/CatchPokemon.java

mackenzieg avatar Aug 11 '16 13:08 mackenzieg

        double lat = 48.847533008980086;
        double lng = 2.3301315307617188;
        go.setLocation(lat,lng, 0);

When you don´t get some back create a new account.

FabianTerhorst avatar Aug 11 '16 13:08 FabianTerhorst

@FabianTerhorst I created a new account (found out my other account was softbanned) and it still doesn't find any pokemon or stops.

mackenzieg avatar Aug 11 '16 14:08 mackenzieg

@mackenziejgoodwin you don´t even find 94 stops on the lat lng i provided and you are using 3g?

FabianTerhorst avatar Aug 11 '16 14:08 FabianTerhorst

@FabianTerhorst Indeed. Here is some debug output...

System.out.println(pokemonGo.getMap().getMapObjects().toString());
MapObjects(nearbyPokemons=[], catchablePokemons=[], wildPokemons=[], decimatedSpawnPoints=[], spawnPoints=[], gyms=[], pokestops=[], complete=false, api=com.pokegoapi.api.PokemonGo@7f77e91b)

Appears to not see anything on the map... weird. It does pull the inventory properly though

           List<Pokemon> s = pokemonGo.getInventories().getPokebank().getPokemons();
        String t = "";
        for(Pokemon pokemon : s) {
            t += pokemon.getPokemonId().name();
        }
        System.out.println(t);
        SQUIRTLE

mackenzieg avatar Aug 11 '16 14:08 mackenzieg

Can you test 3g when not wait 24hours and try again could be a local ip ban.

FabianTerhorst avatar Aug 11 '16 14:08 FabianTerhorst

@FabianTerhorst Made another account, tried using a proxy and changing ip, still nothing.

mackenzieg avatar Aug 11 '16 16:08 mackenzieg

you tried the catch example?

FabianTerhorst avatar Aug 11 '16 16:08 FabianTerhorst

@mackenziejgoodwin your MapObjects has complete=false thats why there is nothing near you. Try to debug your code to see when it is updated and when you are using it.

olegshulyakov avatar Aug 12 '16 09:08 olegshulyakov

I tried to use the last sources of the library to test it, but when i import the jar to my project, i have this compile error :

Error:(58, 54) Gradle: error: cannot access MessageOrBuilder
class file for com.google.protobuf.MessageOrBuilder not found
Error:(60, 80) Gradle: error: cannot access GeneratedMessage
class file for com.google.protobuf.GeneratedMessage not found

I tried to add com.google.protobuf plugin to my gradle build file, but this not resolves my problem..

meher19 avatar Aug 13 '16 13:08 meher19