Skip to content

Commit

Permalink
Merge pull request #1456 from Ryuichiro/Offset-Parameter
Browse files Browse the repository at this point in the history
Offset parameter
  • Loading branch information
NecronomiconCoding authored Jul 30, 2016
2 parents 52c2103 + fcf2eb0 commit 0fb91fc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions PoGo.NecroBot.Logic/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public class GlobalSettings
public double DefaultAltitude = 10;
public double DefaultLatitude = 40.785091;
public double DefaultLongitude = -73.968285;
public int MaxSpawnLocationOffset = 10;
public int DelayBetweenPokemonCatch = 2000;
public int DelayBetweenPlayerActions = 5000;
public float EvolveAboveIvValue = 95;
Expand Down Expand Up @@ -479,11 +480,14 @@ AuthType ISettings.AuthType
}
}

// Never spawn at the same position.
private readonly Random _rand = new Random();

double ISettings.DefaultLatitude
{
get
{
return _settings.DefaultLatitude;
return _settings.DefaultLatitude + _rand.NextDouble() * (_settings.MaxSpawnLocationOffset / 111111);
}

set
Expand All @@ -496,7 +500,7 @@ double ISettings.DefaultLongitude
{
get
{
return _settings.DefaultLongitude;
return _settings.DefaultLongitude + _rand.NextDouble() * (_settings.MaxSpawnLocationOffset / 111111 / Math.Cos(_settings.DefaultLatitude));
}

set
Expand Down

0 comments on commit 0fb91fc

Please sign in to comment.