Azelphur / PokemonGo-CalcyIV-Renamer

Uses adb to send fake tap events to your phone, alongside Calcy IV to automatically rename all your pokemon.
GNU General Public License v3.0
77 stars 32 forks source link

Check for blacklist only on success #45

Closed claytono closed 5 years ago

claytono commented 5 years ago

If we couldn't scan the pokemon, we probably don't have the name, and when that happens things crash because there is no name key in the values returned.

esauvisky commented 5 years ago

Ohhh, of course! This explains everything. I used to use:

if values and values['name'] ...

to overcome that error, but never went on the hunt for the root cause.

Azelphur commented 5 years ago

As far as I can see, this would cause the blacklist as a whole to never work, as any blacklisted pokemon wouldn't scan, which would result in CALCY_SCAN_INVALID and not CALCY_SUCCESS. At best we would only be able to blacklist pokemon that scan successfully - which makes no sense.

For reference, Calcy picks up name using the candy type and total HP, which do not get obscured and should always be readable.

If you're getting ValueErrors when referencing values['name'] I would suggest a patch to check if 'name' in values and values['name'] in self.config['blacklist'] feel free to reopen if I've got this wrong.

claytono commented 5 years ago

If you're getting ValueErrors when referencing values['name'] I would suggest a patch to check if 'name' in values and values['name'] in self.config['blacklist'] feel free to reopen if I've got this wrong.

That's exactly the problem I'm having. I'll rework this as you suggested.