Never release over CP
Short Description
I would like to make a configuration like this: Keep best cp (supported) Keep best iv (supported) BUT Never release if CP is over 1500 or 2000 or whatever (not supported)
Possible solution
Add new parameter to the config file
How it would help others
If there is multiple Pokemon that are over 1500, then it wouldn't get transferred. It would be better for Pokemon that are evolved with a high multiplier and are fairly common like Vaporeon, Flareon, etc.
BUT PEOPLE CAN MAKE EXCEPTIONS FOR THOSE POKEMON IN THE CONFIG!!1!!1111
Settle down this would make the config simpler, and if you read the title this would be a FEATURE and this is not an ISSUE.
can't we do it with release_below_cp: 1500 ?
Does that have the same effect as, say, "keep_above_cp": 1500 ?
Just wondering, because to me "release_below_cp" means release anything below cp, regardless of keep_best_cp and keep_best_iv.
with 3 Pidgeys CP 10 and 1 Rattata CP 10 "release": {"any": {"release_below_cp": 11} did not trigger the release event for me.
"release": {"any": {"release_below_cp": 11, "release_below_iv": 0.9, "logic": "and"}}, DID trigger the release event. (none of the 4 pokes had iv >=0.9.
Would like to know what happens if you had, say 3 Snorlaxes above 1000, and 5 below 1000, and set "release_below_cp": 1000 AND "keep_best_cp": 2.
To achieve the desired result, you should end up with the 3 Snorlaxes above 1000 only.
Then, if you had only the 5 Snorlaxes below 1000, you should end up with the top 2 only.
Replace Snorlax and cp/iv with whatever you like.
I'd test it but I'm a bit short on Pokemon at the moment.
Note to self: Got to look at both transfer_pokemon and optimizer.
if (keep_best_mode
and not release_config.has_key('never_release')
and not release_config.has_key('always_release')
and not release_config.has_key('release_below_cp')
and not release_config.has_key('release_below_iv')):
return True
release_cp = release_config.get('release_below_cp', 0)
if pokemon.cp < release_cp:
release_results['cp'] = True
The transfer_pokemon worker first gets the keep_best_cp/keep_best_iv and uses that to filter which pokemon should be removed. Then, it runs a function to see if a pokemon should indeed be removed. It checks if never_release/always_release/release_blow_cp/release_below_iv have been set. If so, it performs additional checks.
So yes, as @rawgni suggested you can just set release_below_cp: 1500
depends on the logic still, there is a difference between "and" and "or"
"logic": "or"
If no logic has been set, the bot tries to get the logic of 'any' (default config: and). If that's not set either, it defaults to and.
That's why @crvfts config didn't release any pokemon:
with 3 Pidgeys CP 10 and 1 Rattata CP 10 "release": {"any": {"release_below_cp": 11} did not trigger the release event for me.
Because of the missing logic. The bot read that as and and because of the missing IV, that was set to 0. So his bot would only release pokemon below_cp 11 AND below_iv 0.
{"any": {"release_below_cp": 1500, "logic": "or"}
Should do the trick.
@Jasperrr91 would it work with keep_best_cp in a scenario that @Gobberwart described?
Alright, I'm new to this code, but here is what I think: if there is a keep_best_cp/iv, then this line gets called
transfer_pokemons = [
pokemon for pokemon in all_pokemons if self.should_release_pokemon(pokemon, True)]
and if any of never_release/always_release/release_below_cp/release_below_iv are present (assuming release_config.has_key returns True in these cases) then the code under it gets executed, which from what I understand (based on the next snippet, and based on the fact that there is no other return True/False below that other than never_release/always_release which is not the point) is using the release_below_cp/iv to release
if logic_to_function[cp_iv_logic](*release_results.values()):
self.emit_event(
'future_pokemon_release',
formatted="Releasing {pokemon} [CP {cp}] [IV {iv}] based on rule: CP < {below_cp} {cp_iv_logic} IV < {below_iv}",
data={
'pokemon': pokemon.name,
'cp': pokemon.cp,
'iv': pokemon.iv,
'below_cp': release_cp,
'cp_iv_logic': cp_iv_logic.upper(),
'below_iv': release_iv
}
)
but as I said, I'm new to this code so I might be completely wrong here, and please tell me if I am! :)
@newjanson yes this would work with keep_best_cp. Your assumptions are correct, if none of those are present, it returns true. Otherwise, if any of those keys are in fact present, the code underneath gets executed.
With: {"any": {"release_below_cp": 1500, "logic": "or"}
release_cp = release_config.get('release_below_cp', 0)
if pokemon.cp < release_cp:
release_results['cp'] = True
Snorlax 1800 (0.9): release_results['cp'] = False
release_iv = release_config.get('release_below_iv', 0)
if pokemon.iv < release_iv:
release_results['iv'] = True
Snorlax 1800 (0.9): release_results['iv'] = False
Thus if logic_to_function[cp_iv_logic](*release_results.values()): does not trigger.
@Jasperrr91 alright, so it does not "stack" with keep_best_iv/cp which means that {"any": {"release_below_cp": 1500, "keep_best_cp": 3} will do the same as {"any": {"release_below_cp": 1500} and therefore having a keep_above_cp/iv would be beneficial, and would function like @Gobberwart described. Correct?
{"release_below_cp": 1500, "keep_best_cp": 3} will do the same as {"any": {"release_below_cp": 1500}
@newjanson it will depend on which pokemon you have. If you have 5 snorlaxes [1500, 1863, 1923, 2042, 2323]. Both will will keep them all. If you have 5 snorlaxes [1012, 1239, 1349, 1453, 1532], the first rule will keep [1349, 1453, 1532] while the second rule will only keep [1532].
Adding keep_above is superfluous as it's the same as release_below.
@Jasperrr91 okay, so I must have misunderstood it. I thought we just approved on the keep_best_cp being ignored if it is accompanied by release_below_cp. Is that incorrect?
@newjanson Ehm I think you have misunderstood it yea.
If I'm correct, with keep_best_cp (3 for example); the bot first makes a list of the best 3 pokemon. Then for the remaining pokemons it calls the should_release_pokemon method. Which will then apply the additional rules to these pokemons (never_release, always_release, release_below_cp, release_below_iv).
So keep_best will never be ignored. It's executed first and then the remaining pokemons will have the remaining rules applied to them. Hope this clears it up a little.
alright so it seems like none of us are 100% sure. Let's wait for a few other opinions before I close this.
I can test it on my bot later today.
Just triest to test but it seems my bot is refusing to transfer any pokemon. 😆
not just keep_above_cp but keep_above_iv also. And if possible a condition for VIP pokemon as defined at the end of the config.
@Jasperrr91 with {"release_below_cp": 1500, "keep_best_cp": 3} or at all?