fix: key tooltip
This commit is contained in:
+1
-31
@@ -641,12 +641,11 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName)
|
|||||||
-- Update Y for bottom sections
|
-- Update Y for bottom sections
|
||||||
local y = currentY + rowMaxHeight
|
local y = currentY + rowMaxHeight
|
||||||
|
|
||||||
-- Special sections at bottom (Hearthstone, Mount, Tools, Keyring, Empty)
|
-- Special sections at bottom (Hearthstone, Mount, Tools, Empty)
|
||||||
local bottomSections = {
|
local bottomSections = {
|
||||||
{ name = "Home", items = specialItems.Hearthstone },
|
{ name = "Home", items = specialItems.Hearthstone },
|
||||||
{ name = "Mounts", items = specialItems.Mount },
|
{ name = "Mounts", items = specialItems.Mount },
|
||||||
{ name = "Tools", items = specialItems.Tools },
|
{ name = "Tools", items = specialItems.Tools },
|
||||||
{ name = "Keyring", items = categories["Keyring"] or {} },
|
|
||||||
{ name = "Empty", items = {} }
|
{ name = "Empty", items = {} }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -672,12 +671,6 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName)
|
|||||||
local numItems = table.getn(items)
|
local numItems = table.getn(items)
|
||||||
if sec.name == "Empty" then
|
if sec.name == "Empty" then
|
||||||
numItems = (totalFreeSlots > 0) and 1 or 0
|
numItems = (totalFreeSlots > 0) and 1 or 0
|
||||||
elseif sec.name == "Keyring" then
|
|
||||||
if showKeyring and not hiddenBags[-2] then
|
|
||||||
numItems = addon.Modules.Utils:GetBagSlotCount(-2)
|
|
||||||
else
|
|
||||||
numItems = 0
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if numItems > 0 then
|
if numItems > 0 then
|
||||||
-- Sort Tools (Hearthstone/Mounts don't usually need it but good for consistency)
|
-- Sort Tools (Hearthstone/Mounts don't usually need it but good for consistency)
|
||||||
@@ -738,29 +731,6 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName)
|
|||||||
-- Ensure it's not actually read-only for drop behavior (it should still receive clicks/drops)
|
-- Ensure it's not actually read-only for drop behavior (it should still receive clicks/drops)
|
||||||
button.isReadOnly = false
|
button.isReadOnly = false
|
||||||
button.inUse = true
|
button.inUse = true
|
||||||
elseif sec.name == "Keyring" then
|
|
||||||
local bagID = -2
|
|
||||||
local bagParent = self:GetBagParent(bagID)
|
|
||||||
local bag = bagData[bagID]
|
|
||||||
for slot = 1, numItems do
|
|
||||||
local itemData = bag and bag.slots and bag.slots[slot] or nil
|
|
||||||
local button = Guda_GetItemButton(bagParent)
|
|
||||||
button:SetParent(bagParent)
|
|
||||||
button:SetWidth(buttonSize)
|
|
||||||
button:SetHeight(buttonSize)
|
|
||||||
button:ClearAllPoints()
|
|
||||||
button:SetPoint("TOPLEFT", itemContainer, "TOPLEFT", x + currentBottomX + (sCol * (buttonSize + spacing)), itemY - (sRow * (buttonSize + spacing)))
|
|
||||||
button:Show()
|
|
||||||
|
|
||||||
Guda_ItemButton_SetItem(button, bagID, slot, itemData, false, isOtherChar and charName or nil, self:PassesSearchFilter(itemData), isOtherChar)
|
|
||||||
button.inUse = true
|
|
||||||
|
|
||||||
sCol = sCol + 1
|
|
||||||
if sCol >= blockCols then
|
|
||||||
sCol = 0
|
|
||||||
sRow = sRow + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
for _, item in ipairs(items) do
|
for _, item in ipairs(items) do
|
||||||
local bagParent = self:GetBagParent(item.bagID)
|
local bagParent = self:GetBagParent(item.bagID)
|
||||||
|
|||||||
@@ -509,6 +509,18 @@ function Guda_ItemButton_SetItem(self, bagID, slotID, itemData, isBank, otherCha
|
|||||||
displayTexture = liveTexture
|
displayTexture = liveTexture
|
||||||
displayCount = liveCount
|
displayCount = liveCount
|
||||||
self.hasItem = true
|
self.hasItem = true
|
||||||
|
elseif bagID == -2 then
|
||||||
|
-- Fallback for keyring in 1.12.1
|
||||||
|
local link = GetContainerItemLink(bagID, slotID)
|
||||||
|
if link then
|
||||||
|
self.hasItem = true
|
||||||
|
-- We might not have the texture from GetContainerItemInfo, try to get it from GetItemInfo
|
||||||
|
local _, _, _, _, _, _, _, _, itemTexture = GetItemInfo(link)
|
||||||
|
displayTexture = itemTexture
|
||||||
|
displayCount = 1 -- Keyring items are usually unique anyway
|
||||||
|
else
|
||||||
|
self.hasItem = false
|
||||||
|
end
|
||||||
else
|
else
|
||||||
-- No item in this slot (even if itemData has cached data)
|
-- No item in this slot (even if itemData has cached data)
|
||||||
self.hasItem = false
|
self.hasItem = false
|
||||||
@@ -955,6 +967,14 @@ function Guda_ItemButton_OnEnter(self)
|
|||||||
-- Bank is closed - use cached link
|
-- Bank is closed - use cached link
|
||||||
GameTooltip:SetHyperlink(self.itemData.link)
|
GameTooltip:SetHyperlink(self.itemData.link)
|
||||||
end
|
end
|
||||||
|
elseif self.bagID == -2 then
|
||||||
|
-- Keyring: SetBagItem might be unreliable for -2 in some 1.12.1 environments, fallback to hyperlink if needed
|
||||||
|
local link = GetContainerItemLink(self.bagID, self.slotID)
|
||||||
|
if link then
|
||||||
|
GameTooltip:SetHyperlink(link)
|
||||||
|
else
|
||||||
|
GameTooltip:SetBagItem(self.bagID, self.slotID)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
-- For live mode: use SetBagItem for all bags
|
-- For live mode: use SetBagItem for all bags
|
||||||
GameTooltip:SetBagItem(self.bagID, self.slotID)
|
GameTooltip:SetBagItem(self.bagID, self.slotID)
|
||||||
|
|||||||
Reference in New Issue
Block a user