BUY_CURSOR on empty bank bag slot

This commit is contained in:
Salikh Gurgenidze
2025-11-18 22:55:47 +04:00
parent 4f0e0ae4fb
commit 1e8d605356
+48 -32
View File
@@ -923,32 +923,46 @@ end
function Guda_BankBagSlot_OnClick(button, bagID, which) function Guda_BankBagSlot_OnClick(button, bagID, which)
local which = which or arg1 -- Vanilla uses global arg1 for mouse button name local which = which or arg1 -- Vanilla uses global arg1 for mouse button name
if which == "RightButton" then if bagID and bagID ~= -1 then
-- Toggle visibility local invSlot, bankButtonID = BankFrame:GetBankInvSlotForBagID(bagID)
hiddenBankBags[bagID] = not hiddenBankBags[bagID] if invSlot and bankButtonID then
Guda_BankBagSlot_Update(button, bagID) local numSlots = GetNumBankSlots()
BankFrame:Update() local isPurchased = (bankButtonID <= numSlots)
return local hasCursorItem = CursorHasItem()
end
if which == "LeftButton" then -- Handle unpurchased slots: both left and right click show purchase dialog
-- Equip bag from cursor into this bank bag slot (5-10) when bank open and purchased if not isPurchased then
if bagID and bagID ~= -1 and CursorHasItem and CursorHasItem() then if not hasCursorItem then
local invSlot, bankButtonID = BankFrame:GetBankInvSlotForBagID(bagID) -- Show purchase dialog for both left and right click
if invSlot and addon.Modules.BankScanner:IsBankOpen() then local cost = GetBankSlotCost(numSlots)
local purchased = (bankButtonID and bankButtonID <= GetNumBankSlots()) local gudaBankFrame = getglobal("Guda_BankFrame")
if purchased then if gudaBankFrame then
if EquipCursorItem then gudaBankFrame.nextSlotCost = cost
EquipCursorItem(invSlot)
elseif PutItemInBag then
PutItemInBag(invSlot)
end end
StaticPopup_Show("CONFIRM_BUY_BANK_SLOT")
end
return
end
-- Handle purchased slots
if which == "RightButton" then
-- Toggle visibility for purchased slots
hiddenBankBags[bagID] = not hiddenBankBags[bagID]
Guda_BankBagSlot_Update(button, bagID)
BankFrame:Update()
return
end
if which == "LeftButton" then
if hasCursorItem then
-- Equip bag from cursor into this purchased bank bag slot
EquipCursorItem(invSlot)
Guda_BankBagSlot_Update(button, bagID) Guda_BankBagSlot_Update(button, bagID)
BankFrame:Update() BankFrame:Update()
end end
return
end end
end end
return
end end
end end
@@ -973,38 +987,40 @@ function Guda_BankBagSlot_OnEnter(button, bagID)
local hasItem = invSlot and GetInventoryItemTexture("player", invSlot) local hasItem = invSlot and GetInventoryItemTexture("player", invSlot)
if hasItem then if hasItem then
-- Show bag item tooltip -- Show bag item tooltip (with hide/show text)
GameTooltip:SetInventoryItem("player", invSlot) GameTooltip:SetInventoryItem("player", invSlot)
if hiddenBankBags[bagID] then if hiddenBankBags[bagID] then
GameTooltip:AddLine("(Hidden - Right-Click to show)", 0.8, 0.5, 0.5) GameTooltip:AddLine("(Hidden - Right-Click to show)", 0.8, 0.5, 0.5)
else else
GameTooltip:AddLine("(Right-Click to hide)", 0.5, 0.8, 0.5) GameTooltip:AddLine("(Right-Click to hide)", 0.5, 0.8, 0.5)
end end
-- Reset cursor for purchased slots with items
ResetCursor()
elseif isPurchased then elseif isPurchased then
-- Empty purchased slot -- Empty purchased slot (no hide/show text, no purchase cursor)
GameTooltip:SetText(string.format("Bank Bag Slot %d", bankButtonID or -1), 1.0, 1.0, 1.0) GameTooltip:SetText(string.format("Bank Bag Slot %d", bankButtonID or -1), 1.0, 1.0, 1.0)
GameTooltip:AddLine("Empty", 0.8, 0.8, 0.8) GameTooltip:AddLine("Empty", 0.8, 0.8, 0.8)
if hiddenBankBags[bagID] then -- Reset cursor for empty purchased slots
GameTooltip:AddLine("(Hidden - Right-Click to show)", 0.8, 0.5, 0.5) ResetCursor()
else
GameTooltip:AddLine("(Right-Click to hide)", 0.5, 0.8, 0.5)
end
else else
-- Unpurchased slot -- Unpurchased slot (no hide/show text, show purchase cursor)
GameTooltip:SetText(string.format("Bank Bag Slot %d", bankButtonID or -1), 1.0, 1.0, 1.0) GameTooltip:SetText(string.format("Bank Bag Slot %d", bankButtonID or -1), 1.0, 1.0, 1.0)
local cost = GetBankSlotCost(numSlots) local cost = GetBankSlotCost(numSlots)
GameTooltip:AddLine(addon.Modules.Utils:FormatMoney(cost, false, true), 1, 1, 1) GameTooltip:AddLine(addon.Modules.Utils:FormatMoney(cost, false, true), 1, 1, 1)
if hiddenBankBags[bagID] then -- Show purchase cursor (coin icon)
GameTooltip:AddLine("(Hidden - Right-Click to show)", 0.8, 0.5, 0.5) SetCursor("BUY_CURSOR")
else
GameTooltip:AddLine("(Right-Click to hide)", 0.5, 0.8, 0.5)
end
end end
end end
GameTooltip:Show() GameTooltip:Show()
end end
-- OnLeave handler for bank bag slots
function Guda_BankBagSlot_OnLeave(button, bagID)
GameTooltip:Hide()
ResetCursor()
end
-- Highlight all item slots belonging to a specific bank bag by dimming others -- Highlight all item slots belonging to a specific bank bag by dimming others
function Guda_BankFrame_HighlightBagSlots(bagID) function Guda_BankFrame_HighlightBagSlots(bagID)
local itemContainer = getglobal("Guda_BankFrame_ItemContainer") local itemContainer = getglobal("Guda_BankFrame_ItemContainer")