diff --git a/Dalamud/Game/Text/SeStringHandling/SeString.cs b/Dalamud/Game/Text/SeStringHandling/SeString.cs index 4a04f0326..03e6e1078 100644 --- a/Dalamud/Game/Text/SeStringHandling/SeString.cs +++ b/Dalamud/Game/Text/SeStringHandling/SeString.cs @@ -492,6 +492,26 @@ public class SeString return messageBytes.ToArray(); } + /// + /// Encodes the Payloads in this SeString into a binary representation + /// suitable for use by in-game handlers, such as the chat log. + /// Includes a null terminator at the end of the string. + /// + /// The binary encoded payload data. + public byte[] EncodeWithNullTerminator() + { + var messageBytes = new List(); + foreach (var p in this.Payloads) + { + messageBytes.AddRange(p.Encode()); + } + + // Add Null Terminator + messageBytes.Add(0); + + return messageBytes.ToArray(); + } + /// /// Get the text value of this SeString. ///