Skip to content

Commit

Permalink
Merge pull request #1004 from TheBorna/master
Browse files Browse the repository at this point in the history
Logger message changes as few users requested
  • Loading branch information
Yamashi authored Jul 27, 2016
2 parents fae7c80 + 87c0d0a commit 724d4e0
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
4 changes: 2 additions & 2 deletions PoGo.NecroBot.CLI/ConsoleEventListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ public void HandleEvent(EggHatchedEvent evt, Context ctx)
public void HandleEvent(FortUsedEvent evt, Context ctx)
{
Logger.Write(
ctx.Translations.GetTranslation(TranslationString.EventFortUsed, evt.Exp, evt.Gems, evt.Items),
ctx.Translations.GetTranslation(TranslationString.EventFortUsed, evt.Name, evt.Exp, evt.Gems, evt.Items),
LogLevel.Pokestop);
}

public void HandleEvent(FortFailedEvent evt, Context ctx)
{
Logger.Write(ctx.Translations.GetTranslation(TranslationString.EventFortFailed, evt.Retry, evt.Max),
Logger.Write(ctx.Translations.GetTranslation(TranslationString.EventFortFailed, evt.Name, evt.Try, evt.Max),
LogLevel.Pokestop, ConsoleColor.DarkRed);
}

Expand Down
6 changes: 3 additions & 3 deletions PoGo.NecroBot.Logic/Common/Translations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ public class Translations
new KeyValuePair<TranslationString, string>(TranslationString.FarmPokestopsNoUsableFound,
"No usable PokeStops found in your area. Is your maximum distance too small?"),
new KeyValuePair<TranslationString, string>(TranslationString.EventFortUsed,
"XP: {0}, Gems: {1}, Items: {2}"),
"Name: {0} XP: {1}, Gems: {2}, Items: {3}"),
new KeyValuePair<TranslationString, string>(TranslationString.EventFortFailed,
"Looting failed, possible softban. Unban in: {0}/{1}"),
new KeyValuePair<TranslationString, string>(TranslationString.EventFortTargeted, "{0} in ({1}m)"),
"Name: {0} INFO: Looting failed, possible softban. Unban in: {1}/{2}"),
new KeyValuePair<TranslationString, string>(TranslationString.EventFortTargeted, "Arriving to Pokestop: {0} in ({1}m)"),
new KeyValuePair<TranslationString, string>(TranslationString.EventProfileLogin, "Playing as {0}"),
new KeyValuePair<TranslationString, string>(TranslationString.EventUsedLuckyEgg,
"Used Lucky Egg, remaining: {0}"),
Expand Down
3 changes: 2 additions & 1 deletion PoGo.NecroBot.Logic/Event/FortFailedEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
{
public class FortFailedEvent : IEvent
{
public int Retry;
public string Name;
public int Try;
public int Max;
}
}
1 change: 1 addition & 0 deletions PoGo.NecroBot.Logic/Event/FortUsedEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{
public class FortUsedEvent : IEvent
{
public string Name;
public int Exp;
public int Gems;
public string Items;
Expand Down
2 changes: 1 addition & 1 deletion PoGo.NecroBot.Logic/Tasks/CatchIncensePokemonsTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static async Task Execute(Context ctx, StateMachine machine)
if (ctx.LogicSettings.UsePokemonToNotCatchFilter &&
ctx.LogicSettings.PokemonsNotToCatch.Contains(pokemon.PokemonId))
{
Logger.Write("Skipped " + pokemon.PokemonId);
Logger.Write("[Pokemon ignore filter] - Ignoring " + pokemon.PokemonId + " as defined in settings");
}
else
{
Expand Down
11 changes: 7 additions & 4 deletions PoGo.NecroBot.Logic/Tasks/FarmPokestopsTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ await ctx.Navigation.HumanLikeWalking(new GeoCoordinate(pokeStop.Latitude, pokeS
}

FortSearchResponse fortSearch;
var fortRetry = 0; //Current check
var TimesZeroXPawarded = 0;
var fortTry = 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 {
Expand All @@ -108,11 +109,12 @@ await ctx.Navigation.HumanLikeWalking(new GeoCoordinate(pokeStop.Latitude, pokeS
break; // Check if successfully looted, if so program can continue as this was "false alarm".
}

fortRetry += 1;
fortTry += 1;

machine.Fire(new FortFailedEvent
{
Retry = fortRetry,
Name = fortInfo.Name,
Try = fortTry,
Max = retryNumber - zeroCheck
});

Expand All @@ -122,14 +124,15 @@ await ctx.Navigation.HumanLikeWalking(new GeoCoordinate(pokeStop.Latitude, pokeS
} else {
machine.Fire(new FortUsedEvent
{
Name = fortInfo.Name,
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.
} while (fortTry < 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
Expand Down

0 comments on commit 724d4e0

Please sign in to comment.