Esempio n. 1
0
        public async Task PostLoginExecute()
        {
            Logger.Write($"Client logged in", LogLevel.Info);

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

                    _playerProfile = await _client.Player.GetPlayer();

                    BotStats.UpdateConsoleTitle();

                    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: {BotStats.GetUsername(_playerProfile)}\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: {BotStats.GetUsername(_playerProfile)}", LogLevel.None, ConsoleColor.DarkGray);
                    Logger.Write($"Team: {_playerProfile.PlayerData.Team}", LogLevel.None, ConsoleColor.DarkGray);
                    Logger.Write($"Level: {BotStats.GetCurrentInfo()}", LogLevel.None, ConsoleColor.DarkGray);
                    Logger.Write($"Stardust: {_playerProfile.PlayerData.Currencies.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;

                    await RecycleItemsTask.Execute();

                    if (_client.Settings.UseLuckyEggs)
                    {
                        await UseLuckyEggTask.Execute();
                    }
                    if (_client.Settings.EvolvePokemon || _client.Settings.EvolvePokemonAboveIV)
                    {
                        await EvolvePokemonTask.Execute();
                    }
                    if (_client.Settings.TransferPokemon)
                    {
                        await TransferPokemonTask.Execute();
                    }
                    await ExportPokemonToCsv.Execute(_playerProfile.PlayerData);

                    if (_clientSettings.HatchEggs)
                    {
                        await HatchEggsTask.Execute();
                    }
                }
                _isInitialized = true;
                await Main();

                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);
            }
        }
Esempio n. 2
0
        public async Task PrintPlayerInfos(CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            await Inventory.GetCachedInventory();

            _playerProfile = await _client.Player.GetPlayer();

            BotStats.UpdateConsoleTitle();

            var playerStats = (await Inventory.GetPlayerStats()).FirstOrDefault();

            if (playerStats != null)
            {
                BotStats.KmWalkedOnStart = playerStats.KmWalked;
            }

            Logger.Write("----------------------------", LogLevel.None, ConsoleColor.Yellow);
            if (_clientSettings.AuthType == AuthType.Ptc)
            {
                Logger.Write($"PTC Account: {BotStats.GetUsername(_playerProfile)}\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: {BotStats.GetUsername(_playerProfile)}", LogLevel.None,
                         ConsoleColor.DarkGray);
            Logger.Write($"Team: {_playerProfile.PlayerData.Team}", LogLevel.None, ConsoleColor.DarkGray);
            Logger.Write($"Level: {BotStats.GetCurrentInfo()}", LogLevel.None, ConsoleColor.DarkGray);
            Logger.Write($"Stardust: {_playerProfile.PlayerData.Currencies.ToArray()[1].Amount}",
                         LogLevel.None, ConsoleColor.DarkGray);
            Logger.Write("----------------------------", LogLevel.None, ConsoleColor.Yellow);
            await DisplayHighests();

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

            var pokemonToNotTransfer = _clientSettings.PokemonToNotTransfer;
            var pokemonsToNotCatch   = _clientSettings.PokemonToNotCatch;
            var pokemonsToEvolve     = _clientSettings.PokemonToEvolve;

            await RecycleItemsTask.Execute();

            if (_client.Settings.UseLuckyEggs)
            {
                await UseLuckyEggTask.Execute();
            }
            if (_client.Settings.EvolvePokemon || _client.Settings.EvolveOnlyPokemonAboveIV)
            {
                await EvolvePokemonTask.Execute();
            }
            if (_client.Settings.TransferPokemon)
            {
                await TransferPokemonTask.Execute();
            }
            if (_client.Settings.UseCSVExport)
            {
                await ExportPokemonToCsv.Execute(_playerProfile.PlayerData);
            }
            if (_clientSettings.HatchEggs)
            {
                await HatchEggsTask.Execute();
            }
        }