Skip to content

Commit

Permalink
Moving use_lucky_egg to be a task configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
elicwhite committed Jul 31, 2016
1 parent a1af7a6 commit 81129d3
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 17 deletions.
4 changes: 2 additions & 2 deletions configs/config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
{
"type": "EvolveAll",
"config": {
"evolve_speed": 20
"evolve_speed": 20,
"use_lucky_egg": true
}
},
{
Expand Down Expand Up @@ -70,7 +71,6 @@
},
"evolve_all": "NONE",
"evolve_cp_min": 300,
"use_lucky_egg": false,
"evolve_captured": "NONE",
"catch_randomize_reticle_factor": 1.0,
"catch_randomize_spin_factor": 1.0,
Expand Down
4 changes: 2 additions & 2 deletions configs/config.json.path.example
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
{
"type": "EvolveAll",
"config": {
"evolve_speed": 20
"evolve_speed": 20,
"use_lucky_egg": true
}
},
{
Expand Down Expand Up @@ -75,7 +76,6 @@
},
"evolve_all": "NONE",
"evolve_cp_min": 300,
"use_lucky_egg": false,
"evolve_captured": "NONE",
"catch_randomize_reticle_factor": 1.0,
"catch_randomize_spin_factor": 1.0,
Expand Down
4 changes: 2 additions & 2 deletions configs/config.json.pokemon.example
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
{
"type": "EvolveAll",
"config": {
"evolve_speed": 20
"evolve_speed": 20,
"use_lucky_egg": true
}
},
{
Expand Down Expand Up @@ -72,7 +73,6 @@
},
"evolve_all": "NONE",
"evolve_cp_min": 300,
"use_lucky_egg": false,
"evolve_captured": "NONE",
"catch_randomize_reticle_factor": 1.0,
"catch_randomize_spin_factor": 1.0,
Expand Down
11 changes: 1 addition & 10 deletions pokecli.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,15 +315,6 @@ def init_config():
type=str,
default=[]
)
add_config(
parser,
load,
short_flag="-le",
long_flag="--use_lucky_egg",
help="Uses lucky egg when using evolve_all",
type=bool,
default=False
)
add_config(
parser,
load,
Expand Down Expand Up @@ -408,7 +399,7 @@ def task_configuration_error(flag_name):
""".format(flag_name))

old_flags = ['mode', 'catch_pokemon', 'spin_forts', 'forts_spin', 'hatch_eggs', 'release_pokemon', 'softban_fix',
'longer_eggs_first', 'evolve_speed']
'longer_eggs_first', 'evolve_speed', 'use_lucky_egg']
for flag in old_flags:
if flag in load:
task_configuration_error(flag)
Expand Down
3 changes: 2 additions & 1 deletion pokemongo_bot/cell_workers/evolve_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
class EvolveAll(BaseTask):
def initialize(self):
self.evolve_speed = self.config.get('evolve_speed', 3.7)
self.use_lucky_egg = self.config.get('use_lucky_egg', False)

def work(self):
if not self._should_run():
Expand Down Expand Up @@ -53,7 +54,7 @@ def _should_run(self):
return False

# Evolve all is used - Don't run after the first tick or if the config flag is false
if self.bot.tick_count is not 1 or not self.bot.config.use_lucky_egg:
if self.bot.tick_count is not 1 or not self.use_lucky_egg:
return True

lucky_egg_count = self.bot.item_inventory_count(Item.ITEM_LUCKY_EGG.value)
Expand Down

0 comments on commit 81129d3

Please sign in to comment.