Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix no pokeballs log spamming #4000

Merged
merged 21 commits into from
Aug 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,4 @@
* pmquan
* net8q
* SyncX
* umbreon222
9 changes: 6 additions & 3 deletions pokemongo_bot/cell_workers/move_to_map_pokemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,12 @@ def work(self):

pokemon = pokemon_list[0]

# if we only have ultraballs and the target is not a vip don't snipe/walk
if (pokeballs + superballs) < self.min_ball and not pokemon['is_vip']:
return WorkerResult.SUCCESS
if pokeballs < 1:
if superballs < 1:
if ultraballs < 1:
return WorkerResult.SUCCESS
if not pokemon['is_vip']:
return WorkerResult.SUCCESS

if self.config['snipe']:
if self.snipe_high_prio_only:
Expand Down
13 changes: 12 additions & 1 deletion pokemongo_bot/cell_workers/pokemon_catch_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ def __init__(self, pokemon, bot, config):
############################################################################

def work(self, response_dict=None):
pokeballs = self.bot.item_inventory_count(1)
superballs = self.bot.item_inventory_count(2)
ultraballs = self.bot.item_inventory_count(3)

response_dict = response_dict or self.create_encounter_api_call()
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't we NOT encounter at all if we don't have any pokeballs. I think the stop check should be above this line.


# validate response
Expand All @@ -93,6 +97,14 @@ def work(self, response_dict=None):
if not self._should_catch_pokemon(pokemon):
return WorkerResult.SUCCESS

is_vip = self._is_vip_pokemon(pokemon)
if pokeballs < 1:
if superballs < 1:
if ultraballs < 1:
return WorkerResult.SUCCESS
if not is_vip:
return WorkerResult.SUCCESS

# log encounter
self.emit_event(
'pokemon_appeared',
Expand All @@ -113,7 +125,6 @@ def work(self, response_dict=None):
sleep(3)

# check for VIP pokemon
is_vip = self._is_vip_pokemon(pokemon)
if is_vip:
self.emit_event('vip_pokemon', formatted='This is a VIP pokemon. Catch!!!')

Expand Down