예제 #1
0
        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);
            }
        }
예제 #2
0
        private async Task TransferDuplicatePokemon(bool keepPokemonsThatCanEvolve = false)
        {
            var duplicatePokemons = await _inventory.GetDuplicatePokemonToTransfer(keepPokemonsThatCanEvolve, _clientSettings.PokemonsNotToTransfer);

            // Currently not returns the correct value
            //if (duplicatePokemons != null && duplicatePokemons.Any())
            //    Logger.Normal(ConsoleColor.DarkYellow, $"(TRANSFER) {duplicatePokemons.Count()} Pokemon:");

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

                var bestPokemonOfType = await _inventory.GetHighestCPofType(duplicatePokemon);

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

                _stats.increasePokemonsTransfered();
                _stats.updateConsoleTitle(_inventory);

                Logger.Normal(ConsoleColor.DarkYellow, $"(TRANSFER) {duplicatePokemon.PokemonId} with {duplicatePokemon.Cp} CP (Best: {bestPokemonOfType})");
                await Task.Delay(500);
            }
        }
예제 #3
0
        private async Task TransferDuplicatePokemon(bool keepPokemonsThatCanEvolve = false)
        {
            if (_clientSettings.TransferDoublePokemons)
            {
                var duplicatePokemons = await _inventory.GetDuplicatePokemonToTransfer(keepPokemonsThatCanEvolve);

                foreach (var duplicatePokemon in duplicatePokemons)
                {
                    if (!_clientSettings.pokemonsToHold.Contains(duplicatePokemon.PokemonId))
                    {
                        if (duplicatePokemon.Cp > _clientSettings.DontTransferWithCPOver)
                        {
                            continue;
                        }

                        var bestPokemonOfType = await _inventory.GetHighestCPofType(duplicatePokemon);

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

                        Logger.ColoredConsoleWrite(ConsoleColor.Yellow, $"Transfer {StringUtils.getPokemonNameByLanguage(_clientSettings, duplicatePokemon.PokemonId)} CP {duplicatePokemon.Cp} IV {Math.Round(duplicatePokemon.CalculateIV())}% (Best: {bestPokemonOfType} CP)", LogLevel.Info);
                        await RandomHelper.RandomDelay(500, 700);
                    }
                }
            }
        }
예제 #4
0
        private async Task TransferDuplicatePokemon(bool keepPokemonsThatCanEvolve = false)
        {
            var duplicatePokemons =
                await
                _inventory.GetDuplicatePokemonToTransfer(keepPokemonsThatCanEvolve,
                                                         _clientSettings.PrioritizeIVOverCP, _clientSettings.PokemonsNotToTransfer);

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

                _inventory.DeletePokemonFromInvById(duplicatePokemon.Id);
                _stats.IncreasePokemonsTransfered();
                _stats.UpdateConsoleTitle(_inventory);
                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);
            }
        }
예제 #5
0
        private async Task TransferDuplicatePokemon(bool keepPokemonsThatCanEvolve = false)
        {
            if (_clientSettings.TransferDoublePokemons)
            {
                var duplicatePokemons = await _inventory.GetDuplicatePokemonToTransfer();

                foreach (var duplicatePokemon in duplicatePokemons)
                {
                    if (!_clientSettings.pokemonsToHold.Contains(duplicatePokemon.PokemonId))
                    {
                        var transfer = await _client.TransferPokemon(duplicatePokemon.Id);

                        Logger.ColoredConsoleWrite(ConsoleColor.Yellow, $"Transfer {duplicatePokemon.PokemonId} with {duplicatePokemon.Cp} CP", LogLevel.Info);
                        await Task.Delay(500);
                    }
                }
            }
        }
예제 #6
0
        private async Task TransferDuplicatePokemon(bool keepPokemonsThatCanEvolve = false)
        {
            if (_clientSettings.TransferDoublePokemons)
            {
                var duplicatePokemons = await _inventory.GetDuplicatePokemonToTransfer(keepPokemonsThatCanEvolve);

                foreach (var duplicatePokemon in duplicatePokemons)
                {
                    if (!_clientSettings.pokemonsToHold.Contains(duplicatePokemon.PokemonId))
                    {
                        if (duplicatePokemon.Cp > _clientSettings.DontTransferWithCPOver)
                        {
                            continue;
                        }

                        var bestPokemonOfType = await _inventory.GetHighestCPofType(duplicatePokemon);

                        var bestPokemonsCPOfType = await _inventory.GetHighestCPofType2(duplicatePokemon);

                        var bestPokemonsIVOfType = await _inventory.GetHighestIVofType(duplicatePokemon);

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

                        Logger.ColoredConsoleWrite(ConsoleColor.Yellow, $"Transfer {StringUtils.getPokemonNameByLanguage(_clientSettings, duplicatePokemon.PokemonId)} CP {duplicatePokemon.Cp} IV {Math.Round(duplicatePokemon.CalculateIV())}% (Best: {bestPokemonsCPOfType.First().Cp} CP, IV {Math.Round(bestPokemonsIVOfType.First().CalculateIV())}%)", LogLevel.Info);
                        //Logger.ColoredConsoleWrite(ConsoleColor.Yellow, $"Transfer {StringUtils.getPokemonNameByLanguage(_clientSettings, duplicatePokemon.PokemonId)} CP {duplicatePokemon.Cp} IV {Math.Round(duplicatePokemon.CalculateIV())}% (Best: {bestPokemonOfType} CP)", LogLevel.Info);

                        try
                        {
                            TelegramUtil.getInstance().sendInformationText(TelegramUtil.TelegramUtilInformationTopics.Transfer, StringUtils.getPokemonNameByLanguage(_clientSettings, duplicatePokemon.PokemonId), duplicatePokemon.Cp, Math.Round(duplicatePokemon.CalculateIV()), bestPokemonOfType);
                        }
                        catch (Exception)
                        {
                            // ignored
                        }

                        await RandomHelper.RandomDelay(500, 700);
                    }
                }
            }
        }
예제 #7
0
파일: Logic.cs 프로젝트: Jeampan/Pokebot
        private async Task TransferDuplicatePokemon(bool keepPokemonsThatCanEvolve = false)
        {
            IEnumerable <PokemonData> duplicatePokemons;

            await Task.Delay(200);

            if (!_clientSettings.TransferDuplicatePokemon && !_clientSettings.OnlyTransferDuplicateShit)
            {
                Logger.Write("Not Transferring Duplicates", LogLevel.Info);
                return;
            }
            else if (_clientSettings.OnlyTransferDuplicateShit)
            {
                duplicatePokemons =
                    await
                    _inventory.GetDuplicatePokemonToTransfer(keepPokemonsThatCanEvolve,
                                                             _clientSettings.PrioritizeIVOverCP, _clientSettings.ShitPokemonsToTransfer, true);
            }
            else
            {
                duplicatePokemons =
                    await
                    _inventory.GetDuplicatePokemonToTransfer(keepPokemonsThatCanEvolve,
                                                             _clientSettings.PrioritizeIVOverCP, _clientSettings.PokemonsNotToTransfer);
            }

            foreach (var duplicatePokemon in duplicatePokemons)
            {
                if (duplicatePokemon.Cp >= _clientSettings.KeepMinCP ||
                    PokemonInfo.CalculatePokemonPerfection(duplicatePokemon) > _clientSettings.KeepMinIVPercentage)
                {
                    continue;
                }
                await _client.Inventory.TransferPokemon(duplicatePokemon.Id);

                _inventory.DeletePokemonFromInvById(duplicatePokemon.Id);
                _stats.IncreasePokemonsTransfered();
                _stats.UpdateConsoleTitle(_inventory);
                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);

                if (_caughtInSession.Count > 0)
                {
                    var i     = 0;
                    var found = false;
                    foreach (var pokemon in _caughtInSession)
                    {
                        if (pokemon.WeightKg == duplicatePokemon.WeightKg && pokemon.Cp == duplicatePokemon.Cp)
                        {
                            found = true;
                            break;
                        }
                        i++;
                    }
                    if (found)
                    {
                        _caughtInSession.RemoveAt(i);
                        Statistics.KeptPokemon--;
                    }
                }

                await Task.Delay(500);
            }
        }