PokemonGo-Bot icon indicating copy to clipboard operation
PokemonGo-Bot copied to clipboard

Conflicting criteria of minimum balls to resume catch limiter

Open ChiefM3 opened this issue 8 years ago • 11 comments

I am on dev branch.

Something like this happens.

er).
[2017-07-28 17:11:08] Resume time hasn't passed yet, but balls on hand (126) exceeds threshold 100. Re-enabling catch tasks.
[2017-07-28 17:11:08] Balls on hand (126) has reached threshold 150. Disabling catch tasks until 17:21:08 or balls on hand > threshold (whichever is later).
[2017-07-28 17:11:10] Resume time hasn't passed yet, but balls on hand (126) exceeds threshold 100. Re-enabling catch tasks.
[2017-07-28 17:11:10] Balls on hand (126) has reached threshold 150. Disabling catch tasks until 17:21:10 or balls on hand > threshold (whichever is later).
[2017-07-28 17:11:11] Resume time hasn't passed yet, but balls on hand (126) exceeds threshold 100. Re-enabling catch tasks.
[2017-07-28 17:11:11] Balls on hand (126) has reached threshold 150. Disabling catch tasks until 17:21:11 or balls on hand > threshold (whichever is later).
[2017-07-28 17:11:12] Resume time hasn't passed yet, but balls on hand (126) exceeds threshold 100. Re-enabling catch tasks.
[2017-07-28 17:11:12] Balls on hand (126) has reached threshold 150. Disabling catch tasks until 17:21:12 or balls on hand > threshold (whichever is later).
[2017-07-28 17:11:13] Resume time hasn't passed yet, but balls on hand (126) exceeds threshold 100. Re-enabling catch tasks.
[2017-07-28 17:11:13] Balls on hand (126) has reached threshold 150. Disabling catch tasks until 17:21:13 or balls on hand > threshold (whichever is later).

This happens because in catch_limiter.py the criteria to start or stop limit catch is mixed up with resume_at_balls and min_balls. So in my case when I tried min_balls = 150 and resume_at_balls = 100(default value) catch limit would be initiated because the bot has less than 150 balls, and then the catch limit would be canceled because the bot has more than 100 balls. This code should use a consistent criteria.

ChiefM3 avatar Jul 28 '17 08:07 ChiefM3

Sanity checks like this are needed in more places I agree. We'll see who comes around to this first. In the mean time, please set your config to something more reasonable :wink:

davidakachaos avatar Jul 28 '17 09:07 davidakachaos

This is easy to solve... in config, add "resume_at_balls": and a value bigger than 150, say 200.

MerlionRock avatar Jul 28 '17 09:07 MerlionRock

But seriously.... you don't need to hold so many balls on hand...

MerlionRock avatar Jul 28 '17 09:07 MerlionRock

He could be saving up some balls for irl play

davidakachaos avatar Jul 28 '17 09:07 davidakachaos

@davidakachaos I see, documentation has no mention of resume_at_balls, and config example doesn't have it too.

Should add it in.

MerlionRock avatar Jul 28 '17 09:07 MerlionRock

I think we should use one of the parameters unless there is some special meaning for both values. And i am saving up some balls for my 4YO ;)

ChiefM3 avatar Jul 28 '17 09:07 ChiefM3

@ChiefM3 resume_at_balls is already coded to get from config. Just add it into CatchLimiter task.

I will do a PR to add it into documentation and as well as config example. Thank you.

MerlionRock avatar Jul 28 '17 09:07 MerlionRock

Okay, I've done some code review of catch_limiter.py.

Currently there are 2 types of logic that activate/deactivate the catch_limiter.

  1. compare balls_on_hand vs resume_at_balls OR if time has passed
  2. compare balls_on_hand vs min_balls AND if time has passed

The variables resume_at_balls and min_balls are not used in any other parts of the bot, and there seems to be no distinct use between the two values. So I suggest we combine the logic and parameter into a single one. Suggestions?

ChiefM3 avatar Jul 31 '17 02:07 ChiefM3

Resume_at is optional, min_balls isn't

davidakachaos avatar Aug 01 '17 09:08 davidakachaos

@davidakachaos Can I ask why we need two distinct criteria?

ChiefM3 avatar Aug 01 '17 10:08 ChiefM3

min_balls is the setting to disable catching:

Balls on hand (23) has reached threshold 25. Disabling catch tasks until 12:14:33

And the resume_at is for re-enabling the catches when that number is reached prior to the resume time:

All catch tasks disabled until 12:14:33 or balls on hand (30) >= 100

So when the balls on hand reach 100 (in this example) the limiter will resume catching. But you may configure the bot not to use the resume_at limit

davidakachaos avatar Aug 01 '17 10:08 davidakachaos