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

Prevent duplicate "skip ignored pokemon" alerts #5197

Merged
merged 3 commits into from
Sep 5, 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
11 changes: 11 additions & 0 deletions pokemongo_bot/cell_workers/pokemon_catch_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,17 @@ def work(self, response_dict=None):

# skip ignored pokemon
if not self._should_catch_pokemon(pokemon):
if not hasattr(self.bot,'skipped_pokemon'):
self.bot.skipped_pokemon = []

# Check if pokemon already skipped and suppress alert if so
for skipped_pokemon in self.bot.skipped_pokemon:
if pokemon.pokemon_id == skipped_pokemon.pokemon_id and \
pokemon.cp_exact == skipped_pokemon.cp_exact and \
pokemon.ivcp == skipped_pokemon.ivcp:
return WorkerResult.SUCCESS

self.bot.skipped_pokemon.append(pokemon)
self.emit_event(
'pokemon_appeared',
formatted='Skip ignored {pokemon}! [CP {cp}] [Potential {iv}] [A/D/S {iv_display}]',
Expand Down