Skip to content

Commit

Permalink
Update FarmPokestopsTask.cs
Browse files Browse the repository at this point in the history
changed inventory cleanup after fixed 5 pokestops to random value between 3 and 9
  • Loading branch information
wbayer81 authored Jul 31, 2016
1 parent 4327b0b commit 0d0b811
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 @@ -155,8 +157,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 @@ -220,4 +223,4 @@ private static async Task<List<FortData>> GetPokeStops(ISession session)
return pokeStops.ToList();
}
}
}
}

0 comments on commit 0d0b811

Please sign in to comment.