From 16b579688d7d9e6b2d391ace4539dfccd3172e43 Mon Sep 17 00:00:00 2001 From: Florian Stinglmayr Date: Mon, 29 Jan 2024 19:24:53 +0100 Subject: [PATCH] identify cap ship by its music --- EDPlayerJournal/BGS/Parsers/MusicParser.cs | 17 +++++++++++++++++ EDPlayerJournal/BGS/TransactionParser.cs | 1 + EDPlayerJournal/Entries/Entry.cs | 1 + EDPlayerJournal/Entries/Events.cs | 1 + EDPlayerJournal/Entries/MusicEntry.cs | 9 +++++++++ 5 files changed, 29 insertions(+) create mode 100644 EDPlayerJournal/BGS/Parsers/MusicParser.cs create mode 100644 EDPlayerJournal/Entries/MusicEntry.cs diff --git a/EDPlayerJournal/BGS/Parsers/MusicParser.cs b/EDPlayerJournal/BGS/Parsers/MusicParser.cs new file mode 100644 index 0000000..dcb49a7 --- /dev/null +++ b/EDPlayerJournal/BGS/Parsers/MusicParser.cs @@ -0,0 +1,17 @@ +using EDPlayerJournal.Entries; + +namespace EDPlayerJournal.BGS.Parsers; + +internal class MusicParser : ITransactionParserPart { + public void Parse(Entry entry, TransactionParserContext context, TransactionParserOptions options, TransactionList transactions) { + MusicEntry? entryMusic = (MusicEntry)entry; + + if (entryMusic == null) { + return; + } + + if (string.Compare(entryMusic.MusicTrack, "Combat_CapitalShip") == 0) { + context.HaveSeenCapShip = true; + } + } +} diff --git a/EDPlayerJournal/BGS/TransactionParser.cs b/EDPlayerJournal/BGS/TransactionParser.cs index 027c223..dced6ed 100644 --- a/EDPlayerJournal/BGS/TransactionParser.cs +++ b/EDPlayerJournal/BGS/TransactionParser.cs @@ -684,6 +684,7 @@ public class TransactionParser { { Events.MissionFailed, new MissionFailedParser() }, { Events.Missions, new MissionsParser() }, { Events.MultiSellExplorationData, new MultiSellExplorationDataParser() }, + { Events.Music, new MusicParser() }, { Events.ReceiveText, new ReceiveTextParser() }, { Events.RedeemVoucher, new RedeemVoucherParser() }, { Events.SearchAndRescue, new SearchAndRescueParser() }, diff --git a/EDPlayerJournal/Entries/Entry.cs b/EDPlayerJournal/Entries/Entry.cs index 41d5abc..c4fa681 100644 --- a/EDPlayerJournal/Entries/Entry.cs +++ b/EDPlayerJournal/Entries/Entry.cs @@ -38,6 +38,7 @@ public class Entry { { Events.MissionRedirected, typeof(MissionRedirectedEntry) }, { Events.Missions, typeof(MissionsEntry) }, { Events.MultiSellExplorationData, typeof(MultiSellExplorationDataEntry) }, + { Events.Music, typeof(MusicEntry) }, { 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 5e286a4..d9b2fb6 100644 --- a/EDPlayerJournal/Entries/Events.cs +++ b/EDPlayerJournal/Entries/Events.cs @@ -28,6 +28,7 @@ public class Events { public static readonly string MissionRedirected = "MissionRedirected"; public static readonly string Missions = "Missions"; public static readonly string MultiSellExplorationData = "MultiSellExplorationData"; + public static readonly string Music = "Music"; public static readonly string ReceiveText = "ReceiveText"; public static readonly string RedeemVoucher = "RedeemVoucher"; public static readonly string SearchAndRescue = "SearchAndRescue"; diff --git a/EDPlayerJournal/Entries/MusicEntry.cs b/EDPlayerJournal/Entries/MusicEntry.cs new file mode 100644 index 0000000..05b895f --- /dev/null +++ b/EDPlayerJournal/Entries/MusicEntry.cs @@ -0,0 +1,9 @@ +namespace EDPlayerJournal.Entries; + +public class MusicEntry : Entry { + public string? MusicTrack { get; set; } = null; + + protected override void Initialise() { + MusicTrack = JSON.Value("MusicTrack"); + } +}