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

add a flag to enable user to choose if he wants to walk to spin forts #1772

Merged
merged 2 commits into from
Jul 30, 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.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"catch_pokemon": true,
"forts": {
"spin": true,
"move_to_spin": true,
"avoid_circles": true,
"max_circle_size": 50
},
Expand Down
1 change: 1 addition & 0 deletions configs/config.json.pokemon.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"catch_pokemon": true,
"forts": {
"spin": true,
"move_to_spin": true,
"avoid_circles": true,
"max_circle_size": 50
},
Expand Down
9 changes: 9 additions & 0 deletions pokecli.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,15 @@ def init_config():
type=int,
default=10,
)
add_config(
parser,
load,
short_flag="-mts",
long_flag="--forts.move_to_spin",
help="Moves to forts nearby ",
type=bool,
default=True
)
add_config(
parser,
load,
Expand Down
4 changes: 3 additions & 1 deletion pokemongo_bot/cell_workers/move_to_fort_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ def __init__(self, bot):
self.bot = bot

def should_run(self):
return self.bot.config.forts_spin and self.bot.has_space_for_loot()
return (self.bot.config.forts_spin and \
self.bot.config.forts_move_to_spin and \
self.bot.has_space_for_loot()) or self.bot.softban

def work(self):
if not self.should_run():
Expand Down
2 changes: 1 addition & 1 deletion pokemongo_bot/cell_workers/soft_ban_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def work(self):
if (i + 1) % 10 == 0:
logger.log('Spin #{}'.format(str(i+1)))
self.spin_fort(forts[0])
self.softban = False
self.bot.softban = False
logger.log('Softban should be fixed.')

def spin_fort(self, fort):
Expand Down