Skip to content

Commit

Permalink
Fixed a crash when a spin returns empty result. (#974) (#994)
Browse files Browse the repository at this point in the history
  • Loading branch information
x1024 authored and tstumm committed Jul 26, 2016
1 parent 58454e5 commit 8964c0a
Showing 1 changed file with 7 additions and 4 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

0 comments on commit 8964c0a

Please sign in to comment.