Skip to content

Commit

Permalink
Moving these flags into the workers. Make them run on each tick (#1159)
Browse files Browse the repository at this point in the history
  • Loading branch information
elicwhite authored Jul 27, 2016
1 parent dccae1f commit c6f4472
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
16 changes: 6 additions & 10 deletions pokemongo_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,17 +160,13 @@ def work_on_cell(self, cell, position, work_on_forts=1):
# Check if session token has expired
self.check_session(position)

if self.config.initial_transfer:
worker = InitialTransferWorker(self)
if worker.work() == WorkerResult.RUNNING:
return
self.config.initial_transfer = False
worker = InitialTransferWorker(self)
if worker.work() == WorkerResult.RUNNING:
return

if self.config.evolve_all:
worker = EvolveAllWorker(self)
if worker.work() == WorkerResult.RUNNING:
return
self.config.evolve_all = []
worker = EvolveAllWorker(self)
if worker.work() == WorkerResult.RUNNING:
return

RecycleItemsWorker(self).work()

Expand Down
5 changes: 4 additions & 1 deletion pokemongo_bot/cell_workers/evolve_all_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,14 @@ def _should_run(self):
# Will skip evolving if user wants to use an egg and there is none
skip_evolves = False

if self.config.evolve_all:
return skip_evolves

# Pop lucky egg before evolving to maximize xp gain
use_lucky_egg = self.config.use_lucky_egg
lucky_egg_count = self.bot.item_inventory_count(Item.ITEM_LUCKY_EGG.value)

if use_lucky_egg and lucky_egg_count > 0:
if use_lucky_egg and lucky_egg_count > 0:
logger.log('Using lucky egg ... you have {}'
.format(lucky_egg_count))
response_dict_lucky_egg = self.bot.use_lucky_egg()
Expand Down

0 comments on commit c6f4472

Please sign in to comment.