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

Improvements to evolve + config md updates #4900

Merged
merged 26 commits into from
Aug 29, 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
15 changes: 12 additions & 3 deletions configs/config.json.cluster.example
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,18 @@
"type": "EvolvePokemon",
"config": {
"enabled": false,
"//evolve all except Zubat and Rattata": "",
"//evolve_all": "-Zubat,-Rattata",
"evolve_all": "none",

"// evolve only pidgey and drowzee": "",
"// evolve_list": "pidgey, drowzee",
"// donot_evolve_list": "none",

"// evolve all but pidgey and drowzee": "",
"// evolve_list": "all",
"// donot_evolve_list": "pidgey, drowzee",

"evolve_list": "all",
"donot_evolve_list": "none",

"first_evolve_by": "cp",
"evolve_above_cp": 500,
"evolve_above_iv": 0.8,
Expand Down
15 changes: 12 additions & 3 deletions configs/config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,18 @@
"type": "EvolvePokemon",
"config": {
"enabled": false,
"//evolve all except Zubat and Rattata": "",
"//evolve_all": "-Zubat,-Rattata",
"evolve_all": "none",

"// evolve only pidgey and drowzee": "",
"// evolve_list": "pidgey, drowzee",
"// donot_evolve_list": "none",

"// evolve all but pidgey and drowzee": "",
"// evolve_list": "all",
"// donot_evolve_list": "pidgey, drowzee",

"evolve_list": "all",
"donot_evolve_list": "none",

"first_evolve_by": "cp",
"evolve_above_cp": 500,
"evolve_above_iv": 0.8,
Expand Down
15 changes: 12 additions & 3 deletions configs/config.json.map.example
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,18 @@
"type": "EvolvePokemon",
"config": {
"enabled": false,
"//evolve all except Zubat and Rattata": "",
"//evolve_all": "-Zubat,-Rattata",
"evolve_all": "none",

"// evolve only pidgey and drowzee": "",
"// evolve_list": "pidgey, drowzee",
"// donot_evolve_list": "none",

"// evolve all but pidgey and drowzee": "",
"// evolve_list": "all",
"// donot_evolve_list": "pidgey, drowzee",

"evolve_list": "all",
"donot_evolve_list": "none",

"first_evolve_by": "cp",
"evolve_above_cp": 500,
"evolve_above_iv": 0.8,
Expand Down
15 changes: 12 additions & 3 deletions configs/config.json.path.example
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,18 @@
"type": "EvolvePokemon",
"config": {
"enabled": false,
"//evolve all except Zubat and Rattata": "",
"//evolve_all": "-Zubat,-Rattata",
"evolve_all": "none",

"// evolve only pidgey and drowzee": "",
"// evolve_list": "pidgey, drowzee",
"// donot_evolve_list": "none",

"// evolve all but pidgey and drowzee": "",
"// evolve_list": "all",
"// donot_evolve_list": "pidgey, drowzee",

"evolve_list": "all",
"donot_evolve_list": "none",

"first_evolve_by": "cp",
"evolve_above_cp": 500,
"evolve_above_iv": 0.8,
Expand Down
15 changes: 12 additions & 3 deletions configs/config.json.pokemon.example
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,18 @@
"type": "EvolvePokemon",
"config": {
"enabled": false,
"//evolve all except Zubat and Rattata": "",
"//evolve_all": "-Zubat,-Rattata",
"evolve_all": "none",

"// evolve only pidgey and drowzee": "",
"// evolve_list": "pidgey, drowzee",
"// donot_evolve_list": "none",

"// evolve all but pidgey and drowzee": "",
"// evolve_list": "all",
"// donot_evolve_list": "pidgey, drowzee",

"evolve_list": "all",
"donot_evolve_list": "none",

"first_evolve_by": "cp",
"evolve_above_cp": 500,
"evolve_above_iv": 0.8,
Expand Down
75 changes: 68 additions & 7 deletions docs/configuration_files.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ Document the configuration options of PokemonGo-Bot.
## Usage
[[back to top](#table-of-contents)]

1. copy `config.json.example` to `config.json`.
2. Edit `config.json` and replace `auth_service`, `username`, `password`, `location` and `gmapkey` with your parameters (other keys are optional, check `Advance Configuration` below)
3. Simply launch the script with : `./run.sh` or `./pokecli.py` or `python pokecli.py -cf ./configs/config.json` if you want to specify a config file
1. copy `auth.json.example` to `auth.json`.
2. Edit `auth.json` and replace `auth_service`, `username`, `password`, `location` and `gmapkey` with your parameters (other keys are optional)
3. copy `config.json.example` to `config.json`.=
3. Simply launch the script with : `./run.sh` or './run.sh ./configs/your_auth_file.json ./configs/your_base_config_file.json'


## Advanced Configuration
Expand Down Expand Up @@ -105,27 +106,83 @@ The behaviors of the bot are configured via the `tasks` key in the `config.json`
### Task Options:
[[back to top](#table-of-contents)]
* CatchPokemon
* `treat_unseen_as_vip`: Default `"true"` | Set to `"false"` to disable treating pokemons you don't have in your pokedex as VIPs.
* `enabled`: Default "true" | Enable/Disable the task.
* `treat_unseen_as_vip`: Default `"true"` | If true, treat new to dex as VIP
* `catch_visible_pokemon`: Default "true" | If enabled, attempts to catch "visible" pokemon that are reachable
* `catch_lured_pokemon`: Default "true" | If enabled, attempts to catch "lured" pokemon that are reachable
* `min_ultraball_to_keep`: Default 5 | Minimum amount of reserved ultraballs to have on hand (for VIP)
* `berry_threshold`: Default 0.35 | Catch percentage we start throwing berries
* `vip_berry_threshold`: Default 0.9 | Something similar?
* `treat_unseen_as_vip`: Default "true" | If enabled, treat new to our dex as VIP
* `daily_catch_limit`: Default 800 | How many pokemon we limit ourselves to daily
* `catch_throw_parameters`: Variable catch settings
* `excellent_rate`: 0.1 | Change of excellent throw
* `great_rate`: 0.5 | Change of excellent throw
* `nice_rate`: 0.3 | Change of nice throw
* `normal_rate`: 0.1 | Change of normal throw
* `spin_success_rate` : 0.6 | Change of using a spin throw
* `hit_rate`: 0.75 | Change of overall hit chance
`catch_simulation`:
* `flee_count`: 3 | ??
* `flee_duration`: 2 | ??
* `catch_wait_min`: 3 | Minimum time to wait after a catch
* `catch_wait_max`: 6 | Maximum time to wait after a catch
* `berry_wait_min`: 3 | Minimum time to wait after throwing berry
* `berry_wait_max`: 5 | Maxiumum time to wait after throwing berry
* `changeball_wait_min`: 3 | Minimum time to wait when changing balls
* `changeball_wait_max`: 5 | Maximum time to wait when changing balls
* `newtodex_wait_min`: 20 | Minimum time to wait if we caught a new type of pokemon
* `newtodex_wait_max`: 39 | Maximum time to wait if we caught a new type of pokemon
* EvolvePokemon
* `evolve_all`: Default `NONE` | Set to `"all"` to evolve Pokémon if possible when the bot starts. Can also be set to individual Pokémon as well as multiple separated by a comma. e.g "Pidgey,Rattata,Weedle,Zubat"
* `enable`: Disable or enable this task.
* `evolve_all`: Default `NONE` | Depreciated. Please use evolve_list and donot_evolve_list
* `evolve_list`: Default `all` | Set to all, or specifiy different pokemon seperated by a comma
* `donot_evolve_list`: Default `none` | Pokemon seperated by comma, will be ignored from evolve_list
* `min_evolve_speed`: Default `25` | Minimum seconds to wait between each evolution
* `max_evolve_speed`: Default `30` | Maximum seconds to wait between each evolution
* `use_lucky_egg`: Default: `False`
* `use_lucky_egg`: Default: `False` | Only evolve if we can use a lucky egg
* FollowPath
* `enable`: Disable or enable this task.
* `path_mode`: Default `loop` | Set the mode for the path navigator (loop, linear or single).
* `path_file`: Default `NONE` | Set the file containing the waypoints for the path navigator.
* FollowSpiral
* `enable`: Disable or enable this task.
* `spin_wait_min`: Default 3 | Minimum wait time after fort spin
* `spin_wait_max`: Default 5 | Maximum wait time after fort spin
* HandleSoftBan
* IncubateEggs
* `longer_eggs_first`: Default `True`
* `enable`: Disable or enable this task.
* `longer_eggs_first`: Depreciated
* `infinite_longer_eggs_first`: Default `true` | Prioritize longer eggs in perminent incubators.
* `breakable_longer_eggs_first`: Default `false` | Prioritize longer eggs in breakable incubators.
* `min_interval`: Default `120` | Minimum number of seconds between incubation updates.
* `infinite`: Default `[2,5,10]` | Types of eggs to be incubated in permanent incubators.
* `breakable`: Default `[2,5,10]` | Types of eggs to be incubated in breakable incubators.
* MoveToFort
* `enable`: Disable or enable this task.
* `lure_attraction`: Default `true` | Be more attracted to lured forts than non
* `lure_max_distance`: Default `2000` | Maxmimum distance lured forts influence this task
* `walker`: Default `StepWalker` | Which walker moves us
* `log_interval`: Default `5` | Log output interval
* [MoveToMapPokemon](#sniping-movetolocation)
* NicknamePokemon
* `enable`: Disable or enable this task.
* `nickname_template`: Default `""` | See the [Pokemon Nicknaming](#pokemon-nicknaming) section for more details
* `nickname_above_iv`: Default `0` | Rename pokemon which iv is highter than the value
* `dont_nickname_favorite`: Default `false` | Prevents renaming of favorited pokemons
* `good_attack_threshold`: Default `0.7` | Threshold for perfection of the attack in it's type *(0.0-1.0)* after which attack will be treated as good.<br>Used for `{fast_attack_char}`, `{charged_attack_char}`, `{attack_code}` templates
* RecycleItems
* `enabled`: Default `true` | Disable or enable this task
* `min_empty_space`: Default 15 | minimum spaces before forcing transfer
* `max_balls_keep`: Default 150 | Maximum cumlative balls to keep
* `max_potions_keep`: Default 50 | Maximum cumlative potions to keep
* `max_berries_keep`: Default 70 | Maximum culative berries to keep
* `max_revives_keep`: Default 70 | Maxiumum culative revies to keep
* `recycle_wait_min`: 3 | Minimum wait time after recycling an item
* `recycle_wait_max`: 5 | Maxiumum culative revies to keep
* `recycle_force`: Default true | Enable/Disable time forced item recycling
* `recycle_force_min`: Default `00:01:00` | Minimum time to wait before forcing recycling
* `recycle_force_max`: default `00:05:00` | Maximum time to wait before forcing recycling

> **NOTE:** It's highly recommended to put this task before MoveToFort and SpinFort tasks. This way you'll most likely be able to loot.
* `min_empty_space`: Default `6` | Minimum empty space to keep in inventory. Once the inventory has less empty space than that amount, the recycling process is triggered. Set it to the inventory size to trigger it at every tick.
Expand All @@ -139,7 +196,11 @@ The behaviors of the bot are configured via the `tasks` key in the `config.json`
* `recycle_force_max`: Default `00:10:00` | Maximum time to wait before scheduling next forced recycle

* SpinFort
* `enabled`: Default true | Enable for disable this task
* `spin_wait_min`: Defaut 3 | Minimum wait after spinning a fort
* `spin_wait_max`: Default 5 | Maximum wait after spinning a fort
* TransferPokemon
* `enable`: Disable or enable this task.
* `min_free_slot`: Default `5` | Once the pokebag has less empty slots than this amount, the transfer process is triggered. | Big values (i.e 9999) will trigger the transfer process after each catch.
* UpdateLiveStats
* [UpdateLiveInventory](#updateliveinventory-settings)
Expand Down
33 changes: 16 additions & 17 deletions pokemongo_bot/cell_workers/evolve_pokemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ def __init__(self, bot, config):

def initialize(self):
self.api = self.bot.api
self.evolve_all = self.config.get('evolve_all', [])
self.evolve_list = self.config.get('evolve_list', [])
self.donot_evolve_list = self.config.get('donot_evolve_list', [])
self.min_evolve_speed = self.config.get('min_evolve_speed', 25)
self.max_evolve_speed = self.config.get('max_evolve_speed', 30)
self.first_evolve_by = self.config.get('first_evolve_by', 'cp')
Expand All @@ -26,36 +27,34 @@ def initialize(self):
self._validate_config()

def _validate_config(self):
if isinstance(self.evolve_all, basestring):
self.evolve_all = [str(pokemon_name).strip() for pokemon_name in self.evolve_all.split(',')]
if isinstance(self.evolve_list, basestring):
self.evolve_list = [str(pokemon_name).strip() for pokemon_name in self.evolve_list.split(',')]

if isinstance(self.donot_evolve_list, basestring):
self.donot_evolve_list = [str(pokemon_name).strip() for pokemon_name in self.donot_evolve_list.split(',')]

if 'evolve_speed' in self.config:
self.logger.warning("evolve_speed is deprecated, please use instead 'min_evolve_speed' and 'max_evolved_speed'.")
self.logger.warning("evolve_speed is deprecated, instead please use 'min_evolve_speed' and 'max_evolved_speed'.")

if 'evolve_all' in self.config:
self.logger.warning("evolve_all is deprecated, instead please use 'evolve_list' and 'donot_evolve_list'.")

def work(self):
if not self._should_run():
return

evolve_list = self._sort_and_filter()

if self.evolve_all[0] != 'all':
# check for negation
negate = filter(lambda x: len(x) > 0 and x[0] == '-', self.evolve_all)
filtered_list = self._sort_and_filter()

# if there are things to negate
if len(negate) > 0:
evolve_list = filter(lambda x: '-' + x.name not in negate, evolve_list)
else:
# filter out non-listed pokemons
evolve_list = filter(lambda x: x.name in self.evolve_all, evolve_list)
if (len(self.donot_evolve_list) > 0) and self.donot_evolve_list[0] != 'none':
filtered_list = filter(lambda pokemon: pokemon.name not in donot_evolve_list, filtered_list)

cache = {}
for pokemon in evolve_list:
for pokemon in filtered_list:
if pokemon.can_evolve_now():
self._execute_pokemon_evolve(pokemon, cache)

def _should_run(self):
if not self.evolve_all or self.evolve_all[0] == 'none':
if not self.evolve_list or self.evolve_list[0] == 'none':
return False

# Evolve all is used - Use Lucky egg only at the first tick
Expand Down