Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update FarmPokestopsTask.cs #1530

Merged
merged 1 commit into from
Aug 1, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
}
}
}
}