Skip to content

Commit

Permalink
More items info at start (PokemonGoF#1167)
Browse files Browse the repository at this point in the history
* Update __init__.py

* Update pokemon_catch_worker.py

* Update CONTRIBUTORS.md
  • Loading branch information
Surceis authored and MFizz committed Jul 29, 2016
1 parent 16242b7 commit 8cfd537
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@
* VictorChen
* AlvaroGzP
* fierysolid
* surfaace
* surfaace
* surceis
16 changes: 8 additions & 8 deletions pokemongo_bot/cell_workers/pokemon_catch_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,20 +94,20 @@ def work(self):
#logger.log('[x] Rule prevents capture.')
return False

balls_stock = self.bot.pokeball_inventory()
items_stock = self.bot.current_inventory()
while(True):

## pick the most simple ball from stock
pokeball = 1 # start from 1 - PokeBalls

current_type = pokeball
while(balls_stock[current_type] is 0 and current_type < 3): # if this type's stock = 0 and not top tier yet
while(items_stock[current_type] is 0 and current_type < 3): # if this type's stock = 0 and not top tier yet
current_type = current_type + 1 # progress to next tier
if balls_stock[current_type] > 0: # next tier's stock > 0
if items_stock[current_type] > 0: # next tier's stock > 0
pokeball = current_type

## re-check stock again
if balls_stock[pokeball] is 0:
if items_stock[pokeball] is 0:
logger.log('Out of pokeballs, switching to farming mode...', 'red')
# Begin searching for pokestops.
self.config.mode = 'farm'
Expand All @@ -120,7 +120,7 @@ def work(self):
success_percentage = '{0:.2f}'.format(catch_rate[pokeball-1]*100)
logger.log('Catch Rate with normal Pokeball is low ({}%). Throwing {}... ({} left!)'.format(success_percentage,self.item_list[str(berry_id)],berries_count-1))

if balls_stock[pokeball] is 0:
if items_stock[pokeball] is 0:
break

self.api.use_item_capture(
Expand All @@ -146,18 +146,18 @@ def work(self):
current_type = pokeball
while(current_type < 3):
current_type = current_type+1
if catch_rate[pokeball-1] < 0.35 and balls_stock[current_type] > 0:
if catch_rate[pokeball-1] < 0.35 and items_stock[current_type] > 0:
# if current ball chance to catch is under 35%, and player has better ball - then use it
pokeball = current_type # use better ball

# @TODO, use the best ball in stock to catch VIP (Very Important Pokemon: Configurable)

balls_stock[pokeball] = balls_stock[pokeball] - 1
items_stock[pokeball] = items_stock[pokeball] - 1
success_percentage = '{0:.2f}'.format(catch_rate[pokeball-1]*100)
logger.log('Using {} (chance: {}%)... ({} left!)'.format(
self.item_list[str(pokeball)],
success_percentage,
balls_stock[pokeball]
items_stock[pokeball]
))

id_list1 = self.count_pokemon_inventory()
Expand Down

0 comments on commit 8cfd537

Please sign in to comment.