From 3dfe476b1e22c933fd7b0eb82529814126df304d Mon Sep 17 00:00:00 2001 From: Simba Zhang Date: Thu, 18 Aug 2016 18:51:06 -0700 Subject: [PATCH] Revert "Pokestops / Evolves / Transfers Logged to DB" (#4239) --- pokemongo_bot/cell_workers/evolve_pokemon.py | 10 +++------- pokemongo_bot/cell_workers/migrations/evolve_log.py | 5 ----- pokemongo_bot/cell_workers/migrations/pokestop_log.py | 5 ----- pokemongo_bot/cell_workers/migrations/transfer_log.py | 5 ----- pokemongo_bot/cell_workers/spin_fort.py | 4 ---- pokemongo_bot/cell_workers/transfer_pokemon.py | 9 ++------- 6 files changed, 5 insertions(+), 33 deletions(-) delete mode 100644 pokemongo_bot/cell_workers/migrations/evolve_log.py delete mode 100644 pokemongo_bot/cell_workers/migrations/pokestop_log.py delete mode 100644 pokemongo_bot/cell_workers/migrations/transfer_log.py diff --git a/pokemongo_bot/cell_workers/evolve_pokemon.py b/pokemongo_bot/cell_workers/evolve_pokemon.py index 78b31a9d4c..bb1f1d2b6f 100644 --- a/pokemongo_bot/cell_workers/evolve_pokemon.py +++ b/pokemongo_bot/cell_workers/evolve_pokemon.py @@ -3,13 +3,11 @@ from pokemongo_bot.inventory import Pokemon from pokemongo_bot.item_list import Item from pokemongo_bot.base_task import BaseTask -from pokemongo_bot.datastore import Datastore -class EvolvePokemon(Datastore, BaseTask): + +class EvolvePokemon(BaseTask): SUPPORTED_TASK_API_VERSION = 1 - def __init__(self, bot, config): - super(EvolvePokemon, self).__init__(bot, config) - + def initialize(self): self.api = self.bot.api self.evolve_all = self.config.get('evolve_all', []) @@ -115,8 +113,6 @@ def _execute_pokemon_evolve(self, pokemon, cache): 'xp': '?' } ) - with self.bot.database as conn: - conn.execute('''INSERT INTO evolve_log (pokemon, iv, cp) VALUES (?, ?, ?)''', (pokemon.name, pokemon.iv, pokemon.cp)) awarded_candies = response_dict.get('responses', {}).get('EVOLVE_POKEMON', {}).get('candy_awarded', 0) inventory.candies().get(pokemon.pokemon_id).consume(pokemon.evolution_cost - awarded_candies) inventory.pokemons().remove(pokemon.unique_id) diff --git a/pokemongo_bot/cell_workers/migrations/evolve_log.py b/pokemongo_bot/cell_workers/migrations/evolve_log.py deleted file mode 100644 index 54b4a7a6de..0000000000 --- a/pokemongo_bot/cell_workers/migrations/evolve_log.py +++ /dev/null @@ -1,5 +0,0 @@ -from yoyo import step - -step( - "CREATE TABLE evolve_log (pokemon text, iv real, cp real, dated datetime DEFAULT CURRENT_TIMESTAMP)" -) diff --git a/pokemongo_bot/cell_workers/migrations/pokestop_log.py b/pokemongo_bot/cell_workers/migrations/pokestop_log.py deleted file mode 100644 index 3c310bd3b9..0000000000 --- a/pokemongo_bot/cell_workers/migrations/pokestop_log.py +++ /dev/null @@ -1,5 +0,0 @@ -from yoyo import step - -step( - "CREATE TABLE pokestop_log (pokestop text, exp real, items text, dated datetime DEFAULT CURRENT_TIMESTAMP)" -) diff --git a/pokemongo_bot/cell_workers/migrations/transfer_log.py b/pokemongo_bot/cell_workers/migrations/transfer_log.py deleted file mode 100644 index 3c661eac66..0000000000 --- a/pokemongo_bot/cell_workers/migrations/transfer_log.py +++ /dev/null @@ -1,5 +0,0 @@ -from yoyo import step - -step( - "CREATE TABLE transfer_log (pokemon text, iv real, cp real, dated datetime DEFAULT CURRENT_TIMESTAMP)" -) diff --git a/pokemongo_bot/cell_workers/spin_fort.py b/pokemongo_bot/cell_workers/spin_fort.py index b68bd31339..f49d2c1408 100644 --- a/pokemongo_bot/cell_workers/spin_fort.py +++ b/pokemongo_bot/cell_workers/spin_fort.py @@ -79,16 +79,12 @@ def work(self): 'items': items_awarded } ) - with self.bot.database as conn: - conn.execute('''INSERT INTO pokestop_log (pokestop, exp, items) VALUES (?, ?, ?)''', (fort_name, str(experience_awarded), str(items_awarded))) else: self.emit_event( 'pokestop_empty', formatted='Found nothing in pokestop {pokestop}.', data={'pokestop': fort_name} ) - with self.bot.database as conn: - conn.execute('''INSERT INTO pokestop_log (pokestop) VALUES (?)''', (fort_name)) pokestop_cooldown = spin_details.get( 'cooldown_complete_timestamp_ms') self.bot.fort_timeouts.update({fort["id"]: pokestop_cooldown}) diff --git a/pokemongo_bot/cell_workers/transfer_pokemon.py b/pokemongo_bot/cell_workers/transfer_pokemon.py index 8b3affed6f..1dfad06d52 100644 --- a/pokemongo_bot/cell_workers/transfer_pokemon.py +++ b/pokemongo_bot/cell_workers/transfer_pokemon.py @@ -5,13 +5,10 @@ from pokemongo_bot.human_behaviour import action_delay from pokemongo_bot.base_task import BaseTask from pokemongo_bot.inventory import Pokemons, Pokemon, Attack -from pokemongo_bot.datastore import Datastore -class TransferPokemon(Datastore, BaseTask): +class TransferPokemon(BaseTask): SUPPORTED_TASK_API_VERSION = 1 - - def __init__(self, bot, config): - super(TransferPokemon, self).__init__(bot, config) + def initialize(self): self.transfer_wait_min = self.config.get('transfer_wait_min', 1) self.transfer_wait_max = self.config.get('transfer_wait_max', 4) @@ -178,8 +175,6 @@ def release_pokemon(self, pokemon): 'dps': pokemon.moveset.dps } ) - with self.bot.database as conn: - conn.execute('''INSERT INTO transfer_log (pokemon, iv, cp) VALUES (?, ?, ?)''', (pokemon.name, pokemon.iv, pokemon.cp)) action_delay(self.transfer_wait_min, self.transfer_wait_max) def _get_release_config_for(self, pokemon):