From cdbca10f2d549cba1c894f417a84530de25e411a Mon Sep 17 00:00:00 2001 From: Florian Stinglmayr Date: Thu, 14 Nov 2024 12:14:36 +0100 Subject: [PATCH] add support for Powerplay message --- EDPlayerJournal/Entries/Entry.cs | 1 + EDPlayerJournal/Entries/Events.cs | 1 + EDPlayerJournal/Entries/PowerplayEntry.cs | 32 +++++++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 EDPlayerJournal/Entries/PowerplayEntry.cs diff --git a/EDPlayerJournal/Entries/Entry.cs b/EDPlayerJournal/Entries/Entry.cs index 0d96f2a..cd703a1 100644 --- a/EDPlayerJournal/Entries/Entry.cs +++ b/EDPlayerJournal/Entries/Entry.cs @@ -39,6 +39,7 @@ public class Entry { { Events.Missions, typeof(MissionsEntry) }, { Events.MultiSellExplorationData, typeof(MultiSellExplorationDataEntry) }, { Events.Music, typeof(MusicEntry) }, + { Events.Powerplay, typeof(PowerplayEntry) }, { Events.ReceiveText, typeof(ReceiveTextEntry) }, { Events.RedeemVoucher, typeof(RedeemVoucherEntry) }, { Events.SearchAndRescue, typeof(SearchAndRescueEntry) }, diff --git a/EDPlayerJournal/Entries/Events.cs b/EDPlayerJournal/Entries/Events.cs index e75e6fd..649eff2 100644 --- a/EDPlayerJournal/Entries/Events.cs +++ b/EDPlayerJournal/Entries/Events.cs @@ -29,6 +29,7 @@ public class Events { public static readonly string Missions = "Missions"; public static readonly string MultiSellExplorationData = "MultiSellExplorationData"; public static readonly string Music = "Music"; + public static readonly string Powerplay = "Powerplay"; public static readonly string ReceiveText = "ReceiveText"; public static readonly string RedeemVoucher = "RedeemVoucher"; public static readonly string SearchAndRescue = "SearchAndRescue"; diff --git a/EDPlayerJournal/Entries/PowerplayEntry.cs b/EDPlayerJournal/Entries/PowerplayEntry.cs new file mode 100644 index 0000000..22d9fc1 --- /dev/null +++ b/EDPlayerJournal/Entries/PowerplayEntry.cs @@ -0,0 +1,32 @@ +using System.Reflection; + +namespace EDPlayerJournal.Entries { + public class PowerplayEntry : Entry { + /// + /// Name of the power + /// + public string Power { get; set; } = string.Empty; + + /// + /// Player rank + /// + public int Rank { get; set; } = 0; + + /// + /// Current merits of the player + /// + public long Merits { get; set; } = 0; + + /// + /// Time pledged (in seconds?) + /// + public long TimePledged { get; set; } = 0; + + protected override void Initialise() { + Power = JSON.Value("Power") ?? string.Empty; + Rank = JSON.Value("Rank") ?? 0; + Merits = JSON.Value("Merits") ?? 0; + TimePledged = JSON.Value("TimePledged") ?? 0; + } + } +}