Fix: Tooltip error in other addons that hook itemlink for tooltip

This commit is contained in:
KameleonUK
2026-06-04 06:45:29 +01:00
parent f1618b71bd
commit b2e3485531
2 changed files with 17 additions and 10 deletions
+7 -8
View File
@@ -483,15 +483,14 @@ function Tooltip:Initialize()
local oldSetHyperlink = GameTooltip.SetHyperlink
function GameTooltip:SetHyperlink(link)
return WithDeferredMoney(self, function()
-- The native Blizzard SetHyperlink only accepts a bare "item:ID:e:e:e" string.
-- Any addon that captured the native before Guda loaded (e.g. AtlasLoot) will
-- call it directly with whatever we pass here, so we MUST strip the color codes
-- and |H...|h wrapper before forwarding. Passing the full colored link causes
-- "unknown link type" in those addons.
local _, _, inner = string.find(link or "", "|H(.+)|h")
local forwarded = link
local itemLinkForCounts = link
if inner then
forwarded = inner
if strfind(inner, "^item:") then
itemLinkForCounts = inner
end
end
local forwarded = inner or link
local itemLinkForCounts = inner or link
local ret = oldSetHyperlink(self, forwarded)
if itemLinkForCounts and strfind(itemLinkForCounts, "item:") then
Tooltip:AddInventoryInfo(self, itemLinkForCounts)