Skip to content

Commit

Permalink
Fix no pokeballs log spamming (#4000)
Browse files Browse the repository at this point in the history
* Fix looping between equidstant pokestops

* :D

* emp

* changes

* fix no pokeballs log spamming, fix possible bug

* remove unnesscessary return

* revert pokemongo_bot/cell_workers/move_to_fort.py

* solve merge conflicts

* Remove extra whitespace
  • Loading branch information
umbreon222 authored and solderzzc committed Aug 17, 2016
1 parent 181fba5 commit 96bdbb6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
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()

# 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

0 comments on commit 96bdbb6

Please sign in to comment.