Skip to content

Commit

Permalink
Update pokemon optimizer doc (#5130)
Browse files Browse the repository at this point in the history
  • Loading branch information
anakin5 authored and solderzzc committed Sep 3, 2016
1 parent 425eaff commit 471c2a3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion configs/config.json.optimizer.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"type": "PokemonOptimizer",
"config": {
"enabled": true,
"min_slots_left": 5,
"transfer": true,
"transfer_wait_min": 3,
"transfer_wait_max": 5,
Expand All @@ -15,7 +16,6 @@
"may_use_lucky_egg": true,
"upgrade": true,
"upgrade_level": 60,
"min_slots_left": 5,
"groups": {
"gym": ["Dragonite", "Snorlax", "Lapras", "Arcanine"]
},
Expand Down
16 changes: 15 additions & 1 deletion docs/pokemon_optimizer.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- [Default configuration](#default-configuration)
- [Understand parameters](#understand-parameters)
- [enabled](#enabled)
- [min_slots_left](#min_slots_left)
- [transfer](#transfer)
- [transfer_wait_min](#transfer_wait_min)
- [transfer_wait_max](#transfer_wait_max)
Expand All @@ -26,10 +27,13 @@
- [Eevee case](#eevee-case)

# About
The Pokemon Optimizer manage transfer and evolution of your Pokemon.
The Pokemon Optimizer manage transfer, evolution and upgrade of your Pokemon.
<br>It can replace or complement the classical Evolve and Transfer tasks.
<br>It will be triggered when you bag of Pokemon is full and has no effect until it happens.

The Pokemon Optimizer will first Transfer, then Evolve, then Upgrade.
There is only one pass at each action.

[[back to top](#pokemon-optimizer)]

# Configuration
Expand All @@ -41,6 +45,7 @@ The Pokemon Optimizer manage transfer and evolution of your Pokemon.
"type": "PokemonOptimizer",
"config": {
"enabled": true,
"min_slots_left": 5,
"transfer": true,
"transfer_wait_min": 3,
"transfer_wait_max": 5,
Expand Down Expand Up @@ -104,6 +109,15 @@ Enable or disable the task.

[[back to top](#pokemon-optimizer)]

### min_slots_left
| Parameter | Possible values | Default |
|------------------|-----------------|---------|
| `min_slots_left` | `[0-N]` | `5` |

The Pokemon Optimizer will be triggered when you have that number (or less) empty slots in your Pokemon Bag.

[[back to top](#pokemon-optimizer)]

### transfer
| Parameter | Possible values | Default |
|------------|-----------------|---------|
Expand Down
5 changes: 3 additions & 2 deletions pokemongo_bot/cell_workers/pokemon_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def initialize(self):
with open(pokemon_upgrade_cost_file, "r") as fd:
self.pokemon_upgrade_cost = json.load(fd)

self.config_min_slots_left = self.config.get("min_slots_left", 5)
self.config_transfer = self.config.get("transfer", False)
self.config_transfer_wait_min = self.config.get("transfer_wait_min", 3)
self.config_transfer_wait_max = self.config.get("transfer_wait_max", 5)
Expand Down Expand Up @@ -68,7 +69,7 @@ def get_pokemon_slot_left(self):
return inventory.Pokemons.get_space_left()

def work(self):
if (not self.enabled) or self.get_pokemon_slot_left() > self.config.get("min_slots_left", 5):
if (not self.enabled) or (self.get_pokemon_slot_left() > self.config_min_slots_left):
return WorkerResult.SUCCESS

self.open_inventory()
Expand Down Expand Up @@ -437,7 +438,7 @@ def apply_optimization(self, transfer, evolve, upgrade, xp):
skip_evolve = True
self.emit_event("skip_evolve",
formatted="Skipping evolution step. Not enough Pokemon to evolve with lucky egg: %s/%s" % (len(evolve) + len(xp), self.config_evolve_count_for_lucky_egg))
elif self.get_pokemon_slot_left() > self.config.get("min_slots_left", 5):
elif self.get_pokemon_slot_left() > self.config_min_slots_left:
skip_evolve = True
self.emit_event("skip_evolve",
formatted="Waiting for more Pokemon to evolve with lucky egg: %s/%s" % (len(evolve) + len(xp), self.config_evolve_count_for_lucky_egg))
Expand Down

0 comments on commit 471c2a3

Please sign in to comment.