From b01cc7a78ba9c88e8286891375191f9df35477fd Mon Sep 17 00:00:00 2001 From: Stephan Date: Sun, 31 Jul 2016 22:46:55 +0200 Subject: [PATCH] Fixed the berry event handlig in the CLI and added the berry type --- .../Config/Translations/translation.de.json | 8 ++++++++ PoGo.NecroBot.CLI/ConsoleEventListener.cs | 13 ++++++++++++- PoGo.NecroBot.Logic/Common/Translations.cs | 4 ++++ PoGo.NecroBot.Logic/Event/UseBerryEvent.cs | 5 ++++- PoGo.NecroBot.Logic/Tasks/CatchPokemonTask.cs | 2 +- 5 files changed, 29 insertions(+), 3 deletions(-) diff --git a/PoGo.NecroBot.CLI/Config/Translations/translation.de.json b/PoGo.NecroBot.CLI/Config/Translations/translation.de.json index 4965388d2..f1cd90af7 100644 --- a/PoGo.NecroBot.CLI/Config/Translations/translation.de.json +++ b/PoGo.NecroBot.CLI/Config/Translations/translation.de.json @@ -106,6 +106,14 @@ "Key": "eventNoPokeballs", "Value": "Keine Pokébälle mehr! - Wir haben ein {0} mit {1} WP verpasst!" }, + { + "Key": "eventUseBerry", + "Value": "{0} benutzt, {1} verbleibend" + }, + { + "Key": "itemRazzBerry", + "Value": "Himmihbeere" + }, { "Key": "catchStatusAttempt", "Value": "{0} Versuch #{1}" diff --git a/PoGo.NecroBot.CLI/ConsoleEventListener.cs b/PoGo.NecroBot.CLI/ConsoleEventListener.cs index c72d6df83..e338ff6c9 100644 --- a/PoGo.NecroBot.CLI/ConsoleEventListener.cs +++ b/PoGo.NecroBot.CLI/ConsoleEventListener.cs @@ -180,7 +180,18 @@ public void HandleEvent(NoPokeballEvent evt, ISession session) public void HandleEvent(UseBerryEvent evt, ISession session) { - Logger.Write(session.Translation.GetTranslation(TranslationString.EventNoPokeballs, evt.Count), + string strBerry; + switch (evt.BerryType) + { + case ItemId.ItemRazzBerry: + strBerry = session.Translation.GetTranslation(TranslationString.ItemRazzBerry); + break; + default: + strBerry = evt.BerryType.ToString(); + break; + } + + Logger.Write(session.Translation.GetTranslation(TranslationString.EventUseBerry, strBerry, evt.Count), LogLevel.Berry); } diff --git a/PoGo.NecroBot.Logic/Common/Translations.cs b/PoGo.NecroBot.Logic/Common/Translations.cs index fdca76831..ba34a6e63 100644 --- a/PoGo.NecroBot.Logic/Common/Translations.cs +++ b/PoGo.NecroBot.Logic/Common/Translations.cs @@ -39,6 +39,8 @@ public enum TranslationString EventItemRecycled, EventPokemonCapture, EventNoPokeballs, + EventUseBerry, + ItemRazzBerry, CatchStatusAttempt, CatchStatus, Candies, @@ -174,6 +176,8 @@ public class Translation : ITranslation "({0}) | ({1}) {2} Lvl: {3} CP: ({4}/{5}) IV: {6}% | Chance: {7}% | {8}m dist | with a {9} ({10} left). | {11}"), new KeyValuePair(TranslationString.EventNoPokeballs, "No Pokeballs - We missed a {0} with CP {1}"), + new KeyValuePair(TranslationString.EventUseBerry, "Used {0} | {1} remaining"), + new KeyValuePair(TranslationString.ItemRazzBerry, "Razz Berry"), new KeyValuePair(TranslationString.CatchStatusAttempt, "{0} Attempt #{1}"), new KeyValuePair(TranslationString.CatchStatus, "{0}"), new KeyValuePair(TranslationString.Candies, "Candies: {0}"), diff --git a/PoGo.NecroBot.Logic/Event/UseBerryEvent.cs b/PoGo.NecroBot.Logic/Event/UseBerryEvent.cs index 0e96bc050..df12aea9c 100644 --- a/PoGo.NecroBot.Logic/Event/UseBerryEvent.cs +++ b/PoGo.NecroBot.Logic/Event/UseBerryEvent.cs @@ -1,7 +1,10 @@ -namespace PoGo.NecroBot.Logic.Event +using POGOProtos.Inventory.Item; + +namespace PoGo.NecroBot.Logic.Event { public class UseBerryEvent : IEvent { + public ItemId BerryType; public int Count; } } \ No newline at end of file diff --git a/PoGo.NecroBot.Logic/Tasks/CatchPokemonTask.cs b/PoGo.NecroBot.Logic/Tasks/CatchPokemonTask.cs index 11321b0c1..a1965f94e 100644 --- a/PoGo.NecroBot.Logic/Tasks/CatchPokemonTask.cs +++ b/PoGo.NecroBot.Logic/Tasks/CatchPokemonTask.cs @@ -231,7 +231,7 @@ private static async Task UseBerry(ISession session, ulong encounterId, string s await session.Client.Encounter.UseCaptureItem(encounterId, ItemId.ItemRazzBerry, spawnPointId); berry.Count -= 1; - session.EventDispatcher.Send(new UseBerryEvent {Count = berry.Count}); + session.EventDispatcher.Send(new UseBerryEvent {BerryType = ItemId.ItemRazzBerry, Count = berry.Count}); } } } \ No newline at end of file