diff --git a/HellionChat/GameFunctions/Chat.cs b/HellionChat/GameFunctions/Chat.cs index a4e77f1..0ad0a74 100755 --- a/HellionChat/GameFunctions/Chat.cs +++ b/HellionChat/GameFunctions/Chat.cs @@ -317,6 +317,30 @@ internal sealed unsafe class Chat : IDisposable ReplyInSelectedChatModeHook!.Original(agent); } + // Pure /tell-prefill command builder, shared by the two native SetTellTarget + // detours and the PayloadHandler Send-Tell payload. Empty/null world drops the + // @World suffix (matches the old IsNullOrEmpty guard); trailing space lets the + // user type straight after. internal static so the Build-Suite can pin it + // frame-free. TEST-MIRROR: ../../../Hellion Build test/GameFunctions/PrefillTellCommandTests.cs + internal static string BuildTellCommand(string name, string? world) + { + var command = $"/tell {name}"; + if (!string.IsNullOrEmpty(world)) + command += $"@{world}"; + command += " "; + return command; + } + + // Prefills + focuses our own input bar with a /tell command. The DI/Dalamud + // vorspann (Plugin.InputBar) lives here; the string assembly is BuildTellCommand. + // The in-foray TellSpecial routing (SetEurekaTellChannel) is NOT this helper's + // job — it stays at the call-site (v1.8.1 deferral). + private void PrefillTellInput(string name, string? world) + { + Plugin.InputBar.SetPendingMessage(BuildTellCommand(name, world)); + Plugin.InputBar.Activate = true; + } + private bool SetContextTellTarget( RaptureShellModule* a1, Utf8String* playerName, @@ -334,14 +358,10 @@ internal sealed unsafe class Chat : IDisposable // "Send Tell" payload menu does (PayloadHandler), then focus. Prefill- // only — no tab switch, no ChatActivatedArgs revival (Flo decision // 2026-06-15). The game supplies worldName here, so no sheet lookup. - var tellName = playerName->ToString(); - var tellWorld = worldName != null ? worldName->ToString() : string.Empty; - var tellCommand = $"/tell {tellName}"; - if (!string.IsNullOrEmpty(tellWorld)) - tellCommand += $"@{tellWorld}"; - tellCommand += " "; - Plugin.InputBar.SetPendingMessage(tellCommand); - Plugin.InputBar.Activate = true; + PrefillTellInput( + playerName->ToString(), + worldName != null ? worldName->ToString() : null + ); } return SetChatLogTellTargetHook!.Original( @@ -374,14 +394,10 @@ internal sealed unsafe class Chat : IDisposable // In-foray right-click -> Send Tell: same prefill path as the non-foray // tell. The foray-specific TellSpecial channel routing stays deferred // (v1.8.1, SetEurekaTellChannel) — prefill-only here (Flo decision 2026-06-15). - var forayName = playerName->ToString(); - var forayWorld = worldName != null ? worldName->ToString() : string.Empty; - var forayCommand = $"/tell {forayName}"; - if (!string.IsNullOrEmpty(forayWorld)) - forayCommand += $"@{forayWorld}"; - forayCommand += " "; - Plugin.InputBar.SetPendingMessage(forayCommand); - Plugin.InputBar.Activate = true; + PrefillTellInput( + playerName->ToString(), + worldName != null ? worldName->ToString() : null + ); } ContextMenuTellInForayHook!.Original(