add receive text entry
This commit is contained in:
parent
8dea9fd094
commit
43ae93658f
@ -35,6 +35,7 @@ public class Entry {
|
||||
{ Events.MissionRedirected, typeof(MissionRedirectedEntry) },
|
||||
{ Events.Missions, typeof(MissionsEntry) },
|
||||
{ Events.MultiSellExplorationData, typeof(MultiSellExplorationDataEntry) },
|
||||
{ Events.ReceiveText, typeof(ReceiveTextEntry) },
|
||||
{ Events.RedeemVoucher, typeof(RedeemVoucherEntry) },
|
||||
{ Events.SearchAndRescue, typeof(SearchAndRescueEntry) },
|
||||
{ Events.SellExplorationData, typeof(SellExplorationDataEntry) },
|
||||
|
@ -25,6 +25,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 ReceiveText = "ReceiveText";
|
||||
public static readonly string RedeemVoucher = "RedeemVoucher";
|
||||
public static readonly string SearchAndRescue = "SearchAndRescue";
|
||||
public static readonly string SellExplorationData = "SellExplorationData";
|
||||
|
77
EDPlayerJournal/Entries/ReceiveTextEntry.cs
Normal file
77
EDPlayerJournal/Entries/ReceiveTextEntry.cs
Normal 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");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user