Skip to content

Commit

Permalink
moving_to_fort and moving_to_lured_fort now also emit current_position (
Browse files Browse the repository at this point in the history
#3614)

arrived_at_fort emits position
  • Loading branch information
brantje authored and solderzzc committed Aug 11, 2016
1 parent 6633630 commit f3c0ce3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
13 changes: 10 additions & 3 deletions pokemongo_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,17 @@ def _register_events(self):
'moving_to_fort',
parameters=(
'fort_name',
'distance'
'distance',
'current_position'
)
)
self.event_manager.register_event(
'moving_to_lured_fort',
parameters=(
'fort_name',
'distance',
'lure_distance'
'lure_distance',
'current_position'
)
)
self.event_manager.register_event(
Expand All @@ -217,7 +219,12 @@ def _register_events(self):
parameters=('status_code',)
)
self.event_manager.register_event('pokestop_searching_too_often')
self.event_manager.register_event('arrived_at_fort')
self.event_manager.register_event(
'arrived_at_fort',
parameters=(
'current_position'
)
)

# pokemon stuff
self.event_manager.register_event(
Expand Down
7 changes: 6 additions & 1 deletion pokemongo_bot/cell_workers/move_to_fort.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def work(self):
fort_event_data = {
'fort_name': u"{}".format(fort_name),
'distance': format_dist(dist, unit),
'current_position': self.bot.position
}

if self.is_attracted() > 0:
Expand All @@ -87,9 +88,13 @@ def work(self):
if not step_walker.step():
return WorkerResult.RUNNING

arrived_at_fort_data = {
'current_position': self.bot.position
}
self.emit_event(
'arrived_at_fort',
formatted='Arrived at fort.'
formatted='Arrived at fort.',
data=arrived_at_fort_data
)
return WorkerResult.SUCCESS

Expand Down

0 comments on commit f3c0ce3

Please sign in to comment.