fix: mailbox tooltip
This commit is contained in:
+25
-5
@@ -95,6 +95,31 @@ function Utils:GetItemInfo(itemLink)
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Create a hidden tooltip for scanning
|
||||
local scanTooltip = CreateFrame("GameTooltip", "GudaBagScanTooltip", nil, "GameTooltipTemplate")
|
||||
scanTooltip:SetOwner(WorldFrame, "ANCHOR_NONE")
|
||||
|
||||
-- Get item link from mailbox attachment (WoW 1.12.1 workaround)
|
||||
function Utils:GetInboxItemLink(index, itemIndex)
|
||||
-- In 1.12.1, GameTooltip:GetHyperlink() does not exist.
|
||||
-- Actually, in 1.12.1, there's no official API to get the link from a mailbox item
|
||||
-- if GetInboxItemLink(index) is not available (it's often NOT available in Vanilla).
|
||||
|
||||
-- Let's try to use GetItemInfo(name) as the primary way.
|
||||
local name = GetInboxItem(index, itemIndex)
|
||||
if name then
|
||||
local _, link = GetItemInfo(name)
|
||||
if link then
|
||||
return link
|
||||
end
|
||||
end
|
||||
|
||||
-- Fallback: If we still don't have it, we might try to scan the tooltip for the name
|
||||
-- but GetInboxItem already gave us the name.
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Get quality color
|
||||
function Utils:GetQualityColor(quality)
|
||||
local color = addon.Constants.QUALITY_COLORS[quality] or addon.Constants.QUALITY_COLORS[1]
|
||||
@@ -156,12 +181,7 @@ function Utils:FormatTimeAgo(timestamp)
|
||||
end
|
||||
|
||||
-- Create hidden tooltip for scanning (only once)
|
||||
local scanTooltip = nil
|
||||
local function GetScanTooltip()
|
||||
if not scanTooltip then
|
||||
scanTooltip = CreateFrame("GameTooltip", "GudaBagScanTooltip", nil, "GameTooltipTemplate")
|
||||
scanTooltip:SetOwner(WorldFrame, "ANCHOR_NONE")
|
||||
end
|
||||
return scanTooltip
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user