Skip to content

Commit

Permalink
Fix merge conflicts that caused bugs (PokemonGoF#1361)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nihisil authored and MFizz committed Jul 29, 2016
1 parent bc6e293 commit 3454b49
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
8 changes: 6 additions & 2 deletions pokemongo_bot/cell_workers/pokemon_catch_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ def work(self):
logger.log(
'Oh no! {} vanished! :('.format(pokemon_name), 'red')
if status is 1:
id_list2 = self.count_pokemon_inventory()

self.bot.metrics.captured_pokemon(pokemon_name, cp, iv_display, pokemon_potential)

Expand All @@ -198,7 +199,6 @@ def work(self):

if self.config.evolve_captured:
# No need to capture this even for metrics, player stats includes it.
id_list2 = self.count_pokemon_inventory()
pokemon_to_transfer = list(Set(id_list2) - Set(id_list1))

# TODO dont throw RuntimeError, do something better
Expand All @@ -215,9 +215,13 @@ def work(self):
logger.log(
'Failed to evolve {}!'.format(pokemon_name))

captured_pokemon_id = list(Set(id_list2) - Set(id_list1))
captured_pokemon_id = captured_pokemon_id and captured_pokemon_id[0] or None

self.transfer_worker.check_stronger_pokemon(pokemon_name,
pokemon_data,
max_criteria_pokemon_list)
max_criteria_pokemon_list,
captured_pokemon_id)

break
time.sleep(5)
Expand Down
7 changes: 5 additions & 2 deletions pokemongo_bot/cell_workers/pokemon_transfer_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def should_release_pokemon(self, pokemon_name, cp, iv):

return logic_to_function[cp_iv_logic](*release_results.values())

def check_stronger_pokemon(self, pokemon_name, pokemon_data, max_criteria_pokemon_list):
def check_stronger_pokemon(self, pokemon_name, pokemon_data, max_criteria_pokemon_list, captured_pokemon_id):
if not self.config.release_pokemon:
return

Expand All @@ -142,10 +142,13 @@ def check_stronger_pokemon(self, pokemon_name, pokemon_data, max_criteria_pokemo
if better:
logger.log('Owning weaker {}. Replacing it with {}!'.format(owned_display, display_pokemon), 'blue')
action_delay(self.config.action_wait_min, self.config.action_wait_max)
self.release_pokemon(pokemon_data['pokemon_id'])
self.release_pokemon(owned['id'])
logger.log('Weaker {} has been exchanged for candy!'.format(owned_display), 'blue')
return False
else:
if captured_pokemon_id:
action_delay(self.config.action_wait_min, self.config.action_wait_max)
self.release_pokemon(captured_pokemon_id)
logger.log('Owning better {} already!'.format(owned_display), 'blue')
return True
else:
Expand Down

0 comments on commit 3454b49

Please sign in to comment.