public async Task <IState> Execute(ISession session, CancellationToken cancellationToken) { if (session.LogicSettings.UseNearActionRandom) { await HumanRandomActionTask.Execute(session, cancellationToken); } else { if (session.LogicSettings.EvolveAllPokemonAboveIv || session.LogicSettings.EvolveAllPokemonWithEnoughCandy || session.LogicSettings.UseLuckyEggsWhileEvolving || session.LogicSettings.KeepPokemonsThatCanEvolve) { await EvolvePokemonTask.Execute(session, cancellationToken); } if (session.LogicSettings.UseEggIncubators) { await UseIncubatorsTask.Execute(session, cancellationToken); } if (session.LogicSettings.TransferDuplicatePokemon) { await TransferDuplicatePokemonTask.Execute(session, cancellationToken); } if (session.LogicSettings.UseLuckyEggConstantly) { await UseLuckyEggConstantlyTask.Execute(session, cancellationToken); } if (session.LogicSettings.UseIncenseConstantly) { await UseIncenseConstantlyTask.Execute(session, cancellationToken); } await GetPokeDexCount.Execute(session, cancellationToken); if (session.LogicSettings.RenamePokemon) { await RenamePokemonTask.Execute(session, cancellationToken); } if (session.LogicSettings.AutoFavoritePokemon) { await FavoritePokemonTask.Execute(session, cancellationToken); } await RecycleItemsTask.Execute(session, cancellationToken); if (session.LogicSettings.AutomaticallyLevelUpPokemon) { await LevelUpPokemonTask.Execute(session, cancellationToken); } } if (session.LogicSettings.UseGpxPathing) { await FarmPokestopsGpxTask.Execute(session, cancellationToken); } else { await FarmPokestopsTask.Execute(session, cancellationToken); } return(this); }
public void Run(CancellationToken cancellationToken) { if (_session.LogicSettings.UseNearActionRandom) { HumanRandomActionTask.Execute(_session, cancellationToken).Wait(cancellationToken); } else { if (_session.LogicSettings.EvolveAllPokemonAboveIv || _session.LogicSettings.EvolveAllPokemonWithEnoughCandy || _session.LogicSettings.UseLuckyEggsWhileEvolving || _session.LogicSettings.KeepPokemonsThatCanEvolve) { EvolvePokemonTask.Execute(_session, cancellationToken).Wait(cancellationToken); } if (_session.LogicSettings.AutomaticallyLevelUpPokemon) { LevelUpPokemonTask.Execute(_session, cancellationToken).Wait(cancellationToken); } if (_session.LogicSettings.UseLuckyEggConstantly) { UseLuckyEggConstantlyTask.Execute(_session, cancellationToken).Wait(cancellationToken); } if (_session.LogicSettings.UseIncenseConstantly) { UseIncenseConstantlyTask.Execute(_session, cancellationToken).Wait(cancellationToken); } if (_session.LogicSettings.TransferDuplicatePokemon) { TransferDuplicatePokemonTask.Execute(_session, cancellationToken).Wait(cancellationToken); } if (_session.LogicSettings.TransferWeakPokemon) { TransferWeakPokemonTask.Execute(_session, cancellationToken).Wait(cancellationToken); } if (_session.LogicSettings.RenamePokemon) { RenamePokemonTask.Execute(_session, cancellationToken).Wait(cancellationToken); } if (_session.LogicSettings.AutoFavoritePokemon) { FavoritePokemonTask.Execute(_session, cancellationToken).Wait(cancellationToken); } RecycleItemsTask.Execute(_session, cancellationToken).Wait(cancellationToken); GetPokeDexCount.Execute(_session, cancellationToken).Wait(cancellationToken); if (_session.LogicSettings.UseEggIncubators) { UseIncubatorsTask.Execute(_session, cancellationToken).Wait(cancellationToken); } } if (_session.LogicSettings.UseGpxPathing) { FarmPokestopsGpxTask.Execute(_session, cancellationToken).Wait(cancellationToken); } else { FarmPokestopsTask.Execute(_session, cancellationToken).Wait(cancellationToken); } }
public void Run() { if (_session.LogicSettings.EvolveAllPokemonAboveIv || _session.LogicSettings.EvolveAllPokemonWithEnoughCandy) { EvolvePokemonTask.Execute(_session).Wait(); } if (_session.LogicSettings.TransferDuplicatePokemon) { TransferDuplicatePokemonTask.Execute(_session).Wait(); } if (_session.LogicSettings.RenameAboveIv) { RenamePokemonTask.Execute(_session).Wait(); } RecycleItemsTask.Execute(_session).Wait(); if (_session.LogicSettings.UseEggIncubators) { UseIncubatorsTask.Execute(_session).Wait(); } if (_session.LogicSettings.UseGpxPathing) { FarmPokestopsGpxTask.Execute(_session).Wait(); } else { FarmPokestopsTask.Execute(_session).Wait(); } }
public async Task <IState> Execute(ISession session, CancellationToken cancellationToken) { if (session.LogicSettings.EvolveAllPokemonAboveIv || session.LogicSettings.EvolveAllPokemonWithEnoughCandy) { await EvolvePokemonTask.Execute(session, cancellationToken); } if (session.LogicSettings.TransferDuplicatePokemon) { await TransferDuplicatePokemonTask.Execute(session, cancellationToken); } if (session.LogicSettings.RenameAboveIv) { await RenamePokemonTask.Execute(session, cancellationToken); } await RecycleItemsTask.Execute(session, cancellationToken); if (session.LogicSettings.UseEggIncubators) { await UseIncubatorsTask.Execute(session, cancellationToken); } if (session.LogicSettings.UseGpxPathing) { await FarmPokestopsGpxTask.Execute(session, cancellationToken); } else { await FarmPokestopsTask.Execute(session, cancellationToken); } return(this); }
public async Task <IState> Execute(ISession session, CancellationToken cancellationToken) { if (session.LogicSettings.UseNearActionRandom) { await HumanRandomActionTask.Execute(session, cancellationToken); } else { if (session.LogicSettings.UseEggIncubators) { await UseIncubatorsTask.Execute(session, cancellationToken); } if (session.LogicSettings.TransferDuplicatePokemon) { await TransferDuplicatePokemonTask.Execute(session, cancellationToken); } if (session.LogicSettings.UseLuckyEggConstantly) { await UseLuckyEggConstantlyTask.Execute(session, cancellationToken); } if (session.LogicSettings.UseIncenseConstantly) { await UseIncenseConstantlyTask.Execute(session, cancellationToken); } GetPokeDexCount.Execute(session, cancellationToken); if (session.LogicSettings.RenamePokemon) { await RenamePokemonTask.Execute(session, cancellationToken); } await RecycleItemsTask.Execute(session, cancellationToken); if (session.LogicSettings.AutomaticallyLevelUpPokemon) { await LevelUpPokemonTask.Execute(session, cancellationToken); } } await SelectBuddyPokemonTask.Execute(session, cancellationToken); if (session.LogicSettings.UseGpxPathing) { await FarmPokestopsGpxTask.Execute(session, cancellationToken); } else { await FarmPokestopsTask.Execute(session, cancellationToken); } return(this); }
public override async Task <bool> OnCommand(ISession session, string commandText, Action <string> callback) { var cmd = commandText.Split(' '); if (cmd[0].ToLower() == Command) { await RecycleItemsTask.Execute(session, session.CancellationTokenSource.Token).ConfigureAwait(false); callback(GetMsgHead(session, session.Profile.PlayerData.Username) + "\r\n\r\n"); return(true); } return(false); }
public async Task <bool> OnCommand(ISession session, string commandText, Action <string> Callback) { var cmd = commandText.Split(' '); if (cmd[0].ToLower() == Command) { await RecycleItemsTask.Execute(session, session.CancellationTokenSource.Token); Callback("RECYCLE ITEM DONE!"); return(true); } return(false); }
public void Run(CancellationToken cancellationToken) { if (_session.LogicSettings.TransferDuplicatePokemon) { EvolvePokemonTask.Execute(_session, cancellationToken).Wait(cancellationToken); } if (_session.LogicSettings.AutomaticallyLevelUpPokemon) { LevelUpPokemonTask.Execute(_session, cancellationToken).Wait(cancellationToken); } if (_session.LogicSettings.UseLuckyEggConstantly) { UseLuckyEggConstantlyTask.Execute(_session, cancellationToken).Wait(cancellationToken); } if (_session.LogicSettings.UseIncenseConstantly) { UseIncenseConstantlyTask.Execute(_session, cancellationToken).Wait(cancellationToken); } GetPokeDexCount.Execute(_session, cancellationToken).Wait(cancellationToken); if (_session.LogicSettings.TransferDuplicatePokemon) { TransferDuplicatePokemonTask.Execute(_session, cancellationToken).Wait(cancellationToken); } if (_session.LogicSettings.RenamePokemon) { RenamePokemonTask.Execute(_session, cancellationToken).Wait(cancellationToken); } if (_session.LogicSettings.AutoFavoritePokemon) { FavoritePokemonTask.Execute(_session, cancellationToken).Wait(cancellationToken); } RecycleItemsTask.Execute(_session, cancellationToken).Wait(cancellationToken); if (_session.LogicSettings.UseEggIncubators) { UseIncubatorsTask.Execute(_session, cancellationToken).Wait(cancellationToken); } if (_session.LogicSettings.UseGpxPathing) { FarmPokestopsGpxTask.Execute(_session, cancellationToken).Wait(cancellationToken); } else { FarmPokestopsTask.ExeCuteMyFarm(_session, cancellationToken).Wait(cancellationToken); } }
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); } }
public async Task <IState> Execute(ISession session, CancellationToken cancellationToken) { try { await CheckChallengeDoneTask.Execute(session, cancellationToken); await CheckChallengeTask.Execute(session, cancellationToken); if (session.LogicSettings.EvolveAllPokemonAboveIv || session.LogicSettings.EvolveAllPokemonWithEnoughCandy) { await EvolvePokemonTask.Execute(session, cancellationToken); } if (session.LogicSettings.BeLikeRobot) { if (session.LogicSettings.AutoFavoritePokemon) { await FavoritePokemonTask.Execute(session, cancellationToken); } if (session.LogicSettings.TransferDuplicatePokemon) { await TransferDuplicatePokemonTask.Execute(session, cancellationToken); } if (session.LogicSettings.AutomaticallyLevelUpPokemon) { await LevelUpPokemonTask.Execute(session, cancellationToken); } if (session.LogicSettings.RenamePokemon) { await RenamePokemonTask.Execute(session, cancellationToken); } await RecycleItemsTask.Execute(session, cancellationToken); } if (session.LogicSettings.UseEggIncubators) { await session.EggWalker.InitEggWalker(cancellationToken); } if (session.LogicSettings.UseCustomRoute) { await FarmPokestopsCustomRouteTask.Execute(session, cancellationToken); } else { if (session.LogicSettings.UseDiscoveryPathing) { await FarmPokeStopsDiscoveryTask.Execute(session, cancellationToken); } else { await FarmPokestopsTask.Execute(session, cancellationToken); } } } catch (PtcOfflineException) { session.EventDispatcher.Send(new ErrorEvent { Message = session.Translation.GetTranslation(TranslationString.PtcOffline) }); session.EventDispatcher.Send(new NoticeEvent { Message = session.Translation.GetTranslation(TranslationString.TryingAgainIn, 20) }); await Task.Delay(20000, cancellationToken); return(new LoginState()); } catch (AccessTokenExpiredException) { session.EventDispatcher.Send(new ErrorEvent { Message = session.Translation.GetTranslation(TranslationString.AccessTokenExpired) }); session.EventDispatcher.Send(new NoticeEvent { Message = session.Translation.GetTranslation(TranslationString.TryingAgainIn, 60) }); await Task.Delay(60000, cancellationToken); return(new LoginState()); } catch (InvalidResponseException ex) { session.EventDispatcher.Send(new ErrorEvent { Message = session.Translation.GetTranslation(TranslationString.NianticServerUnstable) }); Logger.Write("[NIANTIC] " + ex.Message, LogLevel.Error); return(this); } catch (AccountNotVerifiedException) { session.EventDispatcher.Send(new ErrorEvent { Message = session.Translation.GetTranslation(TranslationString.AccountNotVerified) }); await Task.Delay(2000, cancellationToken); session.EventDispatcher.Send(new BotCompleteFailureEvent { Shutdown = false, Stop = true }); } catch (GoogleException e) { if (e.Message.Contains("NeedsBrowser")) { session.EventDispatcher.Send(new ErrorEvent { Message = session.Translation.GetTranslation(TranslationString.GoogleTwoFactorAuth) }); session.EventDispatcher.Send(new ErrorEvent { Message = session.Translation.GetTranslation(TranslationString.GoogleTwoFactorAuthExplanation) }); await Task.Delay(7000, cancellationToken); try { Process.Start("https://security.google.com/settings/security/apppasswords"); } catch (Exception) { session.EventDispatcher.Send(new ErrorEvent { Message = "https://security.google.com/settings/security/apppasswords" }); throw; } } session.EventDispatcher.Send(new ErrorEvent { Message = session.Translation.GetTranslation(TranslationString.GoogleError) }); await Task.Delay(2000, cancellationToken); session.EventDispatcher.Send(new BotCompleteFailureEvent { Shutdown = false, Stop = true }); } return(this); }
public async Task <IState> Execute(ISession session, CancellationToken cancellationToken) { if (session.LogicSettings.TransferDuplicatePokemon) { await TransferDuplicatePokemonTask.Execute(session, cancellationToken); } if (session.LogicSettings.TransferDuplicatePokemon) { await DisplayPokemonStatsTask.WriteHighest(session); } if (session.LogicSettings.EvolveAllPokemonAboveIv || session.LogicSettings.EvolveAllPokemonWithEnoughCandy) { await EvolvePokemonTask.Execute(session, cancellationToken); } if (session.LogicSettings.AutomaticallyLevelUpPokemon) { await LevelUpPokemonTask.Execute(session, cancellationToken); } if (session.LogicSettings.UseLuckyEggConstantly) { await UseLuckyEggConstantlyTask.Execute(session, cancellationToken); } if (session.LogicSettings.UseIncenseConstantly) { await UseIncenseConstantlyTask.Execute(session, cancellationToken); } await GetPokeDexCount.Execute(session, cancellationToken); if (session.LogicSettings.RenamePokemon) { await RenamePokemonTask.Execute(session, cancellationToken); } if (session.LogicSettings.AutoFavoritePokemon) { await FavoritePokemonTask.Execute(session, cancellationToken); } await RecycleItemsTask.Execute(session, cancellationToken); if (session.LogicSettings.UseEggIncubators) { await UseIncubatorsTask.Execute(session, cancellationToken); } if (session.LogicSettings.UseGpxPathing) { await FarmPokestopsGpxTask.Execute(session, cancellationToken); } else { await FarmPokestopsTask.ExeCuteMyFarm(session, cancellationToken); } return(this); }
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(); } }