identify cap ship by its music

This commit is contained in:
Florian Stinglmayr 2024-01-29 19:24:53 +01:00
parent 9994a45d06
commit 16b579688d
5 changed files with 29 additions and 0 deletions

View File

@ -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;
}
}
}

View File

@ -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() },

View File

@ -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) },

View File

@ -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";

View File

@ -0,0 +1,9 @@
namespace EDPlayerJournal.Entries;
public class MusicEntry : Entry {
public string? MusicTrack { get; set; } = null;
protected override void Initialise() {
MusicTrack = JSON.Value<string?>("MusicTrack");
}
}