Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix for evolvable count #5694

Merged
merged 1 commit into from
Sep 27, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions pokemongo_bot/cell_workers/evolve_pokemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(self, bot, config):

def initialize(self):
self.start_time = 0
self.next_log_update = None
self.next_log_update = 0
self.log_interval = self.config.get('log_interval', 120)
self.evolve_list = self.config.get('evolve_list', [])
self.donot_evolve_list = self.config.get('donot_evolve_list', [])
Expand Down Expand Up @@ -79,19 +79,19 @@ def work(self):
self._execute_pokemon_evolve(pokemon, cache)

def _log_update_if_should(self, has, needs):
self._compute_next_log_update()
if self._should_log_update:
if self._should_log_update():
self._compute_next_log_update()
self.emit_event(
'pokemon_evolve_check',
formatted='Evolvable: {has}/{need}',
formatted='Evolvable: {has}/{needs}',
data={'has': has, 'needs': needs}
)

def _compute_next_log_update(self):
self.next_log_update = datetime.now() + timedelta(seconds=self.log_interval)
self.next_log_update = time.time() + self.log_interval

def _should_log_update(self):
return datetime.now() >= self.next_log_update
return time.time() >= self.next_log_update

def _should_run(self):
if not self.evolve_list or self.evolve_list[0] == 'none':
Expand Down