From 90631c04ded1876bec917df489d8a1415bb626f0 Mon Sep 17 00:00:00 2001 From: DeXtroTip Date: Sat, 27 Aug 2016 17:03:45 +0100 Subject: [PATCH 1/6] Fixed incubator_eggs wrong print --- pokemongo_bot/cell_workers/incubate_eggs.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pokemongo_bot/cell_workers/incubate_eggs.py b/pokemongo_bot/cell_workers/incubate_eggs.py index 76f9885018..98ad7be0c8 100644 --- a/pokemongo_bot/cell_workers/incubate_eggs.py +++ b/pokemongo_bot/cell_workers/incubate_eggs.py @@ -35,15 +35,18 @@ def work(self): except: return + should_print = self._should_print() + if self.used_incubators and IncubateEggs.last_km_walked != self.km_walked: self.used_incubators.sort(key=lambda x: x.get("km")) km_left = self.used_incubators[0]['km']-self.km_walked if km_left <= 0: self._hatch_eggs() + should_print = False else: self.bot.metrics.next_hatching_km(km_left) - if self._should_print(): + if should_print: self._print_eggs() self._compute_next_update() From 9c385119c4b56b583e7b72dab1130e4bbe30858e Mon Sep 17 00:00:00 2001 From: DeXtroTip Date: Sat, 27 Aug 2016 17:53:27 +0100 Subject: [PATCH 2/6] Fixed pokemon hatched from eggs not added to cached inventory --- pokemongo_bot/cell_workers/incubate_eggs.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pokemongo_bot/cell_workers/incubate_eggs.py b/pokemongo_bot/cell_workers/incubate_eggs.py index 98ad7be0c8..3b103a72ae 100644 --- a/pokemongo_bot/cell_workers/incubate_eggs.py +++ b/pokemongo_bot/cell_workers/incubate_eggs.py @@ -219,6 +219,7 @@ def _hatch_eggs(self): # pokemon ids seem to be offset by one if pokemon['pokemon_id']!=-1: pokemon['name'] = self.bot.pokemon_list[(pokemon.get('pokemon_id')-1)]['Name'] + inventory.pokemons().add(pokemon) else: pokemon['name'] = "error" except: From bec6e289999cf15aaaea02647668fb58d80c9d83 Mon Sep 17 00:00:00 2001 From: DeXtroTip Date: Mon, 29 Aug 2016 00:27:01 +0100 Subject: [PATCH 3/6] Fix --- pokemongo_bot/cell_workers/incubate_eggs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pokemongo_bot/cell_workers/incubate_eggs.py b/pokemongo_bot/cell_workers/incubate_eggs.py index f93a5590c4..46e3e5ce96 100644 --- a/pokemongo_bot/cell_workers/incubate_eggs.py +++ b/pokemongo_bot/cell_workers/incubate_eggs.py @@ -1,5 +1,6 @@ from datetime import datetime, timedelta +from pokemongo_bot import inventory from pokemongo_bot.human_behaviour import sleep from pokemongo_bot.base_task import BaseTask @@ -206,14 +207,13 @@ def _hatch_eggs(self): candy = result.get('candy_awarded', "error") xp = result.get('experience_awarded', "error") sleep(self.hatching_animation_delay) - self.bot.latest_inventory = None try: pokemon_data = self._check_inventory(pokemon_ids) for pokemon in pokemon_data: # pokemon ids seem to be offset by one if pokemon['pokemon_id']!=-1: pokemon['name'] = self.bot.pokemon_list[(pokemon.get('pokemon_id')-1)]['Name'] - inventory.pokemons().add(pokemon) + inventory.pokemons().add(inventory.Pokemon(pokemon)) else: pokemon['name'] = "error" except: From 1ffb684bcf2827795a926afcecc0f740d4fd79d5 Mon Sep 17 00:00:00 2001 From: DeXtroTip Date: Mon, 29 Aug 2016 00:37:24 +0100 Subject: [PATCH 4/6] Fixed not using breakable incubators --- pokemongo_bot/cell_workers/incubate_eggs.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pokemongo_bot/cell_workers/incubate_eggs.py b/pokemongo_bot/cell_workers/incubate_eggs.py index 46e3e5ce96..86ebf0284f 100644 --- a/pokemongo_bot/cell_workers/incubate_eggs.py +++ b/pokemongo_bot/cell_workers/incubate_eggs.py @@ -62,9 +62,9 @@ def work(self): if self.ready_breakable_incubators: # get available eggs - eggs = self._filter_sort_eggs(self.infinite_incubator, - self.infinite_longer_eggs_first) - self._apply_incubators(eggs, self.ready_infinite_incubators) + eggs = self._filter_sort_eggs(self.breakable_incubator, + self.breakable_longer_eggs_first) + self._apply_incubators(eggs, self.ready_breakable_incubators) def _filter_sort_eggs(self, allowed, sorting): From 3cd6db02fc3018df7f156c4a8d29a9895e6fd11a Mon Sep 17 00:00:00 2001 From: DeXtroTip Date: Mon, 29 Aug 2016 03:53:44 +0100 Subject: [PATCH 5/6] Fixed error adding pokemon to cached inventory --- pokemongo_bot/cell_workers/incubate_eggs.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pokemongo_bot/cell_workers/incubate_eggs.py b/pokemongo_bot/cell_workers/incubate_eggs.py index 86ebf0284f..c94c622480 100644 --- a/pokemongo_bot/cell_workers/incubate_eggs.py +++ b/pokemongo_bot/cell_workers/incubate_eggs.py @@ -180,6 +180,9 @@ def _check_inventory(self, lookup_ids=[]): pokemon.get('individual_stamina', 0) ]}) matched_pokemon.append(pokemon) + #remove as egg and add as pokemon + inventory.pokemons().remove(pokemon['id']) + inventory.pokemons().add(inventory.Pokemon(pokemon)) continue if "player_stats" in inv_data: self.km_walked = inv_data.get("player_stats", {}).get("km_walked", 0) @@ -213,7 +216,6 @@ def _hatch_eggs(self): # pokemon ids seem to be offset by one if pokemon['pokemon_id']!=-1: pokemon['name'] = self.bot.pokemon_list[(pokemon.get('pokemon_id')-1)]['Name'] - inventory.pokemons().add(inventory.Pokemon(pokemon)) else: pokemon['name'] = "error" except: From e45eecbc6ea7d2c9f4cd23858f44713dd9e66e63 Mon Sep 17 00:00:00 2001 From: DeXtroTip Date: Mon, 29 Aug 2016 14:23:08 +0100 Subject: [PATCH 6/6] Moved remove egg and add Pokemon to _hatch_eggs --- pokemongo_bot/cell_workers/incubate_eggs.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pokemongo_bot/cell_workers/incubate_eggs.py b/pokemongo_bot/cell_workers/incubate_eggs.py index c94c622480..2bf147d5ab 100644 --- a/pokemongo_bot/cell_workers/incubate_eggs.py +++ b/pokemongo_bot/cell_workers/incubate_eggs.py @@ -180,9 +180,6 @@ def _check_inventory(self, lookup_ids=[]): pokemon.get('individual_stamina', 0) ]}) matched_pokemon.append(pokemon) - #remove as egg and add as pokemon - inventory.pokemons().remove(pokemon['id']) - inventory.pokemons().add(inventory.Pokemon(pokemon)) continue if "player_stats" in inv_data: self.km_walked = inv_data.get("player_stats", {}).get("km_walked", 0) @@ -216,6 +213,9 @@ def _hatch_eggs(self): # pokemon ids seem to be offset by one if pokemon['pokemon_id']!=-1: pokemon['name'] = self.bot.pokemon_list[(pokemon.get('pokemon_id')-1)]['Name'] + #remove as egg and add as pokemon + inventory.pokemons().remove(pokemon['id']) + inventory.pokemons().add(inventory.Pokemon(pokemon)) else: pokemon['name'] = "error" except: