Skip to content

Commit

Permalink
Fixed a crash when a spin returns empty result. (PokemonGoF#974)
Browse files Browse the repository at this point in the history
  • Loading branch information
x1024 authored and MFizz committed Jul 29, 2016
1 parent 41b7ea0 commit d86bc70
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions pokemongo_bot/cell_workers/seen_fort_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ def work(self):
'FORT_SEARCH' in response_dict['responses']:

spin_details = response_dict['responses']['FORT_SEARCH']
if spin_details['result'] == 1:
spin_result = spin_details.get('result', -1)
if spin_result == 1:
logger.log("Loot: ", 'green')
experience_awarded = spin_details.get('experience_awarded',
False)
Expand Down Expand Up @@ -105,19 +106,21 @@ def work(self):
'PokeStops you are indeed softbanned. Please try again '
'in a few hours.')
raise RuntimeError(message)
elif spin_details['result'] == 2:
elif spin_result == 2:
logger.log("[#] Pokestop out of range")
elif spin_details['result'] == 3:
elif spin_result == 3:
pokestop_cooldown = spin_details.get(
'cooldown_complete_timestamp_ms')
if pokestop_cooldown:
seconds_since_epoch = time.time()
logger.log('PokeStop on cooldown. Time left: ' + str(
format_time((pokestop_cooldown / 1000) -
seconds_since_epoch)))
elif spin_details['result'] == 4:
elif spin_result == 4:
logger.log("Inventory is full, switching to catch mode...", 'red')
self.config.mode = 'poke'
else:
logger.log("Unknown spin result: " + str(spin_result), 'red')

if 'chain_hack_sequence_number' in response_dict['responses'][
'FORT_SEARCH']:
Expand Down
2 changes: 1 addition & 1 deletion web
Submodule web updated from 83463c to 12007b

0 comments on commit d86bc70

Please sign in to comment.