diff --git a/pokemongo_bot/cell_workers/catch_lured_pokemon.py b/pokemongo_bot/cell_workers/catch_lured_pokemon.py index 8702701cc0..e96e46e85d 100644 --- a/pokemongo_bot/cell_workers/catch_lured_pokemon.py +++ b/pokemongo_bot/cell_workers/catch_lured_pokemon.py @@ -1,12 +1,9 @@ from pokemongo_bot import logger from pokemongo_bot.cell_workers.utils import fort_details from pokemongo_bot.cell_workers.pokemon_catch_worker import PokemonCatchWorker +from pokemongo_bot.cell_workers.base_task import BaseTask - -class CatchLuredPokemon(object): - def __init__(self, bot, config): - self.bot = bot - +class CatchLuredPokemon(BaseTask): def work(self): lured_pokemon = self.get_lured_pokemon() if lured_pokemon: diff --git a/pokemongo_bot/cell_workers/catch_visible_pokemon.py b/pokemongo_bot/cell_workers/catch_visible_pokemon.py index 1551ff57bf..8b0ca86c73 100644 --- a/pokemongo_bot/cell_workers/catch_visible_pokemon.py +++ b/pokemongo_bot/cell_workers/catch_visible_pokemon.py @@ -1,14 +1,12 @@ import json from pokemongo_bot import logger +from pokemongo_bot.cell_workers.base_task import BaseTask from pokemongo_bot.cell_workers.pokemon_catch_worker import PokemonCatchWorker from utils import distance -class CatchVisiblePokemon(object): - def __init__(self, bot, config): - self.bot = bot - +class CatchVisiblePokemon(BaseTask): def work(self): if 'catchable_pokemons' in self.bot.cell and len(self.bot.cell['catchable_pokemons']) > 0: logger.log('Something rustles nearby!') diff --git a/pokemongo_bot/cell_workers/evolve_all.py b/pokemongo_bot/cell_workers/evolve_all.py index d4eec61f5f..f92ce023ed 100644 --- a/pokemongo_bot/cell_workers/evolve_all.py +++ b/pokemongo_bot/cell_workers/evolve_all.py @@ -1,13 +1,9 @@ from pokemongo_bot import logger from pokemongo_bot.human_behaviour import sleep from pokemongo_bot.item_list import Item +from pokemongo_bot.cell_workers.base_task import BaseTask - -class EvolveAll(object): - def __init__(self, bot, config): - self.api = bot.api - self.bot = bot - +class EvolveAll(BaseTask): def work(self): if not self._should_run(): return diff --git a/pokemongo_bot/cell_workers/follow_path.py b/pokemongo_bot/cell_workers/follow_path.py index 8d1024ca03..4043ff085f 100644 --- a/pokemongo_bot/cell_workers/follow_path.py +++ b/pokemongo_bot/cell_workers/follow_path.py @@ -4,16 +4,15 @@ import gpxpy.gpx import json import pokemongo_bot.logger as logger +from pokemongo_bot.cell_workers.base_task import BaseTask from pokemongo_bot.cell_workers.utils import distance, i2f, format_dist from pokemongo_bot.human_behaviour import sleep from pokemongo_bot.step_walker import StepWalker from pgoapi.utilities import f2i -class FollowPath(object): - - def __init__(self, bot, config): - self.bot = bot +class FollowPath(BaseTask): + def initialize(self): self.ptr = 0 self.points = self.load_path() diff --git a/pokemongo_bot/cell_workers/follow_spiral.py b/pokemongo_bot/cell_workers/follow_spiral.py index 2f2c50d1b4..a77363403d 100644 --- a/pokemongo_bot/cell_workers/follow_spiral.py +++ b/pokemongo_bot/cell_workers/follow_spiral.py @@ -3,12 +3,11 @@ import pokemongo_bot.logger as logger from pokemongo_bot.cell_workers.utils import distance, format_dist from pokemongo_bot.step_walker import StepWalker +from pokemongo_bot.cell_workers.base_task import BaseTask -class FollowSpiral(object): - def __init__(self, bot, config): - self.bot = bot - +class FollowSpiral(BaseTask): + def initialize(self): self.steplimit = self.bot.config.max_steps self.origin_lat = self.bot.position[0] self.origin_lon = self.bot.position[1] diff --git a/pokemongo_bot/cell_workers/handle_soft_ban.py b/pokemongo_bot/cell_workers/handle_soft_ban.py index 043fe1dc5c..0cfa7006d9 100644 --- a/pokemongo_bot/cell_workers/handle_soft_ban.py +++ b/pokemongo_bot/cell_workers/handle_soft_ban.py @@ -2,16 +2,13 @@ from pokemongo_bot import logger from pokemongo_bot.constants import Constants +from pokemongo_bot.cell_workers.base_task import BaseTask from pokemongo_bot.cell_workers import MoveToFort from pokemongo_bot.cell_workers.utils import distance from pokemongo_bot.worker_result import WorkerResult -class HandleSoftBan(object): - - def __init__(self, bot, config): - self.bot = bot - +class HandleSoftBan(BaseTask): def work(self): if not self.should_run(): return diff --git a/pokemongo_bot/cell_workers/incubate_eggs.py b/pokemongo_bot/cell_workers/incubate_eggs.py index 02d1146138..28b0f6260e 100644 --- a/pokemongo_bot/cell_workers/incubate_eggs.py +++ b/pokemongo_bot/cell_workers/incubate_eggs.py @@ -1,13 +1,12 @@ from pokemongo_bot import logger from pokemongo_bot.human_behaviour import sleep +from pokemongo_bot.cell_workers.base_task import BaseTask -class IncubateEggs(object): +class IncubateEggs(BaseTask): last_km_walked = 0 - def __init__(self, bot, config): - self.bot = bot - self.config = config + def initialize(self): self.ready_incubators = [] self.used_incubators = [] self.eggs = [] diff --git a/pokemongo_bot/cell_workers/move_to_fort.py b/pokemongo_bot/cell_workers/move_to_fort.py index 6c546fce7f..80cdc43e28 100644 --- a/pokemongo_bot/cell_workers/move_to_fort.py +++ b/pokemongo_bot/cell_workers/move_to_fort.py @@ -2,14 +2,11 @@ from pokemongo_bot.constants import Constants from pokemongo_bot.step_walker import StepWalker from pokemongo_bot.worker_result import WorkerResult +from pokemongo_bot.cell_workers.base_task import BaseTask from utils import distance, format_dist, fort_details -class MoveToFort(object): - - def __init__(self, bot, config): - self.bot = bot - +class MoveToFort(BaseTask): def should_run(self): return (self.bot.has_space_for_loot()) or self.bot.softban diff --git a/pokemongo_bot/cell_workers/recycle_items.py b/pokemongo_bot/cell_workers/recycle_items.py index 0a66bedb42..6492cb24e8 100644 --- a/pokemongo_bot/cell_workers/recycle_items.py +++ b/pokemongo_bot/cell_workers/recycle_items.py @@ -1,11 +1,7 @@ from pokemongo_bot import logger +from pokemongo_bot.cell_workers.base_task import BaseTask - -class RecycleItems(object): - - def __init__(self, bot, config): - self.bot = bot - +class RecycleItems(BaseTask): def work(self): self.bot.latest_inventory = None item_count_dict = self.bot.item_inventory_count('all') diff --git a/pokemongo_bot/cell_workers/spin_fort.py b/pokemongo_bot/cell_workers/spin_fort.py index 400ca6ec17..bcc98ef16b 100644 --- a/pokemongo_bot/cell_workers/spin_fort.py +++ b/pokemongo_bot/cell_workers/spin_fort.py @@ -8,13 +8,11 @@ from pokemongo_bot.constants import Constants from pokemongo_bot.human_behaviour import sleep from pokemongo_bot.worker_result import WorkerResult +from pokemongo_bot.cell_workers.base_task import BaseTask from utils import distance, format_time, fort_details -class SpinFort(object): - def __init__(self, bot, config): - self.bot = bot - +class SpinFort(BaseTask): def should_run(self): return self.bot.has_space_for_loot() diff --git a/pokemongo_bot/cell_workers/transfer_pokemon.py b/pokemongo_bot/cell_workers/transfer_pokemon.py index 70c2bd1667..34e4518096 100644 --- a/pokemongo_bot/cell_workers/transfer_pokemon.py +++ b/pokemongo_bot/cell_workers/transfer_pokemon.py @@ -2,13 +2,9 @@ from pokemongo_bot import logger from pokemongo_bot.human_behaviour import action_delay +from pokemongo_bot.cell_workers.base_task import BaseTask - -class TransferPokemon(object): - - def __init__(self, bot, config): - self.bot = bot - +class TransferPokemon(BaseTask): def work(self): pokemon_groups = self._release_pokemon_get_groups() for pokemon_id in pokemon_groups: