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 iv setting to rename pokemon #4487

Merged
merged 3 commits into from
Aug 21, 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.cluster.example
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"type": "NicknamePokemon",
"config": {
"enabled": false,
"nickname_above_iv": 0.9,
"nickname_template": "{iv_pct}_{iv_ads}"
}
},
Expand Down
1 change: 1 addition & 0 deletions configs/config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"type": "NicknamePokemon",
"config": {
"enabled": false,
"nickname_above_iv": 0.9,
"nickname_template": "{iv_pct}_{iv_ads}"
}
},
Expand Down
1 change: 1 addition & 0 deletions configs/config.json.map.example
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"type": "NicknamePokemon",
"config": {
"enabled": false,
"nickname_above_iv": 0.9,
"nickname_template": "{iv_pct}_{iv_ads}"
}
},
Expand Down
1 change: 1 addition & 0 deletions configs/config.json.path.example
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"type": "NicknamePokemon",
"config": {
"enabled": false,
"nickname_above_iv": 0.9,
"nickname_template": "{iv_pct}_{iv_ads}"
}
},
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 @@ -69,6 +69,7 @@
"type": "NicknamePokemon",
"config": {
"enabled": false,
"nickname_above_iv": 0.9,
"nickname_template": "{iv_pct}_{iv_ads}"
}
},
Expand Down
1 change: 1 addition & 0 deletions docs/configuration_files.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ The behaviors of the bot are configured via the `tasks` key in the `config.json`
* [MoveToMapPokemon](#sniping-movetolocation)
* NicknamePokemon
* `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
Expand Down
5 changes: 4 additions & 1 deletion pokemongo_bot/cell_workers/nickname_pokemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ def initialize(self):
'good_attack_threshold', DEFAULT_GOOD_ATTACK_THRESHOLD)
self.template = self.config.get(
'nickname_template', DEFAULT_TEMPLATE)
self.nickname_above_iv = self.config.get(
'nickname_above_iv', 0)

self.translate = None
locale = self.config.get('locale', 'en')
Expand All @@ -207,7 +209,8 @@ def work(self):
"""
for pokemon in pokemons().all(): # type: Pokemon
if not pokemon.is_favorite or not self.ignore_favorites:
self._nickname_pokemon(pokemon)
if pokemon.iv >= self.nickname_above_iv:
self._nickname_pokemon(pokemon)

def _localize(self, string):
if self.translate and string in self.translate:
Expand Down