From b02473d32ae1bdc3298d38a8c2c26ed3e1ab9c9b Mon Sep 17 00:00:00 2001 From: Anna Date: Tue, 8 Feb 2022 18:05:05 -0500 Subject: [PATCH] fix: handle non-native event item tooltips --- ChatTwo/PayloadHandler.cs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/ChatTwo/PayloadHandler.cs b/ChatTwo/PayloadHandler.cs index e784f6d..a354621 100755 --- a/ChatTwo/PayloadHandler.cs +++ b/ChatTwo/PayloadHandler.cs @@ -204,6 +204,11 @@ internal sealed class PayloadHandler { } private void HoverItem(ItemPayload item) { + if (item.Kind == ItemPayload.ItemKind.EventItem) { + this.HoverEventItem(item); + return; + } + if (item.Item == null) { return; } @@ -220,6 +225,27 @@ internal sealed class PayloadHandler { this.Log.DrawChunks(desc.ToList()); } + private void HoverEventItem(ItemPayload payload) { + var item = this.Ui.Plugin.DataManager.GetExcelSheet()?.GetRow(payload.RawItemId); + if (item == null) { + return; + } + + if (this.Ui.Plugin.TextureCache.GetEventItem(item) is { } icon) { + InlineIcon(icon); + } + + var name = ChunkUtil.ToChunks(item.Name.ToDalamudString(), null); + this.Log.DrawChunks(name.ToList()); + ImGui.Separator(); + + var help = this.Ui.Plugin.DataManager.GetExcelSheet()?.GetRow(payload.RawItemId); + if (help != null) { + var desc = ChunkUtil.ToChunks(help.Description.ToDalamudString(), null); + this.Log.DrawChunks(desc.ToList()); + } + } + private void LeftClickPayload(Chunk chunk, Payload? payload) { switch (payload) { case MapLinkPayload map: {