Example #1
0
        public async Task PostLoginExecute()
        {
            while (true)
            {
                try
                {
                    await _client.SetServer();

                    var profil = await _client.GetProfile();

                    await _inventory.ExportPokemonToCsv(profil.Profile);
                    await StatsLog(_client);

                    if (_clientSettings.EvolvePokemonsIfEnoughCandy)
                    {
                        await EvolveAllPokemonWithEnoughCandy();
                    }

                    if (_clientSettings.AutoIncubate)
                    {
                        await StartIncubation();
                    }

                    await TransferDuplicatePokemon(_clientSettings.keepPokemonsThatCanEvolve);
                    await RecycleItems();
                    await ExecuteFarmingPokestopsAndPokemons(_client);
                }
                catch (AccessTokenExpiredException)
                {
                    throw;
                }
                catch (Exception ex)
                {
                    Logger.Write($"Exception: {ex}", LogLevel.Error);
                }

                Logger.ColoredConsoleWrite(ConsoleColor.Green, "Starting again.. But waiting 10 Seconds..");
                await Task.Delay(10000);
            }
        }
Example #2
0
        public async Task PostLoginExecute()
        {
            Logger.Write($"Client logged in", LogLevel.Info);

            while (true)
            {
                if (!_isInitialized)
                {
                    await Inventory.GetCachedInventory(_client);

                    _playerProfile = await _client.GetProfile();

                    var playerName = BotStats.GetUsername(_client, _playerProfile);
                    _stats.UpdateConsoleTitle(_client, _inventory);
                    var currentLevelInfos = await BotStats._getcurrentLevelInfos(_inventory);

                    var stats = await _inventory.GetPlayerStats();

                    var stat = stats.FirstOrDefault();
                    if (stat != null)
                    {
                        BotStats.KmWalkedOnStart = stat.KmWalked;
                    }

                    Logger.Write("----------------------------", LogLevel.None, ConsoleColor.Yellow);
                    if (_clientSettings.AuthType == AuthType.Ptc)
                    {
                        Logger.Write($"PTC Account: {playerName}\n", LogLevel.None, ConsoleColor.Cyan);
                    }
                    Logger.Write($"Latitude: {_clientSettings.DefaultLatitude}", LogLevel.None, ConsoleColor.DarkGray);
                    Logger.Write($"Longitude: {_clientSettings.DefaultLongitude}", LogLevel.None, ConsoleColor.DarkGray);
                    Logger.Write("----------------------------", LogLevel.None, ConsoleColor.Yellow);
                    Logger.Write("Your Account:\n");
                    Logger.Write($"Name: {playerName}", LogLevel.None, ConsoleColor.DarkGray);
                    Logger.Write($"Team: {_playerProfile.Profile.Team}", LogLevel.None, ConsoleColor.DarkGray);
                    Logger.Write($"Level: {currentLevelInfos}", LogLevel.None, ConsoleColor.DarkGray);
                    Logger.Write($"Stardust: {_playerProfile.Profile.Currency.ToArray()[1].Amount}", LogLevel.None, ConsoleColor.DarkGray);
                    Logger.Write("----------------------------", LogLevel.None, ConsoleColor.Yellow);
                    await DisplayHighests();

                    Logger.Write("----------------------------", LogLevel.None, ConsoleColor.Yellow);

                    var pokemonsToNotTransfer = _clientSettings.PokemonsToNotTransfer;
                    var pokemonsToNotCatch    = _clientSettings.PokemonsToNotCatch;
                    var pokemonsToEvolve      = _clientSettings.PokemonsToEvolve;

                    if (_clientSettings.UseLuckyEggs)
                    {
                        await UseLuckyEgg();
                    }
                    if (_clientSettings.EvolvePokemon || _clientSettings.EvolveOnlyPokemonAboveIV)
                    {
                        await EvolvePokemon();
                    }
                    if (_clientSettings.TransferPokemon)
                    {
                        await TransferPokemon();
                    }
                    await _inventory.ExportPokemonToCsv(_playerProfile.Profile);
                    await RecycleItems();
                }
                _isInitialized = true;
                await ExecuteFarmingPokestopsAndPokemons(_clientSettings.UseGPXPathing);

                await RefreshTokens();

                /*
                 * Example calls below
                 *
                 * var profile = await _client.GetProfile();
                 * var settings = await _client.GetSettings();
                 * var mapObjects = await _client.GetMapObjects();
                 * var inventory = await _client.GetInventory();
                 * var pokemons = inventory.InventoryDelta.InventoryItems.Select(i => i.InventoryItemData?.Pokemon).Where(p => p != null && p?.PokemonId > 0);
                 */

                await Task.Delay(10000);
            }
        }