From 2067a54467d8deea9056f787158fedbd97abea1b Mon Sep 17 00:00:00 2001 From: Jon Kazama Date: Wed, 27 May 2026 09:58:22 +0200 Subject: [PATCH] feat(payload-handler): add skeleton with 7-param ctor + Draw() popup tick MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaces the 15-LOC C2 forward-stub with the full PayloadHandler skeleton. Class header flips to `internal sealed` per §4.1; ctor takes 7 DI-registered services (ThemeRegistry, IpcManager, GameFunctions, InputBar, MainWindow, ChunkRenderer, ILogger) per Flo decision 2026-05-27 (ChunkRenderer was added to the ctor list to satisfy the §4.2 _chunkRenderer.DrawChunks references in HoverStatus/HoverItem/ DrawItemPopup paths — those land in E2-E5). Draw() per-frame popup tick is a 1:1 port from v1.5.6 PayloadHandler. DrawPopups() call is stubbed as TODO(E2) since that method lands in E2. Hover/Click signatures remain empty (E5 fills the bodies, but the signatures must compile so ChunkRenderer + ImGuiUtil callers stay live). Skeleton-only — DrawPopups/Integrations (E2), DrawPlayerPopup (E3), DrawItemPopup/DrawStatusPopup (E4), Hover/Click bodies (E5), MoveTooltip (E6) all defer to their respective sub-sub-tasks. --- HellionChat/PayloadHandler.cs | 63 +++++++++++++++++++++++++++++++---- 1 file changed, 57 insertions(+), 6 deletions(-) diff --git a/HellionChat/PayloadHandler.cs b/HellionChat/PayloadHandler.cs index dfb1bba..aebf615 100644 --- a/HellionChat/PayloadHandler.cs +++ b/HellionChat/PayloadHandler.cs @@ -1,15 +1,66 @@ using Dalamud.Bindings.ImGui; using Dalamud.Game.Text.SeStringHandling; +using HellionChat.Themes; +using HellionChat.Ui.Components; +using HellionChat.Ui.Windows; +using Microsoft.Extensions.Logging; namespace HellionChat; -// TODO(E): full PayloadHandler implementation — click/hover routing, tooltip -// positioning, party-finder and URI handling. This forward-stub exists only to -// satisfy the DrawChunks/DrawChunk and ImGuiUtil.PostPayload signatures while -// Sub-Task E is pending. -public sealed class PayloadHandler +internal sealed class PayloadHandler { + private const string PopupId = "hellionchat-context-popup"; + + private readonly ThemeRegistry _themes; + private readonly IpcManager _ipc; + private readonly GameFunctions.GameFunctions _functions; + private readonly InputBar _inputBar; + private readonly MainWindow _mainWindow; + private readonly ChunkRenderer _chunkRenderer; + private readonly ILogger _logger; + + public bool HandleTooltips; + public uint HoveredItem; + public uint HoverCounter; + public uint LastHoverCounter; + +#pragma warning disable CS0169 // used in DrawPopups (E2) + private (Chunk, Payload?)? _popup; +#pragma warning restore CS0169 + + public PayloadHandler( + ThemeRegistry themes, + IpcManager ipc, + GameFunctions.GameFunctions functions, + InputBar inputBar, + MainWindow mainWindow, + ChunkRenderer chunkRenderer, + ILogger logger + ) + { + _themes = themes; + _ipc = ipc; + _functions = functions; + _inputBar = inputBar; + _mainWindow = mainWindow; + _chunkRenderer = chunkRenderer; + _logger = logger; + } + + internal void Draw() + { + // TODO(E2): DrawPopups(); + + if (HandleTooltips && ++HoverCounter - LastHoverCounter > 1) + { + GameFunctions.GameFunctions.CloseItemTooltip(); + HoveredItem = 0; + HoverCounter = LastHoverCounter = 0; + HandleTooltips = false; + } + } + internal void Hover(Payload payload) { } - internal void Click(Chunk chunk, Payload? payload, ImGuiMouseButton button) { } + internal unsafe void Click(Chunk chunk, Payload? payload, ImGuiMouseButton button) { } }