add receive text entry

This commit is contained in:
Florian Stinglmayr 2022-12-07 16:06:07 +01:00
parent 8dea9fd094
commit 43ae93658f
3 changed files with 79 additions and 0 deletions

View File

@ -35,6 +35,7 @@ public class Entry {
{ Events.MissionRedirected, typeof(MissionRedirectedEntry) }, { Events.MissionRedirected, typeof(MissionRedirectedEntry) },
{ Events.Missions, typeof(MissionsEntry) }, { Events.Missions, typeof(MissionsEntry) },
{ Events.MultiSellExplorationData, typeof(MultiSellExplorationDataEntry) }, { Events.MultiSellExplorationData, typeof(MultiSellExplorationDataEntry) },
{ Events.ReceiveText, typeof(ReceiveTextEntry) },
{ Events.RedeemVoucher, typeof(RedeemVoucherEntry) }, { Events.RedeemVoucher, typeof(RedeemVoucherEntry) },
{ Events.SearchAndRescue, typeof(SearchAndRescueEntry) }, { Events.SearchAndRescue, typeof(SearchAndRescueEntry) },
{ Events.SellExplorationData, typeof(SellExplorationDataEntry) }, { Events.SellExplorationData, typeof(SellExplorationDataEntry) },

View File

@ -25,6 +25,7 @@ public class Events {
public static readonly string MissionRedirected = "MissionRedirected"; public static readonly string MissionRedirected = "MissionRedirected";
public static readonly string Missions = "Missions"; public static readonly string Missions = "Missions";
public static readonly string MultiSellExplorationData = "MultiSellExplorationData"; public static readonly string MultiSellExplorationData = "MultiSellExplorationData";
public static readonly string ReceiveText = "ReceiveText";
public static readonly string RedeemVoucher = "RedeemVoucher"; public static readonly string RedeemVoucher = "RedeemVoucher";
public static readonly string SearchAndRescue = "SearchAndRescue"; public static readonly string SearchAndRescue = "SearchAndRescue";
public static readonly string SellExplorationData = "SellExplorationData"; public static readonly string SellExplorationData = "SellExplorationData";

View File

@ -0,0 +1,77 @@
namespace EDPlayerJournal.Entries;
public class ReceiveTextEntry : Entry {
/// <summary>
/// From whom this message is
/// </summary>
public string? From { get; set; }
/// <summary>
/// The message, if it is just an NPC text, it will be a message ID
/// </summary>
public string? Message { get; set; }
/// <summary>
/// Message localised
/// </summary>
public string? MessageLocalised { get; set; }
/// <summary>
/// On what channel this was received.
/// </summary>
public string? Channel { get; set; }
public bool HasNPCCategory {
get {
if (From == null) {
return false;
}
if (From.Contains(';') && From.StartsWith("$")) {
return true;
}
return false;
}
}
/// <summary>
/// Returns the NPC's category, if it has one.
/// </summary>
public string? NPCCategory {
get {
if (!HasNPCCategory || From == null) {
return null;
}
string[] parts = From.Split(";", StringSplitOptions.TrimEntries);
if (parts.Length < 2) {
return null;
}
return parts[0];
}
}
/// <summary>
/// Returns the NPC's category, if it has one.
/// </summary>
public string? NPCName {
get {
if (!HasNPCCategory || From == null) {
return null;
}
string[] parts = From.Split(";", StringSplitOptions.TrimEntries);
if (parts.Length < 2) {
return null;
}
return parts[1];
}
}
protected override void Initialise() {
From = JSON.Value<string>("From");
Message = JSON.Value<string>("Message");
MessageLocalised = JSON.Value<string>("Message_localised");
Channel = JSON.Value<string>("Channel");
}
}