Move back to start location when oustide the MaxTravelDistanceInMeters area.
Move back to start location when oustide the MaxTravelDistanceInMeters area.
Thx @https://github.com/NecronomiconCoding/NecroBot/pull/364
diff --git a/PokemonGo.RocketAPI.Logic/Logic.cs b/PokemonGo.RocketAPI.Logic/Logic.cs
index 1bbe5d6..15c932b 100644
--- a/PokemonGo.RocketAPI.Logic/Logic.cs
+++ b/PokemonGo.RocketAPI.Logic/Logic.cs
@@ -147,6 +147,24 @@ namespace PokemonGo.RocketAPI.Logic
private async Task ExecuteFarmingPokestopsAndPokemons()
{
+ var distanceFromStart = LocationUtils.CalculateDistanceInMeters(
+ _clientSettings.DefaultLatitude, _clientSettings.DefaultLongitude,
+ _client.CurrentLat, _client.CurrentLng);
+
+ // Edge case for when the client somehow ends up outside the defined radius
+ if (_clientSettings.MaxTravelDistanceInMeters != 0 &&
+ distanceFromStart > _clientSettings.MaxTravelDistanceInMeters)
+ {
+ Logger.Write($"You're outside of your defined radius! Walking to start in 5 seconds...", LogLevel.Warning);
+ await Task.Delay(5000);
+ var update = await _navigation.HumanLikeWalking(
+ new GeoCoordinate(_clientSettings.DefaultLatitude, _clientSettings.DefaultLongitude),
+ _clientSettings.WalkingSpeedInKilometerPerHour, null);
+ var ToStart = await _navigation.HumanLikeWalking(
+ new GeoCoordinate(_clientSettings.DefaultLatitude, _clientSettings.DefaultLongitude),
+ _clientSettings.WalkingSpeedInKilometerPerHour, ExecuteCatchAllNearbyPokemons);
+ }
+
var mapObjects = await _client.GetMapObjects();
var pokeStops =
diff --git a/PokemonGo.RocketAPI/Properties/AssemblyInfo.cs b/PokemonGo.RocketAPI/Properties/AssemblyInfo.cs
index 287c75c..c9ad7f4 100644
--- a/PokemonGo.RocketAPI/Properties/AssemblyInfo.cs
+++ b/PokemonGo.RocketAPI/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2016.7.24.280")]
+[assembly: AssemblyVersion("2016.7.24.281")]
[assembly: AssemblyFileVersion("1.0.0.0")]
You may download the files in Public Git.