Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable PolyWalker for FollowPath #4644

Merged
merged 1 commit into from
Aug 24, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions configs/config.json.path.example
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
"type": "FollowPath",
"config": {
"enabled": true,
"walker": "StepWalker",
"path_mode": "loop",
"path_start_mode": "first",
"path_file": "configs/path.example.json",
Expand Down
5 changes: 3 additions & 2 deletions pokemongo_bot/cell_workers/follow_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pokemongo_bot.base_task import BaseTask
from pokemongo_bot.cell_workers.utils import distance, i2f, format_dist
from pokemongo_bot.human_behaviour import sleep
from pokemongo_bot.walkers.step_walker import StepWalker
from pokemongo_bot.walkers.walker_factory import walker_factory
from pgoapi.utilities import f2i
from random import uniform
from utils import getSeconds
Expand All @@ -32,6 +32,7 @@ def _process_config(self):
self.number_lap_max = self.config.get("number_lap", -1) # if < 0, then the number is inf.
self.timer_restart_min = getSeconds(self.config.get("timer_restart_min", "00:20:00"))
self.timer_restart_max = getSeconds(self.config.get("timer_restart_max", "02:00:00"))
self.walker = self.config.get('walker', 'StepWalker')

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...
Expand Down Expand Up @@ -140,7 +141,7 @@ def work(self):
alt = uniform(self.bot.config.alt_min, self.bot.config.alt_max)

if self.bot.config.walk_max > 0:
step_walker = StepWalker(
step_walker = walker_factory(self.walker,
self.bot,
lat,
lng,
Expand Down