private async Task TransferDuplicatePokemon(bool keepPokemonsThatCanEvolve = false)
        {
            var duplicatePokemons =
                await
                _inventory.GetDuplicatePokemonToTransfer(keepPokemonsThatCanEvolve,
                                                         _clientSettings.PokemonsNotToTransfer);

            foreach (var duplicatePokemon in duplicatePokemons)
            {
                if (CalculatePokemonPerfection(duplicatePokemon) >= _clientSettings.KeepMinIVPercentage ||
                    duplicatePokemon.Cp > _clientSettings.KeepMinCP)
                {
                    continue;
                }

                var transfer = await _client.TransferPokemon(duplicatePokemon.Id);

                var bestPokemonOfType = await _inventory.GetHighestPokemonOfTypeByCP(duplicatePokemon);

                Logger.Write(
                    $"{duplicatePokemon.PokemonId} with {duplicatePokemon.Cp} ({CalculatePokemonPerfection(duplicatePokemon).ToString("0.00")} % perfect) CP (Best: {bestPokemonOfType.Cp} | ({CalculatePokemonPerfection(bestPokemonOfType).ToString("0.00")} % perfect))",
                    LogLevel.Transfer);
                await Task.Delay(500);
            }
        }
Example #2
0
        private async Task TransferPokemon()
        {
            await Inventory.getCachedInventory(_client, true);

            var duplicatePokemons = await _inventory.GetPokemonToTransfer(_clientSettings.NotTransferPokemonsThatCanEvolve, _clientSettings.PrioritizeIVOverCP, _clientSettings.PokemonsNotToTransfer);

            if (duplicatePokemons != null && duplicatePokemons.Any())
            {
                Logger.Write($"Found {duplicatePokemons.Count()} Pokemon for Transfer:", LogLevel.Info);
            }

            foreach (var duplicatePokemon in duplicatePokemons)
            {
                await _client.TransferPokemon(duplicatePokemon.Id);

                await Inventory.getCachedInventory(_client, true);

                var myPokemonSettings = await _inventory.GetPokemonSettings();

                var pokemonSettings   = myPokemonSettings.ToList();
                var myPokemonFamilies = await _inventory.GetPokemonFamilies();

                var pokemonFamilies = myPokemonFamilies.ToArray();
                var settings        = pokemonSettings.Single(x => x.PokemonId == duplicatePokemon.PokemonId);
                var familyCandy     = pokemonFamilies.Single(x => settings.FamilyId == x.FamilyId);
                var FamilyCandies   = $"{familyCandy.Candy}";

                _stats.IncreasePokemonsTransfered();
                _stats.UpdateConsoleTitle(_client, _inventory);

                var bestPokemonOfType = _client.Settings.PrioritizeIVOverCP
                    ? await _inventory.GetHighestPokemonOfTypeByIV(duplicatePokemon)
                    : await _inventory.GetHighestPokemonOfTypeByCP(duplicatePokemon);

                Logger.Write($"{duplicatePokemon.PokemonId} (CP {duplicatePokemon.Cp} | {PokemonInfo.CalculatePokemonPerfection(duplicatePokemon).ToString("0.00")} % perfect) | (Best: {bestPokemonOfType.Cp} CP | {PokemonInfo.CalculatePokemonPerfection(bestPokemonOfType).ToString("0.00")} % perfect) | Family Candies: {FamilyCandies}", LogLevel.Transfer);
                await Task.Delay(500);
            }
        }