Skip to content

Commit

Permalink
Merge pull request #1530 from wbayer81/patch-1
Browse files Browse the repository at this point in the history
Update FarmPokestopsTask.cs
  • Loading branch information
NecronomiconCoding authored Aug 1, 2016
2 parents ec83e9c + 0d0b811 commit 791f3fc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions PoGo.NecroBot.Logic/Tasks/FarmPokestopsTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace PoGo.NecroBot.Logic.Tasks
public static class FarmPokestopsTask
{
public static int TimesZeroXPawarded;

private static int storeRI;
public static async Task Execute(ISession session, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
Expand All @@ -48,6 +48,8 @@ await session.Navigation.Move(

var pokestopList = await GetPokeStops(session);
var stopsHit = 0;
var rc = new Random(); //initialize pokestop random cleanup counter first time
storeRI = rc.Next(3, 9);
var eggWalker = new EggWalker(1000, session);

if (pokestopList.Count <= 0)
Expand Down Expand Up @@ -156,8 +158,9 @@ await session.Navigation.Move(new GeoCoordinate(pokeStop.Latitude, pokeStop.Long

await eggWalker.ApplyDistance(distance, cancellationToken);

if (++stopsHit%5 == 0) //TODO: OR item/pokemon bag is full
if (++stopsHit >= storeRI) //TODO: OR item/pokemon bag is full //check stopsHit against storeRI random without dividing.
{
storeRI = rc.Next(2, 8); //set new storeRI for new random value
stopsHit = 0;
if (fortSearch.ItemsAwarded.Count > 0)
{
Expand Down Expand Up @@ -228,4 +231,4 @@ private static async Task<List<FortData>> GetPokeStops(ISession session)
return pokeStops.ToList();
}
}
}
}

0 comments on commit 791f3fc

Please sign in to comment.