-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Sniper task: Keeping 'missing' Pokemon + sorting order correction #5613
Changes from 6 commits
6833f63
edfbbea
4cf52d6
0f5dcef
038b8c2
9e3bba8
f9f62e0
6996ebd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
import calendar | ||
|
||
from random import uniform | ||
from operator import itemgetter, methodcaller | ||
from datetime import datetime | ||
from pokemongo_bot import inventory | ||
from pokemongo_bot.item_list import Item | ||
|
@@ -277,8 +278,11 @@ def is_snipeable(self, pokemon): | |
if pokemon.get('vip', False): | ||
self._trace('{} is not catchable and bad IV (if any), however its a VIP!'.format(pokemon.get('pokemon_name'))) | ||
else: | ||
self._trace('{} is not catachable, nor a VIP and bad IV (if any). Skipping...'.format(pokemon.get('pokemon_name'))) | ||
return False | ||
if pokemon['missing']: | ||
self._trace('{} is not catchable, not VIP and bad IV (if any), however its a missing one.'.format(pokemon.get('pokemon_name'))) | ||
else: | ||
self._trace('{} is not catchable, nor a VIP or a missing one and bad IV (if any). Skipping...'.format(pokemon.get('pokemon_name'))) | ||
return False | ||
|
||
return True | ||
|
||
|
@@ -362,8 +366,7 @@ def work(self): | |
|
||
if targets: | ||
# Order the targets (descending) | ||
for attr in self.order: | ||
targets.sort(key=lambda pokemon: pokemon[attr], reverse=True) | ||
targets = sorted(targets, key=itemgetter(*self.order), reverse=True) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @YvesHenri So, at every call on the loop, the targets list will be sorted by loop's current pokemon[attr] only. Please look at https://docs.python.org/2/library/operator.html : There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know. Thats what I meant. Although, the final/merged list will have around 30 |
||
|
||
shots = 0 | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change it from
if pokemon['missing']:
toif pokemon.get('missing', False):
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ho I see, sorry. Thanks to have handle that