Skip to content

Commit

Permalink
Should fix PokemonGoF#5128 and PokemonGoF#5523 (both regards MoveToMa…
Browse files Browse the repository at this point in the history
…pPokemon task). NOTE: Please note that there are many reasons a pokemon will "not exist" and they are: it could be already caught by you, expired, too far from the given coords and/or wrong coords/infos at all. Also, when using social and MoveToMapPokemon, the reason it skips the catch after it teleports back is due to the "spawnpoint_id" key, which doesnt exist in the social JSON data and the correct key value is "spawn_point_id" (its been fixed).

Minor text refactors on the new Sniper task.
  • Loading branch information
YvesHenri authored and henrimeep committed Sep 19, 2016
1 parent 21d4dee commit 70db754
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions pokemongo_bot/cell_workers/move_to_map_pokemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,9 @@ def snipe(self, pokemon):
# Simulate kind of a lag after teleporting/moving to a long distance
time.sleep(2)

# If social is enabled, trust it
exists = self.bot.config.enable_social
verify = not self.bot.config.enable_social
# If social is enabled and if no verification is needed, trust it. Otherwise, update IDs!
verify = not pokemon.get('encounter_id') or not pokemon.get('spawn_point_id')
exists = not verify and self.bot.config.enable_social

# If social is disabled, we will have to make sure the target still exists
if verify:
Expand Down
10 changes: 5 additions & 5 deletions pokemongo_bot/cell_workers/sniper.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ def validate(self):
else:
raise ValueError("Empty reply")
except requests.exceptions.Timeout:
raise ValueError("Fetching has timed out!")
raise ValueError("Fetching has timed out")
except requests.exceptions.ConnectionError:
raise ValueError("Source not available!")
raise ValueError("Source not available")
except:
raise

Expand Down Expand Up @@ -231,7 +231,7 @@ def initialize(self):

# Notify user if all sources are invalid and cant proceed
if not self.sources:
self._error("There is no source available. Disabling TeleportSniper...")
self._error("There is no source available. Disabling Sniper...")
self.disabled = True

def is_snipeable(self, pokemon):
Expand All @@ -242,7 +242,7 @@ def is_snipeable(self, pokemon):

# Skip if expired (cast milliseconds to seconds for comparision)
if (pokemon.get('expiration_timestamp_ms', 0) or pokemon.get('last_modified_timestamp_ms', 0)) / 1000 < time.time():
self._trace('{} is expired ! Skipping...'.format(pokemon.get('pokemon_name')))
self._trace('{} is expired! Skipping...'.format(pokemon.get('pokemon_name')))
return False

# Skip if already cached
Expand Down Expand Up @@ -311,7 +311,7 @@ def snipe(self, pokemon):
for nearby_pokemon in nearby_pokemons:
nearby_pokemon_id = nearby_pokemon.get('pokemon_data', {}).get('pokemon_id') or nearby_pokemon.get('pokemon_id')

# If we find the target, it exists and will very likely be encountered/caught (success)
# If we found the target, it exists and will very likely be encountered/caught (success)
if nearby_pokemon_id == pokemon.get('pokemon_id', 0):
exists = True
success = True
Expand Down

0 comments on commit 70db754

Please sign in to comment.