debug: log main bank bag slotid

This commit is contained in:
Salikh Gurgenidze
2025-11-21 21:32:48 +04:00
parent 3a7de77d69
commit 6637d4eb68
2 changed files with 48 additions and 46 deletions
+42 -46
View File
@@ -555,58 +555,54 @@ end
-- OnEnter handler (show tooltip) -- OnEnter handler (show tooltip)
function Guda_ItemButton_OnEnter(self) function Guda_ItemButton_OnEnter(self)
-- Highlight the corresponding bag button in the footer (works for empty and filled slots) -- Highlight the corresponding bag button in the footer (works for empty and filled slots)
if not self.otherChar and self.bagID then if not self.otherChar and self.bagID then
if self.isBank then if self.isBank then
-- Bank item - highlight bank bag button -- Bank item - highlight bank bag button
Guda_BankFrame_HighlightBagButton(self.bagID) Guda_BankFrame_HighlightBagButton(self.bagID)
else else
-- Regular bag item - highlight bag button -- Regular bag item - highlight bag button
Guda_BagFrame_HighlightBagButton(self.bagID) Guda_BagFrame_HighlightBagButton(self.bagID)
end end
end end
-- Early return for empty slots (no tooltip needed) -- Early return for empty slots (no tooltip needed)
if not self.hasItem or not self.itemData then if not self.hasItem then
return return
end end
GameTooltip:SetOwner(self, "ANCHOR_RIGHT") GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
-- For read-only mode (other characters or saved data), use item link from database -- For bank items, use the item link directly since SetBagItem might not work for bank bags
if (self.isReadOnly or self.otherChar) and self.itemData and self.itemData.link then if self.isBank then
-- Extract hyperlink from item link: |cFFFFFFFF|Hitem:1234:0:0:0|h[Name]|h|r -> item:1234:0:0:0 if self.bagID == -1 then
local _, _, hyperlink = strfind(self.itemData.link, "|H(.+)|h") local bankSlotId = BankButtonIDToInvSlotID(self.slotID)
if hyperlink then addon:Print("BANK MAIN BAG:" .. bankSlotId)
GameTooltip:SetHyperlink(hyperlink) GameTooltip:SetInventoryItem('player', bankSlotId)
else elseif self.itemData.link then
-- Fallback: try to use the link directly local _, _, hyperlink = strfind(self.itemData.link, "|H(.+)|h")
GameTooltip:SetHyperlink(self.itemData.link) if hyperlink then
end GameTooltip:SetHyperlink(hyperlink)
-- For bank items in live mode, use item link since SetBagItem might not work for bank bags else
elseif self.isBank and not self.otherChar and self.itemData and self.itemData.link then GameTooltip:SetBagItem(self.bagID, self.slotID)
local _, _, hyperlink = strfind(self.itemData.link, "|H(.+)|h") end
if hyperlink then addon:Print("OTHER BANK BAG")
GameTooltip:SetHyperlink(hyperlink) end
else else
-- Fallback to SetBagItem addon:Print("OTHER BAG")
GameTooltip:SetBagItem(self.bagID, self.slotID) GameTooltip:SetBagItem(self.bagID, self.slotID)
end end
else
-- For regular bags in live mode, use SetBagItem for real-time data
GameTooltip:SetBagItem(self.bagID, self.slotID)
end
GameTooltip:Show() GameTooltip:Show()
-- Handle merchant sell cursor (same approach as BagShui)
-- Handle merchant sell cursor (same approach as BagShui) if MerchantFrame:IsShown() and not self.isBank and not self.otherChar and self.hasItem then
if MerchantFrame:IsShown() and not self.isBank and not self.otherChar and self.hasItem then ShowContainerSellCursor(self.bagID, self.slotID)
ShowContainerSellCursor(self.bagID, self.slotID) else
else ResetCursor()
ResetCursor() end
end
end end
-- OnLeave handler -- OnLeave handler
function Guda_ItemButton_OnLeave(self) function Guda_ItemButton_OnLeave(self)
GameTooltip:Hide() GameTooltip:Hide()
+6
View File
@@ -40,6 +40,12 @@
ContainerFrameItemButton_OnLoad() ContainerFrameItemButton_OnLoad()
end end
</OnLoad> </OnLoad>
<OnEnter>
Guda_ItemButton_OnEnter(this)
</OnEnter>
<OnLeave>
Guda_ItemButton_OnLeave(this)
</OnLeave>
</Scripts> </Scripts>
</Button> </Button>