public void Reset(ISettings settings, ILogicSettings logicSettings) { Client = new Client(Settings); LogicClient = new LogicClient(LogicSettings); Inventory = new Inventory(Client, LogicClient); Navigation = new Navigation(Client); }
public void Reset(ISettings settings, ILogicSettings logicSettings) { Client = new Client(Settings) {AuthType = settings.AuthType}; // ferox wants us to set this manually Inventory = new Inventory(Client, logicSettings); Navigation = new Navigation(Client); }
public BotInstance(ISettings clientSettings) { _clientSettings = clientSettings; _client = new Client(_clientSettings); _inventory = new Inventory(_client); _navigation = new Navigation(_client); _stats = new Statistics(); }
public GameManagerViewModel() { // Client init Logger.SetLogger(new ConsoleLogger(LogLevel.Info)); _clientSettings = new Settings(); _client = new Client(_clientSettings); _inventory = new Inventory(_client); if (ApiInformation.IsTypePresent("Windows.Phone.Devices.Notification.VibrationDevice")) { _vibrationDevice = VibrationDevice.GetDefault(); } }
public static async Task UseLuckyEgg(Client client, Inventory inventory, StateMachine machine) { var inventoryContent = await inventory.GetItems(); var luckyEggs = inventoryContent.Where(p => p.ItemId == ItemId.ItemLuckyEgg); var luckyEgg = luckyEggs.FirstOrDefault(); if (luckyEgg == null || luckyEgg.Count <= 0 || _lastLuckyEggTime.AddMinutes(30).Ticks > DateTime.Now.Ticks) return; _lastLuckyEggTime = DateTime.Now; await client.Inventory.UseItemXpBoost(); var refreshCachedInventory = await inventory.RefreshCachedInventory(); machine.Fire(new UseLuckyEggEvent {Count = luckyEgg.Count}); await Task.Delay(2000); }
public static void UseLuckyEgg(Client client, Inventory inventory, StateMachine machine) { var inventoryContent = inventory.GetItems().Result; var luckyEggs = inventoryContent.Where(p => p.ItemId == ItemId.ItemLuckyEgg); var luckyEgg = luckyEggs.FirstOrDefault(); if (luckyEgg == null || luckyEgg.Count <= 0) return; client.Inventory.UseItemXpBoost().Wait(); luckyEgg.Count -= 1; machine.Fire(new UseLuckyEggEvent {Count = luckyEgg.Count}); Thread.Sleep(2000); }
/// <summary> /// Starts a PTC session for the given user /// </summary> /// <param name="username"></param> /// <param name="password"></param> /// <returns>true if login worked</returns> public static async Task<bool> DoPtcLogin(string username, string password) { ClientSettings = new Settings { PtcUsername = username, PtcPassword = password, AuthType = AuthType.Ptc }; Client = new Client(ClientSettings, new APIFailure()); // Get PTC token var authToken = await Client.Login.DoLogin(); // Update current token even if it's null SettingsService.Instance.PtcAuthToken = authToken; // Return true if login worked, meaning that we have a token return authToken != null; }
/// <summary> /// Sets things up if we didn't come from the login page /// </summary> /// <returns></returns> public static async Task InitializeClient() { ClientSettings = new Settings { AuthType = AuthType.Ptc }; Client = new Client(ClientSettings, new APIFailure()) {AuthToken = SettingsService.Instance.PtcAuthToken}; await Client.Login.DoLogin(); }
/// <summary> /// Starts a Google session for the given user /// </summary> /// <param name="email"></param> /// <param name="password"></param> /// <returns>true if login worked</returns> public static async Task<bool> DoGoogleLogin(string email, string password) { ClientSettings = new Settings { GoogleUsername = email, GooglePassword = password, AuthType = AuthType.Google }; Client = new Client(ClientSettings, new APIFailure()); // Get PTC token var authToken = await Client.Login.DoLogin(); // Update current token even if it's null and clear the token for the other identity provide SettingsService.Instance.GoogleAuthToken = authToken; SettingsService.Instance.PtcAuthToken = null; // Return true if login worked, meaning that we have a token return authToken != null; }
public async Task UseRazzBerry(Client client, ulong encounterId, string spawnPointGuid) { IEnumerable<Item> myItems = await GetItems(client); IEnumerable<Item> RazzBerries = myItems.Where(i => (ItemId)i.Item_ == ItemId.ItemRazzBerry); Item RazzBerry = RazzBerries.FirstOrDefault(); if (RazzBerry != null) { UseItemCaptureRequest useRazzBerry = await client.UseCaptureItem(encounterId, AllEnum.ItemId.ItemRazzBerry, spawnPointGuid); ColoredConsoleWrite(ConsoleColor.Green, $"Using a Razz Berry, we have {RazzBerry.Count} left"); await Task.Delay(2000); } }
//LegalScreen = 0, //AvatarSelection = 1, //AccountCreation = 2, //PokemonCapture = 3, //NameSelection = 4, //PokemonBerry = 5, //UseItem = 6, //FirstTimeExperienceComplete = 7, //PokestopTutorial = 8, //GymTutorial = 9 /* * On first connection before any move you must do 0,1,3,4 & 7 * */ public bool MarkTutorialAsDone(TutorialState State, PokemonGo.RocketAPI.Client client, PokemonId firstPokemon = PokemonId.Charmander) { MarkTutorialCompleteResponse TutorialResponse = null; SetAvatarResponse AvatarResponse = null; bool SuccessFlag = false; try { switch (State) { /* 0 */ case TutorialState.LegalScreen: RandomHelper.RandomSleep(4000, 7000); TutorialResponse = client.Misc.AceptLegalScreen().Result; client.Player.GetPlayer(); SuccessFlag = TutorialResponse.Success; break; /* 1 */ case TutorialState.AvatarSelection: // All MAX values will be used to get a random value // RandormNumber never returns max value. AvatarSettings.Load(); var playerAvatar = new PlayerAvatar(); playerAvatar.Skin = AvatarSettings.skin == 4 ? RandomHelper.RandomNumber(0, 4) : AvatarSettings.skin; playerAvatar.Backpack = AvatarSettings.backpack == 3 ? RandomHelper.RandomNumber(0, 3) : AvatarSettings.backpack; playerAvatar.Eyes = AvatarSettings.eyes == 4 ? RandomHelper.RandomNumber(0, 4) : AvatarSettings.eyes; playerAvatar.Shoes = AvatarSettings.shoes == 3 ? RandomHelper.RandomNumber(0, 3) : AvatarSettings.shoes; playerAvatar.Hat = AvatarSettings.hat == 3 ? RandomHelper.RandomNumber(0, 3) : AvatarSettings.hat; playerAvatar.Pants = AvatarSettings.pants == 3 ? RandomHelper.RandomNumber(0, 3) : AvatarSettings.pants; playerAvatar.Hair = AvatarSettings.hair == 6 ? RandomHelper.RandomNumber(0, 6) : AvatarSettings.hair; playerAvatar.Shirt = AvatarSettings.shirt == 3 ? RandomHelper.RandomNumber(0, 3) : AvatarSettings.shirt; playerAvatar.Avatar = AvatarSettings.Gender == 2 ? RandomHelper.RandomNumber(0, 2) : AvatarSettings.Gender; // TODO Add this new configurable avatar options to tutorial configuration window // currently will use 0 for all value not loaded //playerAvatar.AvatarNecklace = AvatarSettings.necklace = ... //playerAvatar.AvatarBelt = AvatarSettings.belt == ... //playerAvatar.AvatarSocks = AvatarSettings.socks == ... //playerAvatar.AvatarGloves = AvatarSettings.gloves == ... //playerAvatar.AvatarGlasses = AvatarSettings.glasses == ... RandomHelper.RandomSleep(8000, 14500); AvatarResponse = client.Player.SetAvatar(playerAvatar).Result; client.Player.ListAvatarCustomizations(playerAvatar.Avatar == 0 ? PlayerAvatarType.PlayerAvatarMale : PlayerAvatarType.PlayerAvatarFemale, null, null, 0, 0); RandomHelper.RandomSleep(1000, 1700); TutorialResponse = client.Misc.MarkTutorialComplete(new RepeatedField <TutorialState>() { TutorialState.AvatarSelection }).Result; client.Player.GetPlayerProfile(); SuccessFlag = TutorialResponse.Success; break; /* 2 */ case TutorialState.AccountCreation: // Need to check how to implement, meanwhile... TutorialResponse = client.Misc.MarkTutorialComplete(new RepeatedField <TutorialState>() { TutorialState.AccountCreation }).Result; SuccessFlag = TutorialResponse.Success; break; /* 3 */ case TutorialState.PokemonCapture: if (AvatarSettings.starter != PokemonId.Bulbasaur && AvatarSettings.starter != PokemonId.Charmander && AvatarSettings.starter != PokemonId.Squirtle) { switch (new Random().Next(0, 3)) { case 0: AvatarSettings.starter = PokemonId.Bulbasaur; break; case 1: AvatarSettings.starter = PokemonId.Charmander; break; default: AvatarSettings.starter = PokemonId.Squirtle; break; } } /* * batch.getDownloadURLs([ * this.state.assets.getFullIdFromId('1a3c2816-65fa-4b97-90eb-0b301c064b7a'), * this.state.assets.getFullIdFromId('aa8f7687-a022-4773-b900-3a8c170e9aea'), * this.state.assets.getFullIdFromId('e89109b0-9a54-40fe-8431-12f7826c8194'), * ]);*/ CommonRequest.GetDownloadUrlsRequest(client); // Not fully implemented, you need to send the ID's RandomHelper.RandomSleep(10000, 13000); var encounterResponse = client.Encounter.EncounterTutorialComplete(AvatarSettings.starter); if (encounterResponse.Result == EncounterTutorialCompleteResponse.Types.Result.ErrorInvalidPokemon) { Logger.Warning("TUTORIAL 3: Something happened when trying to complete Pokemon ENCOUNTER tutorial (" + AvatarSettings.starter + " / " + encounterResponse.ToString() + ")"); } SuccessFlag = (encounterResponse.Result == EncounterTutorialCompleteResponse.Types.Result.Success); client.Player.GetPlayerProfile(); // TODO: check if this is really needed or the "TutorialState.PokemonCapture" flag is done by the above call. if (!client.Player.PlayerResponse.PlayerData.TutorialState.Contains(TutorialState.PokemonCapture)) { TutorialResponse = client.Misc.MarkTutorialComplete(new RepeatedField <TutorialState>() { TutorialState.PokemonCapture }).Result; if (!TutorialResponse.Success) { Logger.Warning("TUTORIAL 3: Something happened when trying to complete Pokemon MARKTUTORIAL tutorial (" + AvatarSettings.starter + " / " + TutorialResponse.ToString() + ")"); } SuccessFlag = TutorialResponse.Success; } break; /* 4 */ case TutorialState.NameSelection: SuccessFlag = false; string suggestedName = client.Username; ClaimCodenameResponse.Types.Status status = ClaimCodenameResponse.Types.Status.CodenameNotValid; if (suggestedName.Contains("@")) { suggestedName = suggestedName.Substring(0, suggestedName.IndexOf("@")); } for (int i = 0; i < 100; i++) { suggestedName = AvatarSettings.nicknamePrefix + suggestedName + (i == 0 ? "" : i.ToString()) + AvatarSettings.nicknameSufix; status = client.Misc.ClaimCodename(suggestedName).Status; RandomHelper.RandomSleep(7000, 13500); if (status == ClaimCodenameResponse.Types.Status.Success) { break; } else if (status == ClaimCodenameResponse.Types.Status.CurrentOwner || status == ClaimCodenameResponse.Types.Status.CodenameChangeNotAllowed) { break; } Logger.Debug("Player Name: " + suggestedName + " is NOT AVAILABLE."); } client.Player.GetPlayer(); TutorialResponse = client.Misc.MarkTutorialComplete(new RepeatedField <TutorialState>() { TutorialState.NameSelection }).Result; SuccessFlag = TutorialResponse.Success; break; /* 5 */ case TutorialState.PokemonBerry: TutorialResponse = client.Misc.MarkTutorialComplete(new RepeatedField <TutorialState>() { TutorialState.PokemonBerry }).Result; SuccessFlag = TutorialResponse.Success; break; /* 6 */ case TutorialState.UseItem: // Need to check how to implement, meanwhile... TutorialResponse = client.Misc.MarkTutorialComplete(new RepeatedField <TutorialState>() { TutorialState.UseItem }).Result; SuccessFlag = TutorialResponse.Success; break; /* 7 */ case TutorialState.FirstTimeExperienceComplete: RandomHelper.RandomSleep(3500, 6000); TutorialResponse = client.Misc.MarkTutorialComplete(new RepeatedField <TutorialState>() { TutorialState.FirstTimeExperienceComplete }).Result; SuccessFlag = TutorialResponse.Success; break; /* 8 */ case TutorialState.PokestopTutorial: TutorialResponse = client.Misc.MarkTutorialComplete(new RepeatedField <TutorialState>() { TutorialState.PokestopTutorial }).Result; SuccessFlag = TutorialResponse.Success; break; /* 9 */ case TutorialState.GymTutorial: TutorialResponse = client.Misc.MarkTutorialComplete(new RepeatedField <TutorialState>() { TutorialState.GymTutorial }).Result; SuccessFlag = TutorialResponse.Success; break; } if (SuccessFlag) { Logger.Info("[TUTORIAL] " + (int)State + "- " + State + " set DONE"); } else { Logger.Warning("[TUTORIAL] " + (int)State + "- " + Enum.GetName(typeof(EncounterTutorialCompleteResponse.Types), State) + " set FAILED. Reason: " + TutorialResponse.Success); } RandomHelper.RandomDelay(5000).Wait(); return(SuccessFlag); } catch (global::System.Exception ex) { Logger.ExceptionInfo("[TUTORIAL] " + (int)State + "- " + Enum.GetName(typeof(EncounterTutorialCompleteResponse.Types), State) + " EXCEPTION. Reason: " + ex.Message); throw; } }
public Inventory(Client client) { _client = client; EvolutionRequirements.Add(PokemonId.Abra, 25); EvolutionRequirements.Add(PokemonId.Aerodactyl, -1); EvolutionRequirements.Add(PokemonId.Alakhazam, -1); EvolutionRequirements.Add(PokemonId.Arbok, -1); EvolutionRequirements.Add(PokemonId.Arcanine, -1); EvolutionRequirements.Add(PokemonId.Articuno, -1); EvolutionRequirements.Add(PokemonId.Beedrill, -1); EvolutionRequirements.Add(PokemonId.Bellsprout, 25); EvolutionRequirements.Add(PokemonId.Blastoise, -1); EvolutionRequirements.Add(PokemonId.Bulbasaur, 25); EvolutionRequirements.Add(PokemonId.Butterfree, -1); EvolutionRequirements.Add(PokemonId.Caterpie, 12); EvolutionRequirements.Add(PokemonId.Chansey, -1); EvolutionRequirements.Add(PokemonId.Charizard, -1); EvolutionRequirements.Add(PokemonId.Charmeleon, 100); EvolutionRequirements.Add(PokemonId.Charmender, 25); EvolutionRequirements.Add(PokemonId.Clefable, -1); EvolutionRequirements.Add(PokemonId.Clefary, 50); EvolutionRequirements.Add(PokemonId.Cloyster, -1); EvolutionRequirements.Add(PokemonId.Cubone, 50); EvolutionRequirements.Add(PokemonId.Dewgong, -1); EvolutionRequirements.Add(PokemonId.Diglett, 50); EvolutionRequirements.Add(PokemonId.Ditto, -1); EvolutionRequirements.Add(PokemonId.Dodrio, -1); EvolutionRequirements.Add(PokemonId.Doduo, 50); EvolutionRequirements.Add(PokemonId.Dragonair, 100); EvolutionRequirements.Add(PokemonId.Dragonite, -1); EvolutionRequirements.Add(PokemonId.Dratini, 25); EvolutionRequirements.Add(PokemonId.Drowzee, 50); EvolutionRequirements.Add(PokemonId.Dugtrio, -1); EvolutionRequirements.Add(PokemonId.Eevee, 25); EvolutionRequirements.Add(PokemonId.Ekans, 50); EvolutionRequirements.Add(PokemonId.Electabuzz, -1); EvolutionRequirements.Add(PokemonId.Electrode, -1); EvolutionRequirements.Add(PokemonId.Exeggcute, 50); EvolutionRequirements.Add(PokemonId.Exeggutor, -1); EvolutionRequirements.Add(PokemonId.Farfetchd, -1); EvolutionRequirements.Add(PokemonId.Fearow, -1); EvolutionRequirements.Add(PokemonId.Flareon, -1); EvolutionRequirements.Add(PokemonId.Gastly, 25); EvolutionRequirements.Add(PokemonId.Gengar, -1); EvolutionRequirements.Add(PokemonId.Geoduge, 25); EvolutionRequirements.Add(PokemonId.Gloom, 100); EvolutionRequirements.Add(PokemonId.Golbat, -1); EvolutionRequirements.Add(PokemonId.Goldeen, 50); EvolutionRequirements.Add(PokemonId.Golduck, -1); EvolutionRequirements.Add(PokemonId.Golem, -1); EvolutionRequirements.Add(PokemonId.Graveler, 100); EvolutionRequirements.Add(PokemonId.Grimer, -1); EvolutionRequirements.Add(PokemonId.Growlithe, 50); EvolutionRequirements.Add(PokemonId.Gyarados, -1); EvolutionRequirements.Add(PokemonId.Haunter, 100); EvolutionRequirements.Add(PokemonId.Hitmonchan, -1); EvolutionRequirements.Add(PokemonId.Hitmonlee, -1); EvolutionRequirements.Add(PokemonId.Horsea , 50); EvolutionRequirements.Add(PokemonId.Hypno , -1); EvolutionRequirements.Add(PokemonId.Ivysaur, 100); EvolutionRequirements.Add(PokemonId.Jigglypuff, 50); EvolutionRequirements.Add(PokemonId.Jolteon, -1); EvolutionRequirements.Add(PokemonId.Jynx, -1); EvolutionRequirements.Add(PokemonId.Kabuto, 50); EvolutionRequirements.Add(PokemonId.Kabutops, -1); EvolutionRequirements.Add(PokemonId.Kadabra, 100); EvolutionRequirements.Add(PokemonId.Kakuna, 50); EvolutionRequirements.Add(PokemonId.Kangaskhan, -1); EvolutionRequirements.Add(PokemonId.Kingler, -1); EvolutionRequirements.Add(PokemonId.Koffing, 50); EvolutionRequirements.Add(PokemonId.Krabby, 50); EvolutionRequirements.Add(PokemonId.Lapras, -1); EvolutionRequirements.Add(PokemonId.Lickitung, -1); EvolutionRequirements.Add(PokemonId.Machamp, -1); EvolutionRequirements.Add(PokemonId.Machoke , 100); EvolutionRequirements.Add(PokemonId.Machop, 25); EvolutionRequirements.Add(PokemonId.Magikarp, 400); EvolutionRequirements.Add(PokemonId.Magmar, -1); EvolutionRequirements.Add(PokemonId.Magnemite, 50); EvolutionRequirements.Add(PokemonId.Magneton, -1); EvolutionRequirements.Add(PokemonId.Mankey, 50); EvolutionRequirements.Add(PokemonId.Marowak, -1); EvolutionRequirements.Add(PokemonId.Meowth, 50); EvolutionRequirements.Add(PokemonId.Metapod, 50); EvolutionRequirements.Add(PokemonId.Mew , -1); EvolutionRequirements.Add(PokemonId.Mewtwo, -1); EvolutionRequirements.Add(PokemonId.Missingno, -1); EvolutionRequirements.Add(PokemonId.Moltres, -1); EvolutionRequirements.Add(PokemonId.MrMime, -1); EvolutionRequirements.Add(PokemonId.Muk, -1); EvolutionRequirements.Add(PokemonId.Nidoking, -1); EvolutionRequirements.Add(PokemonId.Nidoqueen, -1); EvolutionRequirements.Add(PokemonId.NidoranFemale, 25); EvolutionRequirements.Add(PokemonId.NidoranMale, 25); EvolutionRequirements.Add(PokemonId.Nidorina, 100); EvolutionRequirements.Add(PokemonId.Nidorino, 100); EvolutionRequirements.Add(PokemonId.Ninetales, -1); EvolutionRequirements.Add(PokemonId.Oddish, 25); EvolutionRequirements.Add(PokemonId.Omanyte, 50); EvolutionRequirements.Add(PokemonId.Omastar, -1); EvolutionRequirements.Add(PokemonId.Onix, -1); EvolutionRequirements.Add(PokemonId.Paras, 50); EvolutionRequirements.Add(PokemonId.Parasect, -1); EvolutionRequirements.Add(PokemonId.Persian, -1); EvolutionRequirements.Add(PokemonId.Pidgeot, -1); EvolutionRequirements.Add(PokemonId.Pidgeotto, 50); EvolutionRequirements.Add(PokemonId.Pidgey, 12); EvolutionRequirements.Add(PokemonId.Pikachu, 50); EvolutionRequirements.Add(PokemonId.Pinsir, -1); EvolutionRequirements.Add(PokemonId.Poliwag, 25); EvolutionRequirements.Add(PokemonId.Poliwhirl, 50); EvolutionRequirements.Add(PokemonId.Poliwrath, -1); EvolutionRequirements.Add(PokemonId.Ponyta, 50); EvolutionRequirements.Add(PokemonId.Porygon, -1); EvolutionRequirements.Add(PokemonId.Primeape, -1); EvolutionRequirements.Add(PokemonId.Psyduck, 50); EvolutionRequirements.Add(PokemonId.Raichu, -1); EvolutionRequirements.Add(PokemonId.Rapidash, -1); EvolutionRequirements.Add(PokemonId.Raticate, -1); EvolutionRequirements.Add(PokemonId.Rattata, 25); EvolutionRequirements.Add(PokemonId.Rhydon, -1); EvolutionRequirements.Add(PokemonId.Rhyhorn, 50); EvolutionRequirements.Add(PokemonId.Sandlash, -1); EvolutionRequirements.Add(PokemonId.Sandshrew, 50); EvolutionRequirements.Add(PokemonId.Scyther, -1); EvolutionRequirements.Add(PokemonId.Seadra , -1); EvolutionRequirements.Add(PokemonId.Seaking, -1); EvolutionRequirements.Add(PokemonId.Seel, 50); EvolutionRequirements.Add(PokemonId.Shellder, 50); EvolutionRequirements.Add(PokemonId.Slowbro, -1); EvolutionRequirements.Add(PokemonId.Slowpoke, 50); EvolutionRequirements.Add(PokemonId.Snorlax, -1); EvolutionRequirements.Add(PokemonId.Spearow , 50); EvolutionRequirements.Add(PokemonId.Squirtle, 25); EvolutionRequirements.Add(PokemonId.Starmie, -1); EvolutionRequirements.Add(PokemonId.Staryu, 50); EvolutionRequirements.Add(PokemonId.Tangela, -1); EvolutionRequirements.Add(PokemonId.Tauros, -1); EvolutionRequirements.Add(PokemonId.Tentacool, 50); EvolutionRequirements.Add(PokemonId.Tentacruel, -1); EvolutionRequirements.Add(PokemonId.Vaporeon, -1); EvolutionRequirements.Add(PokemonId.Venomoth, -1); EvolutionRequirements.Add(PokemonId.Venonat, 50); EvolutionRequirements.Add(PokemonId.Venusaur, -1); EvolutionRequirements.Add(PokemonId.Victreebell, -1); EvolutionRequirements.Add(PokemonId.Vileplume, -1); EvolutionRequirements.Add(PokemonId.Voltorb, 50); EvolutionRequirements.Add(PokemonId.Vulpix, 50); EvolutionRequirements.Add(PokemonId.Wartortle, 100); EvolutionRequirements.Add(PokemonId.Weedle, 12); EvolutionRequirements.Add(PokemonId.Weepinbell, 100); EvolutionRequirements.Add(PokemonId.Weezing, -1); EvolutionRequirements.Add(PokemonId.Wigglytuff, -1); EvolutionRequirements.Add(PokemonId.Zapdos, -1); EvolutionRequirements.Add(PokemonId.Zubat, 50); }
public async Task RecycleItems(Client client) { var items = await GetItemsToRecycle(_settings, client); foreach (var item in items) { var transfer = await RecycleItem((AllEnum.ItemId)item.Item_, item.Count); ColoredConsoleWrite(ConsoleColor.DarkCyan, $"Recycled {item.Count}x {((AllEnum.ItemId)item.Item_).ToString().Substring(4)}"); await Task.Delay(500); } await Task.Delay(_settings.RecycleItemsInterval * 1000); RecycleItems(client); }
public Inventory(Client client, LogicClient logicClient) { _client = client; _logicClient = logicClient; }
public async Task RecycleItems(Client client) { await Task.Delay(500); ColoredConsoleWrite(ConsoleColor.White, $"GetItems"); var items = await GetItems(client); int itemCount = items.Sum(e => e.Count); if (itemCount > _settings.ItemRecyclingCount) { items = await GetItemsToRecycle(_settings, items); foreach (var item in items) { await Task.Delay(500); ColoredConsoleWrite(ConsoleColor.White, $"RecycleItem)"); var transfer = await RecycleItem((AllEnum.ItemId)item.Item_, item.Count); ColoredConsoleWrite(ConsoleColor.DarkCyan, $"[{DateTime.Now.ToString("HH:mm:ss")}] Recycled {item.Count}x {(AllEnum.ItemId)item.Item_}"); } } else ColoredConsoleWrite(ConsoleColor.DarkCyan, $"[{DateTime.Now.ToString("HH:mm:ss")}] Recycling cancelled (amount lower than setting): {itemCount} / {_settings.ItemRecyclingCount}"); }
/// <summary> /// Sets things up if we didn't come from the login page /// </summary> /// <returns></returns> public static async Task InitializeClient(bool isPtcAccount) { var isPtcLogin = !String.IsNullOrWhiteSpace(SettingsService.Instance.PtcAuthToken); ClientSettings = new Settings { AuthType = isPtcLogin ? AuthType.Ptc : AuthType.Google }; Client = new Client(ClientSettings, new APIFailure()) { AuthToken = SettingsService.Instance.PtcAuthToken ?? SettingsService.Instance.GoogleAuthToken }; await Client.Login.DoLogin(); }
public Inventory(Client client) { _client = client; }
public Inventory(Client client) : base(client) { }
public Fort(Client client) : base(client) { }
public async Task UseLuckyEgg(Client client) { var inventory = await GetItems(); var luckyEgg = inventory.FirstOrDefault(p => (ItemId)p.ItemId == ItemId.ItemLuckyEgg); if (_lastegguse > DateTime.Now.AddSeconds(5)) { TimeSpan duration = _lastegguse - DateTime.Now; Logger.ColoredConsoleWrite(ConsoleColor.Cyan, $"Lucky Egg still running: {duration.Minutes}m{duration.Seconds}s"); return; } if (luckyEgg == null || luckyEgg.Count <= 0) { return; } await _client.Inventory.UseItemXpBoost(ItemId.ItemLuckyEgg); Logger.ColoredConsoleWrite(ConsoleColor.Cyan, $"Used Lucky Egg, remaining: {luckyEgg.Count - 1}"); _lastegguse = DateTime.Now.AddMinutes(30); await Task.Delay(3000); }
public async Task<IEnumerable<Item>> GetItemsToRecycle(ISettings settings, Client client) { var myItems = await GetItems(client); return myItems .Where(x => settings.ItemRecycleFilter.Any(f => f.Key == ((ItemId)x.Item_) && x.Count > f.Value)) .Select(x => new Item { Item_ = x.Item_, Count = x.Count - settings.ItemRecycleFilter.Single(f => f.Key == (AllEnum.ItemId)x.Item_).Value, Unseen = x.Unseen }); }
public LocationManager(Client client, double speed) { this.client = client; this.metersPerMillisecond = speed / 3600; }
public async Task<IEnumerable<Item>> GetItems(Client client) { var inventory = await client.GetInventory(); return inventory.InventoryDelta.InventoryItems .Select(i => i.InventoryItemData?.Item) .Where(p => p != null); }
/// <summary> /// Sets things up if we didn't come from the login page /// </summary> /// <returns></returns> public static async Task InitializeClient(bool isPtcAccount) { ClientSettings = new Settings { AuthType = isPtcAccount ? AuthType.Ptc : AuthType.Google }; Client = new Client(ClientSettings, new APIFailure()) {AuthToken = isPtcAccount ? SettingsService.Instance.PtcAuthToken : SettingsService.Instance.GoogleAuthToken}; await Client.Login.DoLogin(); }
public Navigation(Client client) { _client = client; }
public void Reset(ISettings settings, ILogicSettings logicSettings) { ApiFailureStrategy _apiStrategy = new ApiFailureStrategy(this); Client = new Client(Settings, _apiStrategy); // ferox wants us to set this manually Inventory = new Inventory(Client, logicSettings); Navigation = new Navigation(Client); }
public Inventory(Client client, ILogicSettings logicSettings) { _client = client; _logicSettings = logicSettings; }
public GoLogic(ISettings clientSettings) { _clientSettings = clientSettings; _client = new Client(_clientSettings); _inventory = new Inventory(_client); }