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

Fixed logging when using IV > CP. #336

Merged
merged 3 commits into from
Jul 24, 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
9 changes: 9 additions & 0 deletions PokemonGo.RocketAPI.Logic/Inventory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,15 @@ public async Task<PokemonData> GetHighestPokemonOfTypeByCP(PokemonData pokemon)
.FirstOrDefault();
}

public async Task<PokemonData> 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<int> GetItemAmountByType(MiscEnums.Item type)
{
var pokeballs = await GetItems();
Expand Down
2 changes: 1 addition & 1 deletion PokemonGo.RocketAPI.Logic/Logic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down