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 -1
View File
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<Version>1.20.5</Version> <Version>1.21.0</Version>
<TargetFramework>net8.0-windows</TargetFramework> <TargetFramework>net8.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
+2 -2
View File
@@ -39,7 +39,7 @@ internal sealed unsafe class Chat : IDisposable {
private readonly delegate* unmanaged<void*, int, IntPtr> GetTellHistory = null!; private readonly delegate* unmanaged<void*, int, IntPtr> GetTellHistory = null!;
[Signature("E8 ?? ?? ?? ?? 48 8D 4D 50 E8 ?? ?? ?? ?? 48 8B 17")] [Signature("E8 ?? ?? ?? ?? 48 8D 4D 50 E8 ?? ?? ?? ?? 48 8B 17")]
private readonly delegate* unmanaged<RaptureLogModule*, ushort, Utf8String*, Utf8String*, ulong, ushort, byte, int, byte, void> PrintTell = null!; private readonly delegate* unmanaged<RaptureLogModule*, ushort, Utf8String*, Utf8String*, ulong, ushort, byte, int, byte, void> PrintTellNative = null!;
[Signature("E8 ?? ?? ?? ?? 48 8D 4C 24 ?? E8 ?? ?? ?? ?? 48 8D 8C 24 ?? ?? ?? ?? E8 ?? ?? ?? ?? B0 01")] [Signature("E8 ?? ?? ?? ?? 48 8D 4C 24 ?? E8 ?? ?? ?? ?? 48 8D 8C 24 ?? ?? ?? ?? E8 ?? ?? ?? ?? B0 01")]
private readonly delegate* unmanaged<IntPtr, ulong, ushort, Utf8String*, Utf8String*, byte, ulong, byte> SendTellNative = null!; private readonly delegate* unmanaged<IntPtr, ulong, ushort, Utf8String*, Utf8String*, byte, ulong, byte> SendTellNative = null!;
@@ -747,8 +747,8 @@ internal sealed unsafe class Chat : IDisposable {
var a1 = *(IntPtr*) (networkModule + 8); var a1 = *(IntPtr*) (networkModule + 8);
var logModule = Framework.Instance()->GetUiModule()->GetRaptureLogModule(); var logModule = Framework.Instance()->GetUiModule()->GetRaptureLogModule();
PrintTell(logModule, 33, uName, uMessage, contentId, homeWorld, 255, 0, 0);
SendTellNative(a1, contentId, homeWorld, uName, uMessage, (byte) reason, homeWorld); SendTellNative(a1, contentId, homeWorld, uName, uMessage, (byte) reason, homeWorld);
PrintTellNative(logModule, 33, uName, uMessage, contentId, homeWorld, 255, 0, 0);
uName->Dtor(true); uName->Dtor(true);
uMessage->Dtor(true); uMessage->Dtor(true);
+1
View File
@@ -764,6 +764,7 @@ public sealed class ChatLogWindow : Window, IUiComponent {
var tellBytes = Encoding.UTF8.GetBytes(trimmed); var tellBytes = Encoding.UTF8.GetBytes(trimmed);
AutoTranslate.ReplaceWithPayload(Plugin.DataManager, ref tellBytes); AutoTranslate.ReplaceWithPayload(Plugin.DataManager, ref tellBytes);
Plugin.Functions.Chat.SendTell(reason, target.ContentId, target.Name, (ushort) world.RowId, tellBytes); Plugin.Functions.Chat.SendTell(reason, target.ContentId, target.Name, (ushort) world.RowId, tellBytes);
} }
+22 -6
View File
@@ -1,6 +1,7 @@
using System.Numerics; using System.Numerics;
using System.Text; using System.Text;
using ChatTwo.Util; using ChatTwo.Util;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Game.Text.SeStringHandling.Payloads; using Dalamud.Game.Text.SeStringHandling.Payloads;
using Dalamud.Interface.Windowing; using Dalamud.Interface.Windowing;
using ImGuiNET; using ImGuiNET;
@@ -40,9 +41,6 @@ public class SeStringDebugger : Window
public override void Draw() public override void Draw()
{ {
ImGui.TextUnformatted("SeString Content");
ImGui.Spacing();
if (Plugin.Store.LastMessage.Sender == null) if (Plugin.Store.LastMessage.Sender == null)
{ {
ImGui.TextUnformatted("Nothing to show"); ImGui.TextUnformatted("Nothing to show");
@@ -50,7 +48,24 @@ public class SeStringDebugger : Window
} }
// TODO: Make SeString freely selectable through chat // 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) switch (payload)
{ {
@@ -112,9 +127,10 @@ public class SeStringDebugger : Window
{ {
RenderMetadataDictionary("Link PlayerPayload", new Dictionary<string, string?> RenderMetadataDictionary("Link PlayerPayload", new Dictionary<string, string?>
{ {
{ "Real", player.DisplayedName }, { "Displayed", player.DisplayedName },
{ "Player Name", player.PlayerName }, { "Player Name", player.PlayerName },
{ "World.Name", player.World.Name }, { "World Name", player.World.Name },
{ "Data", string.Join(" ", player.Encode().Select(b => b.ToString("X2"))) },
}); });
break; break;
} }