Skip to content

Commit

Permalink
Iterate over each worker and treat them the same (#1356)
Browse files Browse the repository at this point in the history
  • Loading branch information
elicwhite authored and tstumm committed Jul 28, 2016
1 parent 453817b commit 8d65cdc
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions pokemongo_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,22 +163,17 @@ def work_on_cell(self, cell, position):
# Check if session token has expired
self.check_session(position)

worker = PokemonTransferWorker(self)
if worker.work() == WorkerResult.RUNNING:
return

worker = EvolveAllWorker(self)
if worker.work() == WorkerResult.RUNNING:
return

RecycleItemsWorker(self).work()

worker = CatchVisiblePokemonWorker(self)
if worker.work() == WorkerResult.RUNNING:
return

if SpinNearestFortWorker(self).work() == WorkerResult.RUNNING:
return
workers = [
PokemonTransferWorker,
EvolveAllWorker,
RecycleItemsWorker,
CatchVisiblePokemonWorker,
SpinNearestFortWorker
]

for worker in workers:
if worker(self).work() == WorkerResult.RUNNING:
return

self.navigator.take_step()

Expand Down

0 comments on commit 8d65cdc

Please sign in to comment.