Fix chat alerts breaking tell messages

This commit is contained in:
Infi
2024-04-14 20:37:01 +02:00
parent 1a2b313598
commit 5f7199773a
4 changed files with 27 additions and 10 deletions
+1
View File
@@ -764,6 +764,7 @@ public sealed class ChatLogWindow : Window, IUiComponent {
var tellBytes = Encoding.UTF8.GetBytes(trimmed);
AutoTranslate.ReplaceWithPayload(Plugin.DataManager, ref tellBytes);
Plugin.Functions.Chat.SendTell(reason, target.ContentId, target.Name, (ushort) world.RowId, tellBytes);
}
+23 -7
View File
@@ -1,6 +1,7 @@
using System.Numerics;
using System.Text;
using ChatTwo.Util;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Game.Text.SeStringHandling.Payloads;
using Dalamud.Interface.Windowing;
using ImGuiNET;
@@ -40,9 +41,6 @@ public class SeStringDebugger : Window
public override void Draw()
{
ImGui.TextUnformatted("SeString Content");
ImGui.Spacing();
if (Plugin.Store.LastMessage.Sender == null)
{
ImGui.TextUnformatted("Nothing to show");
@@ -50,7 +48,24 @@ public class SeStringDebugger : Window
}
// TODO: Make SeString freely selectable through chat
foreach (var payload in Plugin.Store.LastMessage.Sender.Payloads)
ImGui.TextUnformatted("Sender Content");
ImGui.Spacing();
if (Plugin.Store.LastMessage.Sender != null)
ProcessPayloads(Plugin.Store.LastMessage.Sender.Payloads);
else
ImGui.TextUnformatted("Nothing to show");
ImGui.TextUnformatted("Message Content");
ImGui.Spacing();
if (Plugin.Store.LastMessage.Message != null)
ProcessPayloads(Plugin.Store.LastMessage.Message.Payloads);
else
ImGui.TextUnformatted("Nothing to show");
}
private static void ProcessPayloads(List<Payload> payloads)
{
foreach (var payload in payloads)
{
switch (payload)
{
@@ -112,9 +127,10 @@ public class SeStringDebugger : Window
{
RenderMetadataDictionary("Link PlayerPayload", new Dictionary<string, string?>
{
{ "Real", player.DisplayedName },
{ "PlayerName", player.PlayerName },
{ "World.Name", player.World.Name },
{ "Displayed", player.DisplayedName },
{ "Player Name", player.PlayerName },
{ "World Name", player.World.Name },
{ "Data", string.Join(" ", player.Encode().Select(b => b.ToString("X2"))) },
});
break;
}