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

Api gets stuck at cp.catchPokemon(pokeball)

Open jsl303 opened this issue 10 years ago • 18 comments

The latest commit sometimes gets stuck at cp.catchPokemon(pokeball). Can't seem to track down the cause. it just hangs at catchPokemon(pokeball) function. I went back to previous commit dad8a4a, and it doesn't have the problem.

jsl303 avatar Jul 31 '16 17:07 jsl303

on the very very latest commits? #404 #405

Grover-c13 avatar Jul 31 '16 17:07 Grover-c13

Thanks! You guys are so fast! Love it. I see there are more commits.

I just pulled down commit 82fefdb62fce9aaaf80ca26e97640dc4f416f73a. Testing now. I'll report back.

On 7/31/2016 1:37 PM, Grover-c13 wrote:

on the very very latest commits? #404 https://github.com/Grover-c13/PokeGOAPI-Java/pull/404 #405 https://github.com/Grover-c13/PokeGOAPI-Java/pull/405

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Grover-c13/PokeGOAPI-Java/issues/406#issuecomment-236444517, or mute the thread https://github.com/notifications/unsubscribe-auth/ALDSxzmHFAC2x9WS-JgVczHGaK4z968Pks5qbN1ngaJpZM4JZFGg.

jsl303 avatar Jul 31 '16 17:07 jsl303

Also having the same issue with latest commit 82fefdb

a4andy avatar Jul 31 '16 20:07 a4andy

I'm on commit 82fefdb62fce9aaaf80ca26e97640dc4f416f73a.

This one seems to get stuck less, but still get stuck on once in a while.

result = cp.catchPokemon(pokeball);

On 7/31/2016 4:23 PM, a4andy wrote:

Also having the same issue with latest commit 82fefdb https://github.com/Grover-c13/PokeGOAPI-Java/commit/82fefdb62fce9aaaf80ca26e97640dc4f416f73a

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Grover-c13/PokeGOAPI-Java/issues/406#issuecomment-236454330, or mute the thread https://github.com/notifications/unsubscribe-auth/ALDSx4uVII0X6-TQSGwFkQTIss1DYqqAks5qbQQogaJpZM4JZFGg.

jsl303 avatar Jul 31 '16 20:07 jsl303

I have been testing it for a while, and it definitely gets stuck at cp.catchPokemon(pokeball);. Not all the time, but once in a while. Also, after you catch all the pokemons in catchablePokemon, and refresh the following in the same spot, catchablePokemon = map.getCatchablePokemon(); size = catchablePokemon.size(); It sometimes returns 1, and when you try to catch, nothing's there. It happens enough that I think something weird is happening in the queue. Also, the cpu usage is pretty high. None of these issues happen in the previous commits before sync future. I went back and check. Could you investigate what might cause these after  the commit dad8a4a? Thank you as always!

jsl303 avatar Aug 01 '16 06:08 jsl303

I just pulled commit 4f85be14c63d5329e2a7edf283e2aa96c984bf07. This one sometimes goes into infinite loop where catchablePokemon.size() is always 1, and there's nothing to encounter.

jsl303 avatar Aug 01 '16 15:08 jsl303

Apparently pokemon that you already caught still remains in go.getMap().getCatchablePokemon(). Then the cp.encounterPokemon().getStatus() returns ENCOUNTER_ALREADY_HAPPENED. Is there way to remove caught pokemons from the getCatchablePokemon()? Or, should I keep refreshing getCatchablePokemon() and ignore ENCOUNTER_ALREADY_HAPPENED?

jsl303 avatar Aug 01 '16 17:08 jsl303

Weird, thought i had fixed that issue

Grover-c13 avatar Aug 01 '16 17:08 Grover-c13

are you 100% sure you have pulled?

Grover-c13 avatar Aug 01 '16 17:08 Grover-c13

I'm pretty sure. I just ran git-rev-parse, and it says I'm on 4f85be1.

jsl303 avatar Aug 01 '16 17:08 jsl303

Here's my code and result in case I missed something. while (true) { List catchablePokemon = go.getMap().getCatchablePokemon(); size = catchablePokemon.size(); System.out.println("Catching " + size + " Pokemons"); for (CatchablePokemon cp : catchablePokemon) { EncounterResult encResult = cp.encounterPokemon(); System.out.println(encResult.getStatus()); if (!encResult.wasSuccessful()) continue; PokemonId id = cp.getPokemonId(); System.out.println("Encountered:" + id); CatchResult result = cp.catchPokemon(); String status= result.getStatus().name(); System.out.println("Attempt to catch: " + id + " " + status); } } Catching 1 Pokemons ENCOUNTER_SUCCESS Encountered:PIDGEY ASYNC CATCH CALL ASYNC CATCH CALL Attempt to catch: PIDGEY CATCH_SUCCESS Catching 1 Pokemons ENCOUNTER_ALREADY_HAPPENED Catching 1 Pokemons ENCOUNTER_ALREADY_HAPPENED Catching 1 Pokemons ENCOUNTER_ALREADY_HAPPENED ...........

jsl303 avatar Aug 01 '16 18:08 jsl303

Commit cca2a1cf still has this problem.

jsl303 avatar Aug 01 '16 22:08 jsl303

Why it should"t?

FabianTerhorst avatar Aug 01 '16 22:08 FabianTerhorst

After catching all the pokemons in catchablePokemon, shouldn't go.getMap().getCatchablePokemon().size() report 0 unless there's new pokemon?

jsl303 avatar Aug 01 '16 22:08 jsl303

yes it should, unless the cache timer had expired between the catch and the getCatchablePokemon

Grover-c13 avatar Aug 02 '16 13:08 Grover-c13

Application is getting stuck with this output: CatchPokemon [02:56:09] MAGIKARP Catch Result

Related Code:

context.setConsoleString("CatchPokemon", "[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " + target.getPokemonId() + " Catch Result");
CatchResult catchResult = target.catchPokemon(pokeball);
context.setConsoleString("CatchPokemon", "[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " + target.getPokemonId() + " After Catch Result");

SippieCup avatar Aug 03 '16 07:08 SippieCup

Is this related? Encountered PIDGEY: ENCOUNTER_SUCCESS A/CatchablePokemon: Got an error or unrecognized catch attempt A/CatchablePokemon: Proto:CatchResult(captureAward=null, response=null, status=CATCH_ERROR, failed=true) Attempt to catch: CATCH_ERROR

jsl303 avatar Aug 03 '16 19:08 jsl303

issue is much more detailed on #446

vmarchaud avatar Aug 06 '16 10:08 vmarchaud