Skip to content

Commit

Permalink
Removing unnecessary walking from the move to fort worker (#1166)
Browse files Browse the repository at this point in the history
  • Loading branch information
elicwhite authored and fredrik-hellmangroup committed Jul 27, 2016
1 parent b4c9af4 commit 8d1e127
Showing 1 changed file with 16 additions and 27 deletions.
43 changes: 16 additions & 27 deletions pokemongo_bot/cell_workers/move_to_fort_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,19 @@ def work(self):
logger.log('Need to move closer to Pokestop')
position = (lat, lng, 0.0)

if self.config.walk > 0:
if self._step_walker == None:
self._step_walker = StepWalker(
self.bot,
self.config.walk,
self.api._position_lat,
self.api._position_lng,
position[0],
position[1]
)


if self._step_walker.step():
return WorkerResult.SUCCESS
else:
return WorkerResult.RUNNING

else:
self.api.set_position(*position)

self.api.player_update(latitude=lat, longitude=lng)
response_dict = self.api.call()
logger.log('Arrived at Pokestop')
sleep(2)
return WorkerResult.SUCCESS

return None
if self._step_walker == None:
self._step_walker = StepWalker(
self.bot,
self.config.walk,
self.api._position_lat,
self.api._position_lng,
position[0],
position[1]
)


if not self._step_walker.step():
return WorkerResult.RUNNING

logger.log('Arrived at Pokestop')
return WorkerResult.SUCCESS

0 comments on commit 8d1e127

Please sign in to comment.