From 3bbecdb061a053c58e4bbaeb41e5d7bd7405526b Mon Sep 17 00:00:00 2001 From: Cyborger1 <45152844+Cyborger1@users.noreply.github.com> Date: Thu, 10 Jun 2021 13:31:50 -0400 Subject: [PATCH] ChatHistory: Fix "Copy to Clipboard" after clan update --- .../client/plugins/chathistory/ChatHistoryPlugin.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryPlugin.java index 30b0b740cd..8464d973e0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryPlugin.java @@ -221,8 +221,10 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener // Convert current message static widget id to dynamic widget id of message node with message contents // When message is right clicked, we are actually right clicking static widget that contains only sender. // The actual message contents are stored in dynamic widgets that follow same order as static widgets. - // Every first dynamic widget is message sender and every second one is message contents. - final int dynamicChildId = (childId - first) * 2 + 1; + // Every first dynamic widget is message sender, every second one is message contents, + // every third one is clan name and every fourth one is clan rank icon. + // The last two are hidden when the message is not from a clan chat or guest clan chat. + final int dynamicChildId = (childId - first) * 4 + 1; // Extract and store message contents when menu is opened because dynamic children can change while right click // menu is open and dynamicChildId will be outdated