fix: bank slot tooltips and bagslot tooltips
This commit is contained in:
+23
-7
@@ -331,19 +331,35 @@ function Tooltip:Initialize()
|
|||||||
|
|
||||||
-- Hook SetBagItem
|
-- Hook SetBagItem
|
||||||
local oldSetBagItem = GameTooltip.SetBagItem
|
local oldSetBagItem = GameTooltip.SetBagItem
|
||||||
|
local oldSetInventoryItem = GameTooltip.SetInventoryItem
|
||||||
function GameTooltip:SetBagItem(bag, slot)
|
function GameTooltip:SetBagItem(bag, slot)
|
||||||
return WithDeferredMoney(self, function()
|
return WithDeferredMoney(self, function()
|
||||||
local ret = oldSetBagItem(self, bag, slot)
|
local bankFrame = getglobal("BankFrame")
|
||||||
local link = GetContainerItemLink(bag, slot)
|
if bag == -1 and bankFrame and bankFrame:IsVisible() then
|
||||||
if link then
|
local invSlot = BankButtonIDToInvSlotID(slot)
|
||||||
Tooltip:AddInventoryInfo(self, link)
|
if invSlot then
|
||||||
|
-- Use the inventory item method for bank main bag
|
||||||
|
local ret = oldSetInventoryItem(self, "player", invSlot)
|
||||||
|
local link = GetInventoryItemLink("player", invSlot)
|
||||||
|
if link then
|
||||||
|
Tooltip:AddInventoryInfo(self, link)
|
||||||
|
end
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
else
|
||||||
|
local ret = oldSetBagItem(self, bag, slot)
|
||||||
|
local link = GetContainerItemLink(bag, slot)
|
||||||
|
if link then
|
||||||
|
Tooltip:AddInventoryInfo(self, link)
|
||||||
|
end
|
||||||
|
return ret
|
||||||
end
|
end
|
||||||
return ret
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Hook SetHyperlink for hyperlinks from chat and cached links
|
-- Hook SetHyperlink for hyperlinks from chat and cached links
|
||||||
local oldSetHyperlink = GameTooltip.SetHyperlink
|
local oldSetHyperlink = GameTooltip.SetHyperlink
|
||||||
function GameTooltip:SetHyperlink(link)
|
function GameTooltip:SetHyperlink(link)
|
||||||
return WithDeferredMoney(self, function()
|
return WithDeferredMoney(self, function()
|
||||||
local _, _, inner = string.find(link or "", "|H(.+)|h")
|
local _, _, inner = string.find(link or "", "|H(.+)|h")
|
||||||
|
|||||||
Reference in New Issue
Block a user