- Check auto translation for commands and execute them instead of sending

- Plugin commands trigger the command helper window now
- Fix auto translation with empty text appearing
- Switch up all dalamud payload usage to ROSS if possible
- Prepare 7.5 changes
- Cleanup
This commit is contained in:
Infi
2026-04-08 21:15:28 +02:00
parent 9f7a6267f6
commit c424311b24
52 changed files with 614 additions and 423 deletions
+8 -14
View File
@@ -478,12 +478,20 @@ internal sealed unsafe class Chat : IDisposable
internal void SendTell(TellReason reason, ulong contentId, string name, ushort homeWorld, byte[] message, string rawText)
{
if (contentId == 0)
{
Plugin.ChatGui.PrintError(Language.Chat_SendTell_Error);
Plugin.Log.Warning("Tried to send a tell with ContentId being 0, sorry this is an internal error.");
return;
}
var uName = Utf8String.FromString(name);
var uMessage = Utf8String.FromSequence(message);
var encoded = Utf8String.FromUtf8String(PronounModule.Instance()->ProcessString(uMessage, true));
var decoded = EncodeMessage(rawText);
AutoTranslate.ReplaceWithPayload(ref decoded);
using var decodedUtf8String = new Utf8String(decoded);
var logModule = RaptureLogModule.Instance();
@@ -493,25 +501,11 @@ internal sealed unsafe class Chat : IDisposable
if (reason == TellReason.Direct)
reason = TellReason.Friend;
if (contentId == 0)
{
encoded->Dtor(true);
uName->Dtor(true);
uMessage->Dtor(true);
Plugin.Log.Warning("Tried to send a tell with content id being 0");
return;
}
var ok = SendTellNative(networkModule, contentId, homeWorld, uName, encoded, (ushort) reason, homeWorld);
if (ok == 1)
{
PrintTellNative(logModule, 33, uName, &decodedUtf8String, 0, contentId, homeWorld, 255, 0, 0);
}
else
{
Plugin.ChatGui.PrintError(Language.Chat_SendTell_Error);
}
encoded->Dtor(true);
uName->Dtor(true);
-1
View File
@@ -4,7 +4,6 @@ using FFXIVClientStructs.FFXIV.Client.UI;
namespace ChatTwo.GameFunctions;
// From: https://git.anna.lgbt/anna/XivCommon/src/branch/main/XivCommon/Functions/Chat.cs
public unsafe class ChatBox
{
public static void SendMessageUnsafe(byte[] message)
+2 -2
View File
@@ -15,7 +15,7 @@ internal sealed unsafe class Context
internal static void TryOn(uint itemId, byte stainId)
{
AgentTryon.TryOn(0xFF, itemId, stainId, 0, 0);
AgentTryon.TryOn(0xFF, itemId, stainId);
}
internal static void LinkItem(uint itemId)
@@ -40,6 +40,6 @@ internal sealed unsafe class Context
internal static void SearchForItem(uint itemId)
{
ItemFinderModule.Instance()->SearchForItem(itemId, true);
ItemFinderModule.Instance()->SearchForItem(itemId);
}
}
+3 -6
View File
@@ -2,7 +2,6 @@ using System.Globalization;
using System.Runtime.InteropServices;
using Dalamud.Game.ClientState.Conditions;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Game.Text.SeStringHandling.Payloads;
using Dalamud.Hooking;
using Dalamud.Memory;
using Dalamud.Utility;
@@ -15,7 +14,6 @@ using FFXIVClientStructs.FFXIV.Client.UI.Info;
using FFXIVClientStructs.FFXIV.Component.GUI;
using Lumina.Excel;
using Lumina.Excel.Sheets;
using ValueType = FFXIVClientStructs.FFXIV.Component.GUI.ValueType;
namespace ChatTwo.GameFunctions;
@@ -75,10 +73,9 @@ internal unsafe class GameFunctions : IDisposable
private void ListCommand(string name, ushort world, string commandName)
{
var row = Plugin.DataManager.GetExcelSheet<World>().GetRow(world);
var worldRow = Sheets.WorldSheet.GetRow(world);
var worldName = row.Name.ExtractText();
ReplacementName = $"{name}@{worldName}";
ReplacementName = $"{name}@{worldRow.Name.ToString()}";
ChatBox.SendMessage($"/{commandName} add {Placeholder}");
}
@@ -191,7 +188,7 @@ internal unsafe class GameFunctions : IDisposable
internal static void OpenQuestLog(RowRef<Quest> quest)
{
var splits = quest.Value.Id.ExtractText().Split("_");
var splits = quest.Value.Id.ToString().Split("_");
if (splits.Length != 2)
{
Plugin.ChatGui.Print("QuestId is wrongly formatted");
+1 -1
View File
@@ -17,6 +17,6 @@ internal sealed class TellTarget
public bool IsSet() => Name.Length > 0 && World > 0;
public string ToWorldString() => Sheets.WorldSheet.TryGetRow(World, out var worldRow) ? worldRow.Name.ExtractText() : string.Empty;
public string ToWorldString() => Sheets.WorldSheet.TryGetRow(World, out var worldRow) ? worldRow.Name.ToString() : string.Empty;
public string ToTargetString() => $"{Name}@{ToWorldString()}";
}