Skip to content
This repository has been archived by the owner on Jul 22, 2019. It is now read-only.

[WIP] new api #1237

Closed
wants to merge 33 commits into from
Closed

[WIP] new api #1237

wants to merge 33 commits into from

Conversation

jabbink
Copy link
Owner

@jabbink jabbink commented Aug 25, 2016

Changes made:

  • Uses new API

Needs a lot of testing.

}

return pokemons
return service.getBotContext(name).api.inventory.eggs.map { PokemonData().buildFromPokemon(it.value) }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request processing failed; nested exception is java.lang.IllegalStateException: PokemonMetaRegistry.getMeta(this.getPokemonId()) must not be null

You try to read Pokemon data from the inventory.eggs (prolly a c/p mistake?)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@Sieberkev
Copy link
Collaborator

Sieberkev commented Aug 25, 2016

When starting with a fresh new account, it triggered the ToS, tutorial 'n stuff, but didn't refresh the internal counters when I catched the pikachu:

25 aug 21:18:23 [RxComputationScheduler-8] - Profile update: 1650 XP on LVL 2; 650/2000 (32,50%) to LVL 3
25 aug 21:18:23 [RxComputationScheduler-8] - XP gain: 1.650 XP in 12 mins; XP rate: 8.220/hr; Next level in: 0h10m
25 aug 21:18:23 [RxComputationScheduler-8] - Pokemon caught/transferred: 1/0; Pokemon caught from lures: 0; Items caught/dropped: 26/0;
25 aug 21:18:23 [RxComputationScheduler-8] - Pokebank 3/0; Stardust 0; Inventory 88/0
25 aug 21:18:23 [RxComputationScheduler-8] - Pokemon inventory is full, not catching!

Restarting the bot fixed it.

if (bot.api.inventory.candies.getOrPut(pokemonMeta.family, { AtomicInteger(0) }).get() >= pokemonMeta.candyToEvolve) {
val pokemonData = it.value.pokemonData
Log.yellow("Evolving ${pokemonData.pokemonId.name} CP ${pokemonData.cp} IV ${pokemonData.getIvPercentage()}%")
val evolve = EvolvePokemon().withPokemonId(it.key)
Copy link
Collaborator

@Sieberkev Sieberkev Aug 25, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like evolving doesn't update the internal candy counter correctly:

25 aug 22:04:24 [default: BotLoop] - Going to transfer PIDGEY with CP 23 and IV 22%; reason: Not enough candy 16/12: max 1 <- so total = 17/12

...

25 aug 22:05:22 [default: ProfileLoop] - Stack of pokemon ready to evolve: 1/1
25 aug 22:05:22 [default: ProfileLoop] - Starting stack evolve of 1 pokemon using lucky egg
25 aug 22:05:22 [default: ProfileLoop] - Starting stack evolve of 1 pokemon without lucky egg
25 aug 22:05:22 [default: ProfileLoop] - Evolving PIDGEY CP 40 IV 22%
25 aug 22:05:26 [RxComputationScheduler-1] - Successfully evolved in PIDGEOTTO CP 77 IV 22%
25 aug 22:05:26 [default: ProfileLoop] - Not enough candy (11/25) to evolve RATTATA CP 10 IV 84%
25 aug 22:05:26 [default: ProfileLoop] - Not enough candy (7/12) to evolve WEEDLE CP 28 IV 73%
25 aug 22:05:26 [default: ProfileLoop] - Not enough candy (-32/12) to evolve PIDGEY CP 10 IV 42% <- waitwhat
25 aug 22:05:26 [default: ProfileLoop] - Finished evolving 1 pokemon; 0 xp gained
25 aug 22:05:28 [default: BotLoop] - Going to transfer PIDGEOTTO with CP 77 and IV 22%; reason: CP < -1 and IV < 95%
25 aug 22:06:22 [default: ProfileLoop] - Stack of pokemon ready to evolve: -2/1 <- waitwhat

That last one resulted in a ctx.pauseWalking.set(true) and stuck the bot forever just out of range of a pokestop.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly fixed

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there's still a minor candy cache problem:

26 aug 12:03:45 [default: ProfileLoop] - Stack of pokemon ready to evolve: 1/1
26 aug 12:03:45 [default: ProfileLoop] - Starting stack evolve of 1 pokemon without lucky egg
26 aug 12:03:45 [default: ProfileLoop] - Evolving RATTATA CP 10 IV 84%
26 aug 12:03:46 [default: ProfileLoop] - Successfully evolved in RATICATE CP 19 IV 84%
26 aug 12:03:46 [default: ProfileLoop] - Not enough candy (7/12) to evolve WEEDLE CP 28 IV 73%
26 aug 12:03:46 [default: ProfileLoop] - Not enough candy (7/12) to evolve PIDGEY CP 10 IV 42%
26 aug 12:03:46 [default: ProfileLoop] - Evolving RATTATA CP 10 IV 46%
26 aug 12:03:47 [default: ProfileLoop] - Evolve of RATTATA CP 10 IV 46% failed: FAILED_INSUFFICIENT_RESOURCES
26 aug 12:03:47 [default: ProfileLoop] - Finished evolving 1 pokemon; 0 xp gained

On the second rattata he still thinks there is enough candy, even in the next loop he does:

26 aug 12:04:45 [default: ProfileLoop] - Stack of pokemon ready to evolve: 1/1
26 aug 12:04:45 [default: ProfileLoop] - Starting stack evolve of 1 pokemon without lucky egg
26 aug 12:04:45 [default: ProfileLoop] - Not enough candy (7/12) to evolve WEEDLE CP 28 IV 73%
26 aug 12:04:45 [default: ProfileLoop] - Not enough candy (7/12) to evolve PIDGEY CP 10 IV 42%
26 aug 12:04:45 [default: ProfileLoop] - Evolving RATTATA CP 10 IV 46%
26 aug 12:04:46 [default: ProfileLoop] - Evolve of RATTATA CP 10 IV 46% failed: FAILED_INSUFFICIENT_RESOURCES
26 aug 12:04:46 [default: ProfileLoop] - Finished evolving 0 pokemon; 1050 xp gained

This was referenced Aug 25, 2016
@FrancYescO
Copy link
Contributor

FrancYescO commented Aug 25, 2016

just compiled and started with the old config:
is not able to get the initial pokestop

26 ago 01:41:41 [default] - Getting initial pokestops...
26 ago 01:42:01 [default] - Running socket server on port 8001
26 ago 01:42:01 [default: PokestopLoop] - Error running loop PokestopLoop!
kotlin.KotlinNullPointerException
        at ink.abb.pogo.scraper.gui.SocketServer.sendPokestop(SocketServer.kt:122)
        at ink.abb.pogo.scraper.tasks.Walk.run(Walk.kt:53)
        at ink.abb.pogo.scraper.Bot.task(Bot.kt:256)
        at ink.abb.pogo.scraper.tasks.ProcessPokestops.run(ProcessPokestops.kt:77)
        at ink.abb.pogo.scraper.Bot.task(Bot.kt:256)
        at ink.abb.pogo.scraper.Bot$start$8.invoke(Bot.kt:159)
        at ink.abb.pogo.scraper.Bot$start$8.invoke(Bot.kt:36)
        at ink.abb.pogo.scraper.Bot$runLoop$1.invoke(Bot.kt:200)
        at ink.abb.pogo.scraper.Bot$runLoop$1.invoke(Bot.kt:36)
        at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:18)

it also tryed to do a transfer after a catch (while stuck in the same point due to ^) and:

26 ago 01:42:06 [default: BotLoop] - Going to transfer VENONAT with CP 100 and IV 68%; reason: CP < 1500 and IV < 90%
26 ago 01:42:11 [default: BotLoop] - Going to transfer VENONAT with CP 100 and IV 68%; reason: CP < 1500 and IV < 90%
26 ago 01:42:16 [default: BotLoop] - Going to transfer VENONAT with CP 100 and IV 68%; reason: CP < 1500 and IV < 90%
26 ago 01:42:21 [default: BotLoop] - Going to transfer VENONAT with CP 100 and IV 68%; reason: CP < 1500 and IV < 90%
26 ago 01:42:26 [default: BotLoop] - Going to transfer VENONAT with CP 100 and IV 68%; reason: CP < 1500 and IV < 90%
26 ago 01:42:31 [default: BotLoop] - Going to transfer VENONAT with CP 100 and IV 68%; reason: CP < 1500 and IV < 90%
26 ago 01:42:36 [RxComputationScheduler-7] - Failed to transfer VENONAT: FAILED
26 ago 01:42:38 [RxComputationScheduler-8] - Failed to transfer VENONAT: FAILED
26 ago 01:42:39 [RxComputationScheduler-1] - Failed to transfer VENONAT: FAILED
26 ago 01:42:40 [RxComputationScheduler-2] - Failed to transfer VENONAT: FAILED
26 ago 01:42:42 [RxComputationScheduler-3] - Failed to transfer VENONAT: FAILED
26 ago 01:42:43 [RxComputationScheduler-4] - Failed to transfer VENONAT: FAILED

and probably related to ^, i'm not able to load pokebank from the rest api (500 (Internal Server Error), eggs and items work good)

Restard did no help.

@Sieberkev
Copy link
Collaborator

The pokebank REST thing is #1237 (comment), it's trying to read pokemons from the egg inventory :p

@jabbink
Copy link
Owner Author

jabbink commented Aug 26, 2016

@Sieberkev with inventory 88/0 after accepting ToS, possibly fixed in jabbink/PokemonGoAPI@e175265#diff-1aa570adde3e25ce66241e3dc32e2fd0R168

@FrancYescO
Copy link
Contributor

FrancYescO commented Aug 26, 2016

idk, probably my account got banned,
No, it log in using the oldapi-develop
but we need at least to catch this login error

26 ago 11:06:52 [default] - Logging in to game server...
26 ago 11:06:54 [default] - Logged in successfully
Getting profile data from pogo serverException in thread "default" kotlin.UninitializedPropertyAccessException: lateinit property playerStats has not been initialized
        at ink.abb.pogo.api.cache.Inventory.getPlayerStats(Inventory.kt:28)
        at ink.abb.pogo.scraper.Bot.<init>(Bot.kt:49)
        at ink.abb.pogo.scraper.MainKt.startBot(Main.kt:174)
        at ink.abb.pogo.scraper.services.BotService.submitBot(BotService.kt:42)
        at ink.abb.pogo.scraper.PokemonGoBotApplication$BotRunner$run$$inlined$forEach$lambda$1.invoke(PokemonGoBotApplication.kt:85)
        at ink.abb.pogo.scraper.PokemonGoBotApplication$BotRunner$run$$inlined$forEach$lambda$1.invoke(PokemonGoBotApplication.kt:67)
        at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:18)
Exception in thread "RxComputationScheduler-1" java.lang.IllegalStateException: Exception thrown on Scheduler.Worker thread. Add `onError` handling.
        at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:60)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: rx.exceptions.OnErrorNotImplementedException: lateinit property playerStats has not been initialized
        at rx.internal.util.InternalObservableUtils$ErrorNotImplementedAction.call(InternalObservableUtils.java:374)
        at rx.internal.util.InternalObservableUtils$ErrorNotImplementedAction.call(InternalObservableUtils.java:371)
        at rx.internal.util.ActionSubscriber.onError(ActionSubscriber.java:44)
        at rx.observers.SafeSubscriber._onError(SafeSubscriber.java:157)
        at rx.observers.SafeSubscriber.onError(SafeSubscriber.java:120)
        at rx.exceptions.Exceptions.throwOrReport(Exceptions.java:204)

@jabbink jabbink force-pushed the wip/newAPI branch 2 times, most recently from 550c4f8 to db9e935 Compare August 26, 2016 09:23
@FrancYescO
Copy link
Contributor

FrancYescO commented Aug 27, 2016

Take a look to these simple fix #1242
Except these fix,

the only bigger issue i've found and still here so far is #1237 (comment)
and just got it again right now, so its pretty random (but probably related to the profile update, thats seems is called directly from an api thread[RxComputationScheduler-8]) like a comunication issue

27 ago 14:09:42 [RxComputationScheduler-8] - XP gain: 2.740 XP in 6 mins; XP rate: 27.360/hr; Next level in: 3h35m
27 ago 14:09:42 [RxComputationScheduler-8] - Pokemon caught/transferred: 5/5; Pokemon caught from lures: 0; Items caught/dropped: 115/108;
27 ago 14:09:42 [RxComputationScheduler-8] - Pokebank 216/250; Stardust 247224; Inventory 292/350
27 ago 14:09:44 [default: WalkingLoop] - Destination reached.
Exception in thread "RxComputationScheduler-8" java.lang.IllegalStateException: Exception thrown on Scheduler.Worker thread. Add `onError` handling.
        at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:60)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: rx.exceptions.OnErrorNotImplementedException
        at rx.internal.util.InternalObservableUtils$ErrorNotImplementedAction.call(InternalObservableUtils.java:374)
        at rx.internal.util.InternalObservableUtils$ErrorNotImplementedAction.call(InternalObservableUtils.java:371)
        at rx.internal.util.ActionSubscriber.onError(ActionSubscriber.java:44)
        at rx.observers.SafeSubscriber._onError(SafeSubscriber.java:157)
        at rx.observers.SafeSubscriber.onError(SafeSubscriber.java:120)
        at rx.exceptions.Exceptions.throwOrReport(Exceptions.java:204)
        at rx.observers.SafeSubscriber.onNext(SafeSubscriber.java:144)
        at rx.internal.operators.OnSubscribeTimerOnce$1.call(OnSubscribeTimerOnce.java:49)
        at rx.internal.schedulers.EventLoopsScheduler$EventLoopWorker$2.call(EventLoopsScheduler.java:186)
        at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
        ... 7 more
Caused by: java.lang.NullPointerException
        at ink.abb.pogo.api.PoGoApiImpl.handleResponse(PoGoApiImpl.kt:290)
        at ink.abb.pogo.api.network.ActionQueue.sendRequests(ActionQueue.kt:180)
        at ink.abb.pogo.api.network.ActionQueue.access$sendRequests(ActionQueue.kt:26)
        at ink.abb.pogo.api.network.ActionQueue$1$1.invoke(ActionQueue.kt:62)
        at ink.abb.pogo.api.network.ActionQueue$1$1.call(ActionQueue.kt:26)
        at rx.internal.util.ActionSubscriber.onNext(ActionSubscriber.java:39)
        at rx.observers.SafeSubscriber.onNext(SafeSubscriber.java:139)
        ... 10 more

EDIT:
just got
27 ago 14:28:54 [RxComputationScheduler-5] - Failed to put egg in incubator; error: ERROR_INCUBATOR_ALREADY_IN_USE
it putted the egg in the incubator in the previous iteration, probably cache not invalidated after incubation?

@gise88
Copy link

gise88 commented Aug 29, 2016

Some news? 😃

@jacc
Copy link

jacc commented Aug 30, 2016

@gise88 I'm sure he'll let us know as he's going along. I'd join the Discord for more info.

@jabbink
Copy link
Owner Author

jabbink commented Aug 30, 2016

I don't have time to test this, and apparently nobody else cares. So everything grinds to a halt.

@gise88
Copy link

gise88 commented Aug 30, 2016

This will continue retrying to loot the same pokestop on a soft banned account..

screenshot_20160830_174011

@gise88
Copy link

gise88 commented Aug 30, 2016

Just created a new account:

30 ago 17:55:53 [RxComputationScheduler-8] - Put egg of 5.0km in unused incubator

and in the gui:
screenshot_20160830_175730

Probably something doesn't work on the evaluation of KM Walked...

And what about this?
screenshot_20160830_180131

and this?
screenshot_20160830_181016
Or: http://pastebin.com/razJuySL

@gise88
Copy link

gise88 commented Aug 30, 2016

Exception in thread "RxComputationScheduler-5" java.lang.IllegalStateException: Exception thrown on Scheduler.Worker thread. Add onError handling.
http://pastebin.com/JnHteT58

@gise88
Copy link

gise88 commented Sep 1, 2016

ea5e3866-84c0-11e5-930a-8d000a2d7ce6

}.size
if (luresInRange >= settings.campLurePokestop) {
}
if (luresInRange.size >= settings.campLurePokestop) {
if (writeCampStatus) {
Log.green("$luresInRange lure(s) in range, pausing")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${luresInRange.size} ?

* fix build

* Updated AUTHORS.md (#1262)

* API.md - Slashes missing in documentation (#1263)

* Add checkstyle to Gradle build (#1246)

* Enabled Checkstyle in Gradle
* Added checkstyle to build.gradle (only check "src/main/kotlin" and not the libraries)
* Fixed several checkstyle errors (File contains tab characters, Space needed before opening parenthesis, Line has trailing spaces) so the current checkstyle.xml builds without errors

* * Added check to avoid "){"

* [REST API] Added HTTP status codes for bad auth/requests (#1264)

* * Added status codes on bad requests/auth
* Updated API.md file

* * Replaced string concatenations with proper ${}'s and cleaned up some sentences
* Added missing stardust check on powerup

* * Update API.md with stardust check

* * Added more console logging
* Cleanup some one-use vars

* Improved config loading/saving (#1270)

* Remove unused ProgramController
* Renamed util.io.export*Writer classes/files
* Moved BotService save/load to new class/file util.io.SettingsJSONWriter

* Fix REST API pokedex indexes (#1275)

* Fix missing pokemons (missingno #0, mew #151) in REST API pokedex call
} else {
Log.red("Failed to put egg in incubator; error: $incubateResult")
val use = UseItemEggIncubator().withPokemonId(eggResult.pokemonData.id).withItemId(freeIncubators.first().id)
bot.api.queueRequest(use).subscribe {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.toBlocking() needed to fix #1256

@jabbink
Copy link
Owner Author

jabbink commented Nov 14, 2016

As this one contains merge conflicts and git should just merge it, reopening new pr

@jabbink jabbink closed this Nov 14, 2016
@jabbink jabbink mentioned this pull request Nov 14, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants