From b8dd64d5fc6134feebbcac4baeeeb01177fbf71e Mon Sep 17 00:00:00 2001 From: TheBorna Date: Wed, 27 Jul 2016 15:26:50 +0200 Subject: [PATCH 1/3] Checks if the pokestop can be looted or not (if the cooldown is at 0), to prevent waiting without reason. --- PoGo.NecroBot.Logic/Tasks/FarmPokestopsTask.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/PoGo.NecroBot.Logic/Tasks/FarmPokestopsTask.cs b/PoGo.NecroBot.Logic/Tasks/FarmPokestopsTask.cs index 749099169..d39551915 100644 --- a/PoGo.NecroBot.Logic/Tasks/FarmPokestopsTask.cs +++ b/PoGo.NecroBot.Logic/Tasks/FarmPokestopsTask.cs @@ -85,8 +85,7 @@ await ctx.Navigation.HumanLikeWalking(new GeoCoordinate(pokeStop.Latitude, pokeS POGOProtos.Networking.Responses.FortSearchResponse fortSearch; var fortRetry = 0; - do - { + do { fortSearch = await ctx.Client.Fort.SearchFort(pokeStop.Id, pokeStop.Latitude, pokeStop.Longitude); if (fortSearch.ExperienceAwarded > 0) @@ -99,19 +98,23 @@ await ctx.Navigation.HumanLikeWalking(new GeoCoordinate(pokeStop.Latitude, pokeS }); break; //Continue with program as loot was succesfull. - } else { //If fort gave 0 experience, retry 40 times to clear softban. - fortRetry += 1; + } else { + if ((int)fortSearch.CooldownCompleteTimestampMs != 0) + { + break; // Check if successfully looted, if so program can continue as this was "false alrarm". + } + + fortRetry += 1; machine.Fire(new FortFailedEvent { Retry = fortRetry }); - Random random = new Random(); await Task.Delay(500 + random.Next(0, 200)); //Randomized pause } - } while (fortRetry < 40); //Stop trying if softban is cleaned earlier or if 40 times fort looting failed. + } while (fortRetry < 40); //Stop trying if softban is removed earlier or if 40 times fort looting failed. await Task.Delay(1000); if (++stopsHit % 5 == 0) //TODO: OR item/pokemon bag is full From c2072a21c624445e984ce89b6c6775c4180040e3 Mon Sep 17 00:00:00 2001 From: TheBorna Date: Wed, 27 Jul 2016 15:37:06 +0200 Subject: [PATCH 2/3] Pokestop softban bypass (small improvement) --- PoGo.NecroBot.Logic/Tasks/FarmPokestopsTask.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/PoGo.NecroBot.Logic/Tasks/FarmPokestopsTask.cs b/PoGo.NecroBot.Logic/Tasks/FarmPokestopsTask.cs index d39551915..b0ce340ff 100644 --- a/PoGo.NecroBot.Logic/Tasks/FarmPokestopsTask.cs +++ b/PoGo.NecroBot.Logic/Tasks/FarmPokestopsTask.cs @@ -101,8 +101,7 @@ await ctx.Navigation.HumanLikeWalking(new GeoCoordinate(pokeStop.Latitude, pokeS } else { if ((int)fortSearch.CooldownCompleteTimestampMs != 0) { - - break; // Check if successfully looted, if so program can continue as this was "false alrarm". + break; // Check if successfully looted, if so program can continue as this was "false alarm". } fortRetry += 1; From 073732dace3f6a547fddea0fad2a7791c85717b5 Mon Sep 17 00:00:00 2001 From: TheBorna Date: Wed, 27 Jul 2016 17:42:34 +0200 Subject: [PATCH 3/3] Softban fix, with checks. --- PoGo.NecroBot.CLI/ConsoleEventListener.cs | 2 +- PoGo.NecroBot.Logic/Common/Translations.cs | 2 +- PoGo.NecroBot.Logic/Event/FortFailedEvent.cs | 1 + .../Tasks/FarmPokestopsTask.cs | 41 ++++++++++++------- 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/PoGo.NecroBot.CLI/ConsoleEventListener.cs b/PoGo.NecroBot.CLI/ConsoleEventListener.cs index f787fc21f..a7fee79b8 100644 --- a/PoGo.NecroBot.CLI/ConsoleEventListener.cs +++ b/PoGo.NecroBot.CLI/ConsoleEventListener.cs @@ -79,7 +79,7 @@ public void HandleEvent(FortUsedEvent evt, Context ctx) public void HandleEvent(FortFailedEvent evt, Context ctx) { - Logger.Write(ctx.Translations.GetTranslation(TranslationString.EventFortFailed, evt.Retry), + Logger.Write(ctx.Translations.GetTranslation(TranslationString.EventFortFailed, evt.Retry, evt.Max), LogLevel.Pokestop, ConsoleColor.DarkRed); } diff --git a/PoGo.NecroBot.Logic/Common/Translations.cs b/PoGo.NecroBot.Logic/Common/Translations.cs index eca340a58..9059d769c 100644 --- a/PoGo.NecroBot.Logic/Common/Translations.cs +++ b/PoGo.NecroBot.Logic/Common/Translations.cs @@ -32,7 +32,7 @@ public class Translations new KeyValuePair(TranslationString.EventFortUsed, "XP: {0}, Gems: {1}, Items: {2}"), new KeyValuePair(TranslationString.EventFortFailed, - "Looting failed, possible softban. Retry: {0}/40"), + "Looting failed, possible softban. Unban in: {0}/{1}"), new KeyValuePair(TranslationString.EventFortTargeted, "{0} in ({1}m)"), new KeyValuePair(TranslationString.EventProfileLogin, "Playing as {0}"), new KeyValuePair(TranslationString.EventUsedLuckyEgg, diff --git a/PoGo.NecroBot.Logic/Event/FortFailedEvent.cs b/PoGo.NecroBot.Logic/Event/FortFailedEvent.cs index 338c0aa34..e20adc968 100644 --- a/PoGo.NecroBot.Logic/Event/FortFailedEvent.cs +++ b/PoGo.NecroBot.Logic/Event/FortFailedEvent.cs @@ -3,5 +3,6 @@ public class FortFailedEvent : IEvent { public int Retry; + public int Max; } } \ No newline at end of file diff --git a/PoGo.NecroBot.Logic/Tasks/FarmPokestopsTask.cs b/PoGo.NecroBot.Logic/Tasks/FarmPokestopsTask.cs index 1a1a14ddd..7d417bea5 100644 --- a/PoGo.NecroBot.Logic/Tasks/FarmPokestopsTask.cs +++ b/PoGo.NecroBot.Logic/Tasks/FarmPokestopsTask.cs @@ -91,12 +91,34 @@ await ctx.Navigation.HumanLikeWalking(new GeoCoordinate(pokeStop.Latitude, pokeS } FortSearchResponse fortSearch; - var fortRetry = 0; + var fortRetry = 0; //Current check + var retryNumber = 40; //How many times it needs to check to clear softban + var 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++; - if (TimesZeroXPawarded > 5) + 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, @@ -105,19 +127,8 @@ await ctx.Navigation.HumanLikeWalking(new GeoCoordinate(pokeStop.Latitude, pokeS }); break; //Continue with program as loot was succesfull. - } else { //If fort gave 0 experience, retry 40 times to clear softban. - fortRetry += 1; - - machine.Fire(new FortFailedEvent - { - Retry = fortRetry - }); - - Random random = new Random(); - await Task.Delay(500 + random.Next(0, 200)); //Randomized pause } - - } while (fortRetry < 40); //Stop trying if softban is cleaned earlier or if 40 times fort looting failed. + } while (fortRetry < retryNumber - zeroCheck); //Stop trying if softban is cleaned earlier or if 40 times fort looting failed. await Task.Delay(1000); if (++stopsHit%5 == 0) //TODO: OR item/pokemon bag is full