diff --git a/Dalamud/Game/Chat/SeStringHandling/Payloads/AutoTranslatePayload.cs b/Dalamud/Game/Chat/SeStringHandling/Payloads/AutoTranslatePayload.cs index c01ed0ee2..98c7ff6b8 100644 --- a/Dalamud/Game/Chat/SeStringHandling/Payloads/AutoTranslatePayload.cs +++ b/Dalamud/Game/Chat/SeStringHandling/Payloads/AutoTranslatePayload.cs @@ -6,6 +6,7 @@ using System.IO; using System.Linq; using Dalamud.Data; using Dalamud.Data.TransientSheet; +using Newtonsoft.Json; namespace Dalamud.Game.Chat.SeStringHandling.Payloads { @@ -34,7 +35,10 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads } } + [JsonProperty] private uint group; + + [JsonProperty] private uint key; internal AutoTranslatePayload() { } diff --git a/Dalamud/Game/Chat/SeStringHandling/Payloads/ItemPayload.cs b/Dalamud/Game/Chat/SeStringHandling/Payloads/ItemPayload.cs index 265b8d088..d2a609fd8 100644 --- a/Dalamud/Game/Chat/SeStringHandling/Payloads/ItemPayload.cs +++ b/Dalamud/Game/Chat/SeStringHandling/Payloads/ItemPayload.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Text; using Dalamud.Data; using Lumina.Excel.GeneratedSheets; +using Newtonsoft.Json; namespace Dalamud.Game.Chat.SeStringHandling.Payloads { @@ -22,6 +23,7 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads /// /// Value is evaluated lazily and cached. /// + [JsonIgnore] public Item Item { get @@ -59,6 +61,7 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads /// public bool IsHQ { get; private set; } = false; + [JsonProperty] private uint itemId; internal ItemPayload() { } diff --git a/Dalamud/Game/Chat/SeStringHandling/Payloads/MapLinkPayload.cs b/Dalamud/Game/Chat/SeStringHandling/Payloads/MapLinkPayload.cs index 768d95716..ce547691d 100644 --- a/Dalamud/Game/Chat/SeStringHandling/Payloads/MapLinkPayload.cs +++ b/Dalamud/Game/Chat/SeStringHandling/Payloads/MapLinkPayload.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.IO; using Dalamud.Data; +using Newtonsoft.Json; namespace Dalamud.Game.Chat.SeStringHandling.Payloads { @@ -20,6 +21,7 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads /// /// Value is evaluated lazily and cached. /// + [JsonIgnore] public Map Map { get @@ -36,6 +38,7 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads /// /// Value is evaluated lazily and cached. /// + [JsonIgnore] public TerritoryType TerritoryType { get @@ -70,6 +73,7 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads /// /// The readable y-coordinate position for this map link. This value is approximate and unrounded. /// + [JsonIgnore] public float YCoord { get @@ -82,6 +86,7 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads /// The printable map coordinates for this link. This value tries to match the in-game printable text as closely as possible /// but is an approximation and may be slightly off for some positions. /// + [JsonIgnore] public string CoordinateString { get @@ -102,6 +107,7 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads /// /// The region name for this map link. This corresponds to the upper zone name found in the actual in-game map UI. eg, "La Noscea" /// + [JsonIgnore] public string PlaceNameRegion { get @@ -115,6 +121,7 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads /// /// The place name for this map link. This corresponds to the lower zone name found in the actual in-game map UI. eg, "Limsa Lominsa Upper Decks" /// + [JsonIgnore] public string PlaceName { get @@ -129,7 +136,10 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads /// public string DataString => $"m:{TerritoryType.RowId},{Map.RowId},{RawX},{RawY}"; + [JsonProperty] private uint territoryTypeId; + + [JsonProperty] private uint mapId; // there is no Z; it's purely in the text payload where applicable diff --git a/Dalamud/Game/Chat/SeStringHandling/Payloads/PlayerPayload.cs b/Dalamud/Game/Chat/SeStringHandling/Payloads/PlayerPayload.cs index 64ddcb374..1cfe9bfa8 100644 --- a/Dalamud/Game/Chat/SeStringHandling/Payloads/PlayerPayload.cs +++ b/Dalamud/Game/Chat/SeStringHandling/Payloads/PlayerPayload.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.IO; using System.Text; using Dalamud.Data; +using Newtonsoft.Json; namespace Dalamud.Game.Chat.SeStringHandling.Payloads { @@ -14,10 +15,12 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads { public override PayloadType Type => PayloadType.Player; + [JsonProperty] private string playerName; /// /// The player's displayed name. This does not contain the server name. /// + [JsonIgnore] public string PlayerName { get { return this.playerName; } @@ -35,6 +38,7 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads /// /// Value is evaluated lazily and cached. /// + [JsonIgnore] public World World { get @@ -48,8 +52,10 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads /// A text representation of this player link matching how it might appear in-game. /// The world name will always be present. /// + [JsonIgnore] public string DisplayedName => $"{PlayerName}{(char)SeIconChar.CrossWorld}{World.Name}"; + [JsonProperty] private uint serverId; internal PlayerPayload() { } diff --git a/Dalamud/Game/Chat/SeStringHandling/Payloads/RawPayload.cs b/Dalamud/Game/Chat/SeStringHandling/Payloads/RawPayload.cs index 301bde07e..a2438d32a 100644 --- a/Dalamud/Game/Chat/SeStringHandling/Payloads/RawPayload.cs +++ b/Dalamud/Game/Chat/SeStringHandling/Payloads/RawPayload.cs @@ -1,3 +1,4 @@ +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.IO; @@ -20,6 +21,7 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads public override PayloadType Type => PayloadType.Unknown; + [JsonProperty] private byte[] data; // this is a bit different from the underlying data // We need to store just the chunk data for decode to behave nicely, but when reading data out @@ -28,6 +30,7 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads /// The entire payload byte sequence for this payload. /// The returned data is a clone and modifications will not be persisted. /// + [JsonIgnore] public byte[] Data { get @@ -38,8 +41,10 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads } } + [JsonProperty] private byte chunkType; + [JsonConstructor] internal RawPayload(byte chunkType) { this.chunkType = chunkType; diff --git a/Dalamud/Game/Chat/SeStringHandling/Payloads/StatusPayload.cs b/Dalamud/Game/Chat/SeStringHandling/Payloads/StatusPayload.cs index a82438fc0..11e90c3e3 100644 --- a/Dalamud/Game/Chat/SeStringHandling/Payloads/StatusPayload.cs +++ b/Dalamud/Game/Chat/SeStringHandling/Payloads/StatusPayload.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.IO; using Dalamud.Data; +using Newtonsoft.Json; namespace Dalamud.Game.Chat.SeStringHandling.Payloads { @@ -20,6 +21,7 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads /// /// Value is evaluated lazily and cached. /// + [JsonIgnore] public Status Status { get @@ -29,6 +31,7 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads } } + [JsonProperty] private uint statusId; internal StatusPayload() { } diff --git a/Dalamud/Game/Chat/SeStringHandling/Payloads/TextPayload.cs b/Dalamud/Game/Chat/SeStringHandling/Payloads/TextPayload.cs index be2f5c13e..6c5ec22cc 100644 --- a/Dalamud/Game/Chat/SeStringHandling/Payloads/TextPayload.cs +++ b/Dalamud/Game/Chat/SeStringHandling/Payloads/TextPayload.cs @@ -1,3 +1,4 @@ +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.IO; @@ -13,11 +14,13 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads public override PayloadType Type => PayloadType.RawText; // allow modifying the text of existing payloads on the fly + [JsonProperty] private string text; /// /// The text contained in this payload. /// This may contain SE's special unicode characters. /// + [JsonIgnore] public string Text { get { return this.text; } diff --git a/Dalamud/Game/Chat/SeStringHandling/Payloads/UIForegroundPayload.cs b/Dalamud/Game/Chat/SeStringHandling/Payloads/UIForegroundPayload.cs index 2fede7f94..d25c0e033 100644 --- a/Dalamud/Game/Chat/SeStringHandling/Payloads/UIForegroundPayload.cs +++ b/Dalamud/Game/Chat/SeStringHandling/Payloads/UIForegroundPayload.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.IO; using Dalamud.Data; +using Newtonsoft.Json; namespace Dalamud.Game.Chat.SeStringHandling.Payloads { @@ -31,6 +32,7 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads /// /// Value is evaluated lazily and cached. /// + [JsonIgnore] public UIColor UIColor { get @@ -43,6 +45,7 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads /// /// The color key used as a lookup in the UIColor table for this foreground color. /// + [JsonIgnore] public ushort ColorKey { get { return this.colorKey; } @@ -57,6 +60,7 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads /// /// The Red/Green/Blue values for this foreground color, encoded as a typical hex color. /// + [JsonIgnore] public uint RGB { get @@ -65,6 +69,7 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads } } + [JsonProperty] private ushort colorKey; internal UIForegroundPayload() { } diff --git a/Dalamud/Game/Chat/SeStringHandling/Payloads/UIGlowPayload.cs b/Dalamud/Game/Chat/SeStringHandling/Payloads/UIGlowPayload.cs index d82d249f3..655e3c01e 100644 --- a/Dalamud/Game/Chat/SeStringHandling/Payloads/UIGlowPayload.cs +++ b/Dalamud/Game/Chat/SeStringHandling/Payloads/UIGlowPayload.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.IO; using Dalamud.Data; +using Newtonsoft.Json; namespace Dalamud.Game.Chat.SeStringHandling.Payloads { @@ -31,6 +32,7 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads /// /// Value is evaluated lazily and cached. /// + [JsonIgnore] public UIColor UIColor { get @@ -43,6 +45,7 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads /// /// The color key used as a lookup in the UIColor table for this glow color. /// + [JsonIgnore] public ushort ColorKey { get { return this.colorKey; } @@ -57,6 +60,7 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads /// /// The Red/Green/Blue values for this glow color, encoded as a typical hex color. /// + [JsonIgnore] public uint RGB { get @@ -65,6 +69,7 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads } } + [JsonProperty] private ushort colorKey; internal UIGlowPayload() { } diff --git a/Dalamud/Game/Chat/SeStringHandling/SeString.cs b/Dalamud/Game/Chat/SeStringHandling/SeString.cs index a7c954fab..8aa94726a 100644 --- a/Dalamud/Game/Chat/SeStringHandling/SeString.cs +++ b/Dalamud/Game/Chat/SeStringHandling/SeString.cs @@ -4,6 +4,7 @@ using System.IO; using System.Linq; using System.Text; using Dalamud.Game.Chat.SeStringHandling.Payloads; +using Newtonsoft.Json; namespace Dalamud.Game.Chat.SeStringHandling { @@ -38,6 +39,7 @@ namespace Dalamud.Game.Chat.SeStringHandling /// Creates a new SeString from an ordered list of payloads. /// /// The Payload objects to make up this string. + [JsonConstructor] public SeString(List payloads) { Payloads = payloads;