From 61af62ec7645a803cc5b787b46a1b9572af60599 Mon Sep 17 00:00:00 2001 From: Infi Date: Mon, 18 Nov 2024 04:08:06 +0100 Subject: [PATCH] Fix error from wrong conversion method --- Dalamud/Game/Gui/ChatGui.cs | 15 +++++++++++++-- Dalamud/Game/Text/XivChatEntry.cs | 21 ++++++--------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Dalamud/Game/Gui/ChatGui.cs b/Dalamud/Game/Gui/ChatGui.cs index 34c21d303..ad9c8705b 100644 --- a/Dalamud/Game/Gui/ChatGui.cs +++ b/Dalamud/Game/Gui/ChatGui.cs @@ -112,7 +112,14 @@ void IInternalDisposableService.DisposeService() /// public void Print(XivChatEntry chat) { - this.chatQueue.Enqueue(new XivChatEntryRaw(chat.Name.Encode(), chat.Message.Encode(), chat.Type, chat.Timestamp, chat.Silent)); + this.chatQueue.Enqueue(new XivChatEntryRaw + { + Type = chat.Type, + Timestamp = chat.Timestamp, + Message = chat.Message.Encode(), + Name = chat.Name.Encode(), + Silent = chat.Silent, + }); } #region DalamudSeString @@ -310,7 +317,11 @@ private void PrintTagged(ReadOnlySpan message, XivChatType channel, string } } - this.Print(new XivChatEntryRaw(builder.Append(message).ToArray(), type: channel)); + this.Print(new XivChatEntryRaw + { + Message = builder.Append((ReadOnlySeStringSpan)message).ToArray(), + Type = channel, + }); } private void InventoryItemCopyDetour(InventoryItem* thisPtr, InventoryItem* otherPtr) diff --git a/Dalamud/Game/Text/XivChatEntry.cs b/Dalamud/Game/Text/XivChatEntry.cs index 21cd1ce45..343f15d3f 100644 --- a/Dalamud/Game/Text/XivChatEntry.cs +++ b/Dalamud/Game/Text/XivChatEntry.cs @@ -36,39 +36,30 @@ public sealed class XivChatEntry /// /// This class represents a raw chat message. /// -public struct XivChatEntryRaw +public struct XivChatEntryRaw() { /// /// Gets the type of entry. /// - public XivChatType? Type { get; } + public XivChatType? Type { get; set; } /// /// Gets the message timestamp. /// - public int Timestamp { get; } + public int Timestamp { get; set; } /// /// Gets the sender name. /// - public byte[] Name { get; } + public byte[] Name { get; set; } = []; /// /// Gets the message. /// - public byte[] Message { get; } + public byte[] Message { get; set; } = []; /// /// Gets a value indicating whether new message sounds should be silenced or not. /// - public bool Silent { get; } - - public XivChatEntryRaw(byte[] message, byte[]? name = null, XivChatType? type = null, int timestamp = 0, bool silent = false) - { - this.Type = type; - this.Timestamp = timestamp; - this.Name = name ?? []; - this.Message = message; - this.Silent = silent; - } + public bool Silent { get; set; } }