PokemonGo-Bot icon indicating copy to clipboard operation
PokemonGo-Bot copied to clipboard

[Feature Request] Releasing all pokemon in bag except X best ones

Open LitRidl opened this issue 10 years ago • 1 comments

Short Description

Currently it is possible to release all pokemon of some type except N best ones based on some criteria: "release": { "any": {"keep_best_iv": N} } Ability to always keep N best pokemon in bag would be useful. For example, player may want to keep 150 best CP and 50 best IV pokemon always in his bag and to release everyone else.

Possible solution

Implement new "pokemon name" all which is executed after all other rules (first we discard pokemon based on specific rules, than in what remains we keep best 150 pokemon): "release": { "all": { "keep_best_custom": "iv, cp, hp_max", "amount": 150 } }

This may be a naive implementation which ignores application order:

  1. In _release_pokemon_get_groups we always return one extra fake group with pokemon_id = 10000. This group containa all pokemons from other groups (just fav/fort-filtered inventory.pokemons().all()).
  2. On line 28 in transfer_pokemon.py we replace getting pokemon name with pokemon_name = Pokemons.name_for(pokemon_id) if pokemon_id > 0 else 'all'
  3. Everything else works as expected.

If we want application order to be correct, things are more difficult (I don't know bot well enough to propose good solution). As far as I can see:

  1. Refactor lines 29-87 (contents of for loop except the first line) in transfer_pokemon.py in a separate function _release_pokemon_group(pokemon_list, pokemon_name) to launch it later below the for loop with pokemon name equals to 'all'.
  2. After the end of for loop: group = [p for p in inventory.pokemons().all() if p.in_fort is False and p.is_favourite is False].
  3. Call _release_pokemon_group(group, 'all').
  4. Done.

How it would help others

Well, first of all -- it would be quite nice feature on its own. Also it can solve problems like #4468 quite easily and it would prevent exceeding pokemon bag (which is possible with current configuration options) limits and some other nice features.

LitRidl avatar Aug 22 '16 12:08 LitRidl

Recent dev merge adds this feature. Please elaborate if it does not meet your needs.

mjmadsen avatar Aug 24 '16 02:08 mjmadsen