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