diff --git a/PokemonGo.RocketAPI.Logic/Inventory.cs b/PokemonGo.RocketAPI.Logic/Inventory.cs index 9b9b60d69..3be01ffe5 100644 --- a/PokemonGo.RocketAPI.Logic/Inventory.cs +++ b/PokemonGo.RocketAPI.Logic/Inventory.cs @@ -123,6 +123,15 @@ public async Task GetHighestPokemonOfTypeByCP(PokemonData pokemon) .FirstOrDefault(); } + public async Task GetHighestPokemonOfTypeByIV(PokemonData pokemon) + { + var myPokemon = await GetPokemons(); + var pokemons = myPokemon.ToList(); + return pokemons.Where(x => x.PokemonId == pokemon.PokemonId) + .OrderByDescending(x => PokemonInfo.CalculatePokemonPerfection(x)) + .FirstOrDefault(); + } + public async Task GetItemAmountByType(MiscEnums.Item type) { var pokeballs = await GetItems(); diff --git a/PokemonGo.RocketAPI.Logic/Logic.cs b/PokemonGo.RocketAPI.Logic/Logic.cs index 6a5612942..825ad384a 100644 --- a/PokemonGo.RocketAPI.Logic/Logic.cs +++ b/PokemonGo.RocketAPI.Logic/Logic.cs @@ -525,7 +525,7 @@ private async Task TransferDuplicatePokemon(bool keepPokemonsThatCanEvolve = fal var transfer = await _client.TransferPokemon(duplicatePokemon.Id); _stats.IncreasePokemonsTransfered(); _stats.UpdateConsoleTitle(_inventory); - var bestPokemonOfType = await _inventory.GetHighestPokemonOfTypeByCP(duplicatePokemon); + var bestPokemonOfType = _client.Settings.PrioritizeIVOverCP ? await _inventory.GetHighestPokemonOfTypeByIV(duplicatePokemon) : await _inventory.GetHighestPokemonOfTypeByCP(duplicatePokemon); Logger.Write($"{duplicatePokemon.PokemonId} with {duplicatePokemon.Cp} ({PokemonInfo.CalculatePokemonPerfection(duplicatePokemon).ToString("0.00")} % perfect) CP (Best: {bestPokemonOfType.Cp} | ({PokemonInfo.CalculatePokemonPerfection(bestPokemonOfType).ToString("0.00")} % perfect))", LogLevel.Transfer); await Task.Delay(500); }