Skip to content

Commit

Permalink
Merge pull request NecronomiconCoding#1386 from RoseFlunder/master
Browse files Browse the repository at this point in the history
Additional information egg hatched event
  • Loading branch information
NecronomiconCoding authored Jul 30, 2016
2 parents 847fd8f + 273ec89 commit 36d31f4
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion PoGo.NecroBot.CLI/Config/Translations/translation.de.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
},
{
"Key": "incubatorEggHatched",
"Value": "Ei ist geschlüpft: {0}"
"Value": "Ei ist geschlüpft: {0} | Lvl: {1} CP: ({2}/{3}) IV: {4}%"
},
{
"Key": "logEntryError",
Expand Down
7 changes: 5 additions & 2 deletions PoGo.NecroBot.CLI/ConsoleEventListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,15 @@ public void HandleEvent(EggIncubatorStatusEvent evt, ISession session)
{
Logger.Write(evt.WasAddedNow
? session.Translation.GetTranslation(TranslationString.IncubatorPuttingEgg, evt.KmRemaining)
: session.Translation.GetTranslation(TranslationString.IncubatorStatusUpdate, evt.KmRemaining));
: session.Translation.GetTranslation(TranslationString.IncubatorStatusUpdate, evt.KmRemaining),
LogLevel.Egg);
}

public void HandleEvent(EggHatchedEvent evt, ISession session)
{
Logger.Write(session.Translation.GetTranslation(TranslationString.IncubatorEggHatched, evt.PokemonId.ToString()));
Logger.Write(session.Translation.GetTranslation(TranslationString.IncubatorEggHatched,
evt.PokemonId.ToString(), evt.Level, evt.Cp, evt.MaxCp, evt.Perfection),
LogLevel.Egg);
}

public void HandleEvent(FortUsedEvent evt, ISession session)
Expand Down
2 changes: 1 addition & 1 deletion PoGo.NecroBot.Logic/Common/Translations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public class Translation : ITranslation
new KeyValuePair<TranslationString, string>(TranslationString.WelcomeWarning, "Make sure Lat & Lng are right. Exit Program if not! Lat: {0} Lng: {1}"),
new KeyValuePair<TranslationString, string>(TranslationString.IncubatorPuttingEgg, "Putting egg in incubator: {0:0.00}km left"),
new KeyValuePair<TranslationString, string>(TranslationString.IncubatorStatusUpdate, "Incubator status update: {0:0.00}km left"),
new KeyValuePair<TranslationString, string>(TranslationString.IncubatorEggHatched, "Incubated egg has hatched: {0}"),
new KeyValuePair<TranslationString, string>(TranslationString.IncubatorEggHatched, "Incubated egg has hatched: {0} | Lvl: {1} CP: ({2}/{3}) IV: {4}%"),
new KeyValuePair<TranslationString, string>(Common.TranslationString.LogEntryError, "ERROR"),
new KeyValuePair<TranslationString, string>(Common.TranslationString.LogEntryAttention, "ATTENTION"),
new KeyValuePair<TranslationString, string>(Common.TranslationString.LogEntryInfo, "INFO"),
Expand Down
4 changes: 4 additions & 0 deletions PoGo.NecroBot.Logic/Event/EggHatchedEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@ public class EggHatchedEvent : IEvent
{
public ulong Id;
public PokemonId PokemonId;
public double Level;
public int Cp;
public int MaxCp;
public double Perfection;
}
}
7 changes: 6 additions & 1 deletion PoGo.NecroBot.Logic/Tasks/UseIncubatorsTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using PoGo.NecroBot.Logic.Event;
using PoGo.NecroBot.Logic.State;
using POGOProtos.Inventory.Item;
using PoGo.NecroBot.Logic.PoGoUtils;

#endregion

Expand Down Expand Up @@ -55,7 +56,11 @@ public static async Task Execute(ISession session, CancellationToken cancellatio
session.EventDispatcher.Send(new EggHatchedEvent
{
Id = hatched.Id,
PokemonId = hatched.PokemonId
PokemonId = hatched.PokemonId,
Level = PokemonInfo.GetLevel(hatched),
Cp = hatched.Cp,
MaxCp = PokemonInfo.CalculateMaxCp(hatched),
Perfection = Math.Round(PokemonInfo.CalculatePokemonPerfection(hatched), 2)
});
}

Expand Down

0 comments on commit 36d31f4

Please sign in to comment.