Skip to content

Commit

Permalink
Merge cells together to avoid staying in one cell too long (PokemonGo…
Browse files Browse the repository at this point in the history
…F#1061)

* Merge cells together to avoid staying in one cell too long

This should help mitigate the issue where the bot travels to a stop
that is farther than a nearby one because the nearer one is in another
cell.

I also release control back to the make loop after catching any pokemon.

* PR Feedback fixes

+ Add concatenation of nearby cells rather than override.
~ Actually call the SeenFortWorker rather than just reference it.

* Don't make work a property

I seem to have made it one at some point, somehow… Go PyCharm!

* Add check to ensure there are available gyms
  • Loading branch information
bstpierr authored and MFizz committed Jul 29, 2016
1 parent e539267 commit 3d21009
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pokemongo_bot/cell_workers/seen_fort_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def work(self):

pokestop_cooldown = spin_details.get(
'cooldown_complete_timestamp_ms')
self.bot.fort_timeouts.update({self.fort["id"]: pokestop_cooldown})
if pokestop_cooldown:
seconds_since_epoch = time.time()
logger.log('PokeStop on cooldown. Time left: ' + str(
Expand All @@ -120,6 +121,7 @@ def work(self):
pokestop_cooldown = spin_details.get(
'cooldown_complete_timestamp_ms')
if pokestop_cooldown:
self.bot.fort_timeouts.update({self.fort["id"]: pokestop_cooldown})
seconds_since_epoch = time.time()
logger.log('PokeStop on cooldown. Time left: ' + str(
format_time((pokestop_cooldown / 1000) -
Expand All @@ -137,6 +139,7 @@ def work(self):
'chain_hack_sequence_number']
else:
logger.log('Possibly searching too often - taking a short rest :)', 'yellow')
self.bot.fort_timeouts[self.fort["id"]] = (time.time() + 300) * 1000 # Don't spin for 5m
return 11
sleep(8)
return 0
Expand Down

0 comments on commit 3d21009

Please sign in to comment.