From ab64e334678b1a138e38917bf7fe42e0748c2fdf Mon Sep 17 00:00:00 2001 From: MerlionRock Date: Sat, 6 May 2017 12:56:51 +0800 Subject: [PATCH 1/3] Added new follow path option Follow Path: Added option to disable location update infomation output to console --- pokemongo_bot/cell_workers/follow_path.py | 30 ++++++++++++++--------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/pokemongo_bot/cell_workers/follow_path.py b/pokemongo_bot/cell_workers/follow_path.py index 38fc476354..6688acaf11 100644 --- a/pokemongo_bot/cell_workers/follow_path.py +++ b/pokemongo_bot/cell_workers/follow_path.py @@ -38,6 +38,12 @@ def initialize(self): else: self.ptr = 0 + + if self.disable_location_output: + self.emit_event( + 'position_update', + formatted="Bot in follow path mode, position update disabled. You will not be inform of path taken by bot." + ) def _process_config(self): self.path_file = self.config.get("path_file", None) @@ -48,6 +54,7 @@ def _process_config(self): self.timer_restart_max = getSeconds(self.config.get("timer_restart_max", "02:00:00")) self.walker = self.config.get('walker', 'StepWalker') self.disable_while_hunting = self.config.get("disable_while_hunting", True) + self.disable_location_output = self.config.get('disable_location_output', False) if self.timer_restart_min > self.timer_restart_max: raise ValueError('path timer_restart_min is bigger than path timer_restart_max') #TODO there must be a more elegant way to do it... @@ -187,17 +194,18 @@ def work(self): lat, lng ) - - self.emit_event( - 'position_update', - formatted="Walking from {last_position} to {current_position}, distance left: ({distance} {distance_unit}) ..", - data={ - 'last_position': (last_lat, last_lng, last_alt), - 'current_position': point["location"], - 'distance': format_dist(dist,self.distance_unit,self.append_unit), - 'distance_unit': self.distance_unit - } - ) + + if not self.disable_location_output: + self.emit_event( + 'position_update', + formatted="Walking from {last_position} to {current_position}, distance left: ({distance} {distance_unit}) ..", + data={ + 'last_position': (last_lat, last_lng, last_alt), + 'current_position': point["location"], + 'distance': format_dist(dist,self.distance_unit,self.append_unit), + 'distance_unit': self.distance_unit + } + ) if (self.bot.config.walk_min > 0 and is_at_destination) or (self.status in [STATUS_WANDERING, STATUS_LOITERING] and time.time() >= self.waiting_end_time): if "loiter" in point and self.status != STATUS_LOITERING: From 0d58f5c4d8694a1bf566c8d107cfbca321d2d851 Mon Sep 17 00:00:00 2001 From: MerlionRock Date: Sat, 6 May 2017 12:57:43 +0800 Subject: [PATCH 2/3] Path option update Follow Path: Added option to disable location update infomation in console --- configs/config.json.path.example | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/config.json.path.example b/configs/config.json.path.example index f02be8cf58..d1a0e10268 100644 --- a/configs/config.json.path.example +++ b/configs/config.json.path.example @@ -253,6 +253,7 @@ "path_start_mode": "first", "path_file": "configs/path.example.json", "number_lap": 10, + "disable_location_output": false, "timer_restart_min": "00:10:00", "timer_restart_max": "00:20:00" } From 823ae8cdd94e6899fe5d00980c121a64658c28a9 Mon Sep 17 00:00:00 2001 From: MerlionRock Date: Sat, 6 May 2017 12:58:29 +0800 Subject: [PATCH 3/3] Follow Path option update Follow Path: Added option to disable location update infomation in console --- docs/configuration_files.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/configuration_files.md b/docs/configuration_files.md index 2bdc2cfffd..996480b7ed 100644 --- a/docs/configuration_files.md +++ b/docs/configuration_files.md @@ -936,6 +936,7 @@ option. - `first` - The bot will start at the first point of the path. - `closest` - The bot will start the path at the point which is the closest to the current bot location. * `path_file` - "/path/to/your/path.json" +* `disable_location_output` - true,false. Set to true if you do not want to see follow path updating information. Default false. ### Notice If you use the `single` `path_mode` without e.g. a `MoveToFort` task, your bot