Skip to content

Commit

Permalink
Task EvolvePokemon should give us a status updates so we know it is w…
Browse files Browse the repository at this point in the history
…orking
  • Loading branch information
ch1ago committed Sep 23, 2016
1 parent f45267f commit 2fa4fda
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pokemongo_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ def _register_events(self):
)
self.event_manager.register_event(
'pokemon_evolve_check',
parameters=('has', 'needs', 'message')
parameters=('has', 'needs')
)
self.event_manager.register_event(
'pokemon_upgraded',
Expand Down
13 changes: 5 additions & 8 deletions pokemongo_bot/cell_workers/evolve_pokemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def work(self):
candy = inventory.candies().get(pokemon.pokemon_id)
pokemon_to_be_evolved = pokemon_to_be_evolved + min(candy.quantity / (pokemon.evolution_cost - 1), filtered_dict[pokemon.pokemon_id])

self._print_check(pokemon_to_be_evolved)
self._print_check(pokemon_to_be_evolved, self.min_pokemon_to_be_evolved)

has_minimum_to_evolve = pokemon_to_be_evolved >= self.min_pokemon_to_be_evolved
if has_minimum_to_evolve:
Expand All @@ -81,16 +81,13 @@ def work(self):
if pokemon.can_evolve_now():
self._execute_pokemon_evolve(pokemon, cache)

def _print_check(self, pokemon_to_be_evolved):
has_minimum_to_evolve = pokemon_to_be_evolved >= self.min_pokemon_to_be_evolved
result_message = ("Gotta catch`em all!", "Gotta evolv`em all!")[has_minimum_to_evolve]
def _print_check(self, has, needs):
self.emit_event(
'pokemon_evolve_check',
formatted='Checking... Has {has}, needs {needs}. {message}',
formatted='Evolvable: {has}/{need}',
data={
'has': pokemon_to_be_evolved,
'needs': self.min_pokemon_to_be_evolved,
'message': result_message
'has': has,
'needs': needs
}
)

Expand Down

0 comments on commit 2fa4fda

Please sign in to comment.