Skip to content

Commit

Permalink
Fix error from wrong conversion method
Browse files Browse the repository at this point in the history
  • Loading branch information
Infiziert90 committed Nov 18, 2024
1 parent 1873678 commit 61af62e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
15 changes: 13 additions & 2 deletions Dalamud/Game/Gui/ChatGui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,14 @@ void IInternalDisposableService.DisposeService()
/// <inheritdoc/>
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
Expand Down Expand Up @@ -310,7 +317,11 @@ private void PrintTagged(ReadOnlySpan<byte> 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)
Expand Down
21 changes: 6 additions & 15 deletions Dalamud/Game/Text/XivChatEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,39 +36,30 @@ public sealed class XivChatEntry
/// <summary>
/// This class represents a raw chat message.
/// </summary>
public struct XivChatEntryRaw
public struct XivChatEntryRaw()
{
/// <summary>
/// Gets the type of entry.
/// </summary>
public XivChatType? Type { get; }
public XivChatType? Type { get; set; }

/// <summary>
/// Gets the message timestamp.
/// </summary>
public int Timestamp { get; }
public int Timestamp { get; set; }

/// <summary>
/// Gets the sender name.
/// </summary>
public byte[] Name { get; }
public byte[] Name { get; set; } = [];

/// <summary>
/// Gets the message.
/// </summary>
public byte[] Message { get; }
public byte[] Message { get; set; } = [];

/// <summary>
/// Gets a value indicating whether new message sounds should be silenced or not.
/// </summary>
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; }
}

0 comments on commit 61af62e

Please sign in to comment.