diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py index e5e82f4f13..c19f64e667 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -34,10 +34,15 @@ def start(self): def take_step(self): location = self.navigator.take_step() - cells = self.find_close_cells(*location[0:2]) + self.work_cells(1, self.position[0:2]) - for cell in cells: - self.work_on_cell(cell, location) + def work_cells(self, work_on_forts=1, location=None): + if (location is None): + location = self.position[0:2] + + cells = self.find_close_cells(*location) + for cell in cells: + self.work_on_cell(cell, location, work_on_forts) def update_web_location(self, cells=[], lat=None, lng=None, alt=None): # we can call the function with no arguments and still get the position and map_cells @@ -119,7 +124,7 @@ def find_close_cells(self, lat, lng): self.update_web_location(map_cells,lat,lng) return map_cells - def work_on_cell(self, cell, position): + def work_on_cell(self, cell, position, work_on_forts=1): # Check if session token has expired self.check_session(position) @@ -189,8 +194,8 @@ def work_on_cell(self, cell, position): for pokemon in cell['wild_pokemons']: if self.catch_pokemon(pokemon) == PokemonCatchWorker.NO_POKEBALLS: break - if (self.config.mode == "all" or - self.config.mode == "farm"): + if ((self.config.mode == "all" or + self.config.mode == "farm") and work_on_forts): if 'forts' in cell: # Only include those with a lat/long forts = [fort diff --git a/pokemongo_bot/cell_workers/move_to_fort_worker.py b/pokemongo_bot/cell_workers/move_to_fort_worker.py index 2889d74d41..83a6467ac0 100644 --- a/pokemongo_bot/cell_workers/move_to_fort_worker.py +++ b/pokemongo_bot/cell_workers/move_to_fort_worker.py @@ -41,6 +41,8 @@ def work(self): while True: if step_walker.step(): break + else: + self.bot.work_cells(0) else: self.api.set_position(*position)