Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FortSearchResponse fortSearch;
- var fortRetry = 0; //Current check
- const int retryNumber = 50; //How many times it needs to check to clear softban
- const int zeroCheck = 5; //How many times it checks fort before it thinks it's softban
- do {
- fortSearch = await ctx.Client.Fort.SearchFort(pokeStop.Id, pokeStop.Latitude, pokeStop.Longitude);
- if (fortSearch.ExperienceAwarded > 0 && TimesZeroXPawarded > 0) TimesZeroXPawarded = 0;
- if (fortSearch.ExperienceAwarded == 0)
- {
- TimesZeroXPawarded++;
- if (TimesZeroXPawarded > zeroCheck)
- {
- if ((int)fortSearch.CooldownCompleteTimestampMs != 0)
- {
- break; // Check if successfully looted, if so program can continue as this was "false alarm".
- }
- fortRetry += 1;
- machine.Fire(new FortFailedEvent
- {
- Retry = fortRetry,
- Max = retryNumber - zeroCheck
- });
- Random random = new Random();
- await Task.Delay(200 + random.Next(0, 200)); //Randomized pause
- }
- } else {
- machine.Fire(new FortUsedEvent
- {
- Exp = fortSearch.ExperienceAwarded,
- Gems = fortSearch.GemsAwarded,
- Items = StringUtils.GetSummedFriendlyNameOfItemAwardList(fortSearch.ItemsAwarded)
- });
- break; //Continue with program as loot was succesfull.
- }
- } while (fortRetry < retryNumber - zeroCheck); //Stop trying if softban is cleaned earlier or if 40 times fort looting failed.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement