private bool CheckAndFarmNearbyPokeStop(FortData pokeStop, Client client, FortDetailsResponse fortInfo) { if (Setout.count >= 9) { Setout.Execute(); } if (pokeStop.CooldownCompleteTimestampMs < (long)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds && BotSettings.FarmPokestops) { var fortSearch = objClient.Fort.SearchFort(pokeStop.Id, pokeStop.Latitude, pokeStop.Longitude); Logger.Debug("================[VERBOSE LOGGING - Pokestop Search]================"); Logger.Debug($"Result: {fortSearch.Result}"); Logger.Debug($"ChainHackSequenceNumber: {fortSearch.ChainHackSequenceNumber}"); Logger.Debug($"Cooldown Complete (MS): {fortSearch.CooldownCompleteTimestampMs}"); Logger.Debug($"EXP Award: {fortSearch.ExperienceAwarded}"); Logger.Debug($"Gems Award: {fortSearch.GemsAwarded}"); Logger.Debug($"Item Award: {fortSearch.ItemsAwarded}"); Logger.Debug($"Egg Data: {fortSearch.PokemonDataEgg}"); Logger.Debug("=================================================================="); switch (fortSearch.Result.ToString()) { case "NoResultSet": Logger.ColoredConsoleWrite(ConsoleColor.Red, "Pokestop Error: We did not recieve a result from the pokestop."); break; case "Success": // It already showed our pokestop Information break; case "OutOfRange": Logger.ColoredConsoleWrite(ConsoleColor.Red, "Pokestop Error: The pokestop is out of range!"); break; case "InCooldownPeriod": Logger.ColoredConsoleWrite(ConsoleColor.Yellow, "Pokestop Warning: The current Pokestop is in the cooldown period."); break; case "InventoryFull": Logger.ColoredConsoleWrite(ConsoleColor.Yellow, "Pokestop Warning: Your Inventory is full. You did not recieve any items."); break; case "ExceededDailyLimit": Logger.ColoredConsoleWrite(ConsoleColor.Red, "Pokestop Error: You are above your daily limit of pokestops! You should stop farming pokestops."); break; } Setout.count++; var strDate = DateTime.Now.ToString("HH:mm:ss"); var pokeStopInfo = $"{fortInfo.Name}{Environment.NewLine}Visited:{strDate}{Environment.NewLine}"; if (fortSearch.ExperienceAwarded > 0) { var egg = "/"; if (fortSearch.PokemonDataEgg != null) { egg = fortSearch.PokemonDataEgg.EggKmWalkedTarget + "km"; } var items = ""; if (fortSearch.ItemsAwarded != null) { items = StringUtils.GetSummedFriendlyNameOfItemAwardList(fortSearch.ItemsAwarded); } var logrestock = false; if (fortSearch.ItemsAwarded != null) { foreach (var item in fortSearch.ItemsAwarded) { if (item.ItemId == ItemId.ItemPokeBall || item.ItemId == ItemId.ItemGreatBall || item.ItemId == ItemId.ItemUltraBall) { logrestock = true; } } if (logrestock && pokeballoutofstock) { Logger.ColoredConsoleWrite(ConsoleColor.Red, $"Detected Pokeball Restock - Enabling Catch Pokemon"); CatchingLogic.AllowCatchPokemon = true; pokeballoutofstock = false; } FailedSoftban = 0; BotStats.AddExperience(fortSearch.ExperienceAwarded); Setout.RefreshConsoleTitle(client); Setout.pokeStopFarmedCount++; Setout.SaveSession(); Logger.Info($"Farmed XP: {fortSearch.ExperienceAwarded}, Gems: {fortSearch.GemsAwarded}, Egg: {egg}, Items: {items}"); var strItems = items.Replace(",", Environment.NewLine); pokeStopInfo += $"{fortSearch.ExperienceAwarded} XP{Environment.NewLine}{fortSearch.GemsAwarded}{Environment.NewLine}{egg}{Environment.NewLine}{strItems}"; Logger.Debug("LureInfo: " + pokeStop.LureInfo); if (pokeStop.LureInfo != null) { var pokedata = new MapPokemon(); pokedata.EncounterId = pokeStop.LureInfo.EncounterId; pokedata.PokemonId = pokeStop.LureInfo.ActivePokemonId; pokedata.Latitude = pokeStop.Latitude; pokedata.Longitude = pokeStop.Longitude; pokedata.ExpirationTimestampMs = pokeStop.LureInfo.LureExpiresTimestampMs; pokedata.SpawnPointId = pokeStop.LureInfo.FortId; infoObservable.PushNewPokemonLocation(pokedata); Logger.Debug("Lured Pokemon: " + pokedata); if (!BotSettings.catchPokemonSkipList.Contains(pokedata.PokemonId) && GlobalVars.CatchPokemon) { if (!lureEncounters.Contains(pokedata.EncounterId.ToString())) { Logger.ColoredConsoleWrite(ConsoleColor.Green, "Catching Lured Pokemon"); CatchingLogic.CatchLuredPokemon(pokedata.EncounterId, pokedata.SpawnPointId, pokedata.PokemonId, pokedata.Longitude, pokedata.Latitude); lureEncounters.Add(pokedata.EncounterId.ToString()); } else { Logger.ColoredConsoleWrite(ConsoleColor.Green, "Skipped Lure Pokemon: " + pokedata.PokemonId + " because we have already caught him, or catching pokemon is disabled"); } } } double eggs = 0; if (fortSearch.PokemonDataEgg != null) { eggs = fortSearch.PokemonDataEgg.EggKmWalkedTarget; } Telegram?.sendInformationText(TelegramUtil.TelegramUtilInformationTopics.Pokestop, fortInfo.Name, fortSearch.ExperienceAwarded, eggs, fortSearch.GemsAwarded, StringUtils.GetSummedFriendlyNameOfItemAwardList(fortSearch.ItemsAwarded)); } } Task.Factory.StartNew(() => infoObservable.PushPokeStopInfoUpdate(pokeStop, pokeStopInfo)); return(true); } if (!BotSettings.FarmPokestops) { Logger.ColoredConsoleWrite(ConsoleColor.Green, "Farm Pokestop option unchecked, skipping and only looking for pokemon"); return(false); } Logger.ColoredConsoleWrite(ConsoleColor.Green, "Pokestop not ready to farm again, skipping and only looking for pokemon"); return(false); }
private void Espiral(Client client, FortData[] pokeStops, int MaxWalkingRadiusInMeters) { CatchingLogic.Execute(); Logger.ColoredConsoleWrite(ConsoleColor.Blue, "Starting Archimedean spiral"); var i2 = 0; var salir = true; var cantidadvar = 0.0001; double recorrido = MaxWalkingRadiusInMeters; pokeStops = pokeStops.Where(i => LocationUtils.CalculateDistanceInMeters(objClient.CurrentLatitude, objClient.CurrentLongitude, i.Latitude, i.Longitude) <= BotSettings.MaxWalkingRadiusInMeters).ToArray(); var centerx = objClient.CurrentLatitude; var centery = objClient.CurrentLongitude; if (recorrido <= 100) { cantidadvar = 0.00008; } if (recorrido > 100 && recorrido <= 500) { cantidadvar = 0.00009; } if (recorrido > 500 && recorrido <= 1000) { cantidadvar = 0.0001; } if (recorrido > 1000) { cantidadvar = 0.0002; } while (salir) { if (BotSettings.RelocateDefaultLocation) { break; } var angle = 0.3 * i2; var xx = centerx + cantidadvar * angle * Math.Cos(angle); var yy = centery + cantidadvar * angle * Math.Sin(angle); var distancia = Navigation.DistanceBetween2Coordinates(centerx, centery, xx, yy); if (distancia > recorrido) { salir = false; Logger.ColoredConsoleWrite(ConsoleColor.Green, "Returning to the starting point..."); navigation.HumanLikeWalking(new GeoCoordinate(BotSettings.DefaultLatitude, BotSettings.DefaultLongitude), BotSettings.WalkingSpeedInKilometerPerHour, CatchingLogic.Execute); break; } if (i2 % 10 == 0) { Logger.ColoredConsoleWrite(ConsoleColor.Blue, "Distance from starting point: " + distancia + " metros..."); } navigation.HumanLikeWalking( new GeoCoordinate(xx, yy), BotSettings.WalkingSpeedInKilometerPerHour, CatchingLogic.Execute); Logger.ColoredConsoleWrite(ConsoleColor.Blue, "Looking PokeStops who are less than 30 meters..."); FncPokeStop(client, pokeStops, true); i2++; } }
private void FarmPokestopOnBreak(FortData[] pokeStops, Client client) { //check for overlapping pokestops where we are taking a break Logger.ColoredConsoleWrite(ConsoleColor.Green, "Reached break location. Using Lures Enabled"); var pokestopsWithinRangeStanding = pokeStops .Where(i => LocationUtils .CalculateDistanceInMeters( objClient.CurrentLatitude, objClient.CurrentLongitude, i.Latitude, i.Longitude) < 40); var pokestopCount = pokestopsWithinRangeStanding.Count(); Logger.ColoredConsoleWrite(ConsoleColor.Green, $"{pokestopCount} Pokestops within range of where you are standing."); //Begin farming loop while on break do { foreach (var pokestop in pokestopsWithinRangeStanding) { if (BotSettings.RelocateDefaultLocation) { break; } CatchingLogic.Execute(); var fortInfo = objClient.Fort.GetFort(pokestop.Id, pokestop.Latitude, pokestop.Longitude); if (BotSettings.UseLureGUIClick || (BotSettings.UseLureAtBreak && !pokestop.ActiveFortModifier.Any() && !addedlure)) { if (objClient.Inventory.GetItemAmountByType(ItemId.ItemTroyDisk) > 0) { BotSettings.UseLureGUIClick = false; Logger.ColoredConsoleWrite(ConsoleColor.Magenta, "Adding lure and setting resume walking to 30 minutes"); objClient.Fort.AddFortModifier(fortInfo.FortId, ItemId.ItemTroyDisk); Setout.resumetimestamp = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds + 30000; addedlure = true; } } var farmed = CheckAndFarmNearbyPokeStop(pokestop, objClient, fortInfo); if (farmed) { pokestop.CooldownCompleteTimestampMs = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds + 300500; } Setout.SetCheckTimeToRun(); RandomHelper.RandomSleep(30000, 40000); // wait for a bit before repeating farm cycle to avoid spamming } if (!BotSettings.RelocateDefaultLocation) { continue; } Setout.resumetimestamp = -10000; BotSettings.pauseAtPokeStop = false; Logger.ColoredConsoleWrite(ConsoleColor.Magenta, "Exit Command detected - Ending break"); } while (BotSettings.pauseAtPokeStop); }
public bool ExecuteCatchandFarm() { if (BotSettings.RelocateDefaultLocation) { return(false); } if ((long)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds > lastsearchtimestamp + 10000) { lastsearchtimestamp = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds; var mapObjectsResponse = objClient.Map.GetMapObjects().Result.Item1; //narrow map data to pokestops within walking distance var pokeStops = GetNearbyPokeStops(false, mapObjectsResponse); var pokestopsWithinRangeStanding = pokeStops.Where(i => LocationUtils.CalculateDistanceInMeters(objClient.CurrentLatitude, objClient.CurrentLongitude, i.Latitude, i.Longitude) < 40); var withinRangeStandingList = pokestopsWithinRangeStanding as IList <FortData> ?? pokestopsWithinRangeStanding.ToList(); if (withinRangeStandingList.Any()) { Logger.ColoredConsoleWrite(ConsoleColor.Green, $"{withinRangeStandingList.Count} Pokestops within range of user"); foreach (var pokestop in withinRangeStandingList) { if (!GlobalVars.Gyms.Spin) { if (pokestop.Type != FortType.Checkpoint) { continue; } } if (pokestop.Type == FortType.Gym) { Logger.Info("Spinning Gym"); } var fortInfo = objClient.Fort.GetFort(pokestop.Id, pokestop.Latitude, pokestop.Longitude); var farmed = CheckAndFarmNearbyPokeStop(pokestop, objClient, fortInfo); if (farmed) { pokestop.CooldownCompleteTimestampMs = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds + 300500; } Setout.SetCheckTimeToRun(); RandomHelper.RandomSleep(500, 600); // Time between pokestops } } CatchingLogic.Execute(mapObjectsResponse); if (runGymLogic) { GymsLogic.Execute(); } return(true); } else { return(false); } }