diff --git a/UI/BagFrame.lua b/UI/BagFrame.lua
index ce03aff..42df21b 100644
--- a/UI/BagFrame.lua
+++ b/UI/BagFrame.lua
@@ -789,6 +789,141 @@ local function HideCharacterDropdown()
end
end
+-- Bank dropdown management
+local bankDropdown = nil
+
+-- Toggle bank dropdown
+function Guda_BagFrame_ToggleBankDropdown(button)
+ if bankDropdown and bankDropdown:IsShown() then
+ bankDropdown:Hide()
+ return
+ end
+
+ if not bankDropdown then
+ -- Create dropdown frame
+ bankDropdown = CreateFrame("Frame", "Guda_BankDropdown", UIParent)
+ bankDropdown:SetFrameStrata("DIALOG")
+ bankDropdown:SetWidth(200)
+ bankDropdown:SetBackdrop({
+ bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
+ edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
+ tile = true,
+ tileSize = 16,
+ edgeSize = 16,
+ insets = { left = 4, right = 4, top = 4, bottom = 4 }
+ })
+ bankDropdown:SetBackdropColor(0, 0, 0, 0.95)
+ bankDropdown:EnableMouse(true)
+ bankDropdown:Hide()
+
+ bankDropdown.buttons = {}
+ end
+
+ -- Position dropdown below the button
+ bankDropdown:ClearAllPoints()
+ bankDropdown:SetPoint("TOPLEFT", button, "BOTTOMLEFT", 0, -2)
+
+ -- Clear existing buttons
+ for _, btn in ipairs(bankDropdown.buttons) do
+ btn:Hide()
+ end
+ bankDropdown.buttons = {}
+
+ -- Get all characters
+ local chars = addon.Modules.DB:GetAllCharacters(true)
+
+ local yOffset = -8
+
+ -- Add character buttons
+ for _, char in ipairs(chars) do
+ -- Capture variables in local scope for closure
+ local charFullName = char.fullName
+ local charName = char.name
+ local charMoney = char.money or 0
+ local charClassToken = char.classToken
+
+ local charButton = CreateFrame("Button", nil, bankDropdown)
+ charButton:SetWidth(188)
+ charButton:SetHeight(20)
+ charButton:SetPoint("TOP", bankDropdown, "TOP", 0, yOffset)
+
+ -- Button background on hover
+ local charBg = charButton:CreateTexture(nil, "BACKGROUND")
+ charBg:SetAllPoints()
+ charBg:SetTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight")
+ charBg:SetBlendMode("ADD")
+ charBg:SetAlpha(0)
+
+ -- Get class color
+ local classColor = charClassToken and RAID_CLASS_COLORS[charClassToken]
+ local r, g, b = 1, 1, 1
+ if classColor then
+ r, g, b = classColor.r, classColor.g, classColor.b
+ end
+
+ -- Button text
+ local charText = charButton:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
+ charText:SetPoint("LEFT", charButton, "LEFT", 8, 0)
+ charText:SetText(charName)
+ charText:SetTextColor(r, g, b)
+
+ -- Money text
+ local moneyText = charButton:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
+ moneyText:SetPoint("RIGHT", charButton, "RIGHT", -8, 0)
+ moneyText:SetText(addon.Modules.Utils:FormatMoney(charMoney))
+ moneyText:SetTextColor(0.7, 0.7, 0.7)
+
+ -- Button scripts
+ charButton:SetScript("OnEnter", function()
+ charBg:SetAlpha(0.3)
+ end)
+ charButton:SetScript("OnLeave", function()
+ charBg:SetAlpha(0)
+ end)
+ charButton:SetScript("OnClick", function()
+ if charFullName then
+ -- Show bank for this character
+ Guda_BagFrame_ShowCharacterBank(charFullName, charName)
+ bankDropdown:Hide()
+ else
+ addon:Print("Error: Character fullName is nil")
+ end
+ end)
+
+ table.insert(bankDropdown.buttons, charButton)
+ yOffset = yOffset - 20
+ end
+
+ -- Set dropdown height based on content
+ bankDropdown:SetHeight(math.abs(yOffset) + 8)
+
+ -- Show dropdown
+ bankDropdown:Show()
+end
+
+-- Show character's bank
+function Guda_BagFrame_ShowCharacterBank(fullName, displayName)
+ -- Use the existing BankFrame module
+ if not addon.Modules.BankFrame then
+ addon:Print("Bank frame module not available")
+ return
+ end
+
+ -- Position bank frame at center of screen
+ if Guda_BankFrame then
+ Guda_BankFrame:ClearAllPoints()
+ Guda_BankFrame:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
+ end
+
+ -- Show the character's bank
+ addon.Modules.BankFrame:ShowCharacter(fullName)
+
+ -- Make sure frame is shown
+ if Guda_BankFrame then
+ Guda_BankFrame:Show()
+ end
+end
+
-- Search changed handler
function Guda_BagFrame_OnSearchChanged(self)
local text = self:GetText()
diff --git a/UI/BagFrame.xml b/UI/BagFrame.xml
index c1e7b46..79e1133 100644
--- a/UI/BagFrame.xml
+++ b/UI/BagFrame.xml
@@ -232,12 +232,12 @@
local icon = getglobal(this:GetName().."_Icon")
if icon then
- icon:SetTexture("Interface\\Icons\\INV_Misc_Bag_09")
+ icon:SetTexture("Interface\\Icons\\INV_Misc_Bag_08")
icon:SetTexCoord(0.08, 0.92, 0.08, 0.92)
end
- Guda_BankFrame:Toggle()
+ Guda_BagFrame_ToggleBankDropdown(this)
GameTooltip:SetOwner(this, "ANCHOR_TOP")
diff --git a/UI/BankFrame.lua b/UI/BankFrame.lua
index 221656e..5c13977 100644
--- a/UI/BankFrame.lua
+++ b/UI/BankFrame.lua
@@ -11,8 +11,13 @@ local searchText = ""
-- OnLoad
function Guda_BankFrame_OnLoad(self)
- getglobal(self:GetName().."_Title"):SetText("Guda Bank")
- getglobal(self:GetName().."_SearchBox"):SetText("Search...")
+ -- Set up search box placeholder
+ local searchBox = getglobal(self:GetName().."_SearchBar_SearchBox")
+ if searchBox then
+ searchBox:SetText("Search bank...")
+ searchBox:SetTextColor(0.5, 0.5, 0.5, 1)
+ end
+
addon:Debug("Bank frame loaded")
end
@@ -23,7 +28,18 @@ end
-- OnHide
function Guda_BankFrame_OnHide(self)
- Guda_ReleaseAllButtons()
+ -- Only release buttons that belong to this frame
+ local itemContainer = getglobal("Guda_BankFrame_ItemContainer")
+ if itemContainer then
+ -- Hide only the buttons that are children of this container
+ local children = { itemContainer:GetChildren() }
+ for _, child in ipairs(children) do
+ if child.hasItem ~= nil then -- It's an item button
+ child:Hide()
+ child:ClearAllPoints()
+ end
+ end
+ end
end
-- Toggle visibility
@@ -53,7 +69,17 @@ function BankFrame:Update()
return
end
- Guda_ReleaseAllButtons()
+ -- Only release buttons that belong to this frame
+ local itemContainer = getglobal("Guda_BankFrame_ItemContainer")
+ if itemContainer then
+ local children = { itemContainer:GetChildren() }
+ for _, child in ipairs(children) do
+ if child.hasItem ~= nil then -- It's an item button
+ child:Hide()
+ child:ClearAllPoints()
+ end
+ end
+ end
local bankData
local isOtherChar = false
@@ -85,30 +111,48 @@ function BankFrame:DisplayItems(bankData, isOtherChar, charName)
local col = 0
local buttonSize = addon.Modules.DB:GetSetting("iconSize") or addon.Constants.BUTTON_SIZE
local spacing = addon.Modules.DB:GetSetting("iconSpacing") or addon.Constants.BUTTON_SPACING
- local perRow = addon.Modules.DB:GetSetting("bankColumns") or 15
+ local perRow = addon.Modules.DB:GetSetting("bankColumns") or 10
local itemContainer = getglobal("Guda_BankFrame_ItemContainer")
for _, bagID in ipairs(addon.Constants.BANK_BAGS) do
local bag = bankData[bagID]
- if bag and bag.slots then
- for slot, itemData in pairs(bag.slots) do
- if self:PassesSearchFilter(itemData) then
- local button = Guda_GetItemButton(itemContainer)
+ -- Get slot count for this bag
+ local numSlots
+ if isOtherChar and bag and bag.numSlots then
+ -- Use stored slot count for other characters
+ numSlots = bag.numSlots
+ else
+ -- Use current character's bag slot count
+ numSlots = addon.Modules.Utils:GetBagSlotCount(bagID)
+ end
- local xPos = x + (col * (buttonSize + spacing))
- local yPos = y - (row * (buttonSize + spacing))
+ -- Only show bags that have slots
+ if numSlots and numSlots > 0 then
+ -- Iterate through ALL slots (1 to numSlots) to show empty slots too
+ for slot = 1, numSlots do
+ local itemData = bag and bag.slots and bag.slots[slot] or nil
- button:ClearAllPoints()
- button:SetPoint("TOPLEFT", itemContainer, "TOPLEFT", xPos, yPos)
+ -- Check if item matches search filter
+ local matchesFilter = self:PassesSearchFilter(itemData)
- Guda_ItemButton_SetItem(button, bagID, slot, itemData, true, isOtherChar and charName or nil)
+ local button = Guda_GetItemButton(itemContainer)
- col = col + 1
- if col >= perRow then
- col = 0
- row = row + 1
- end
+ -- Position button
+ local xPos = x + (col * (buttonSize + spacing))
+ local yPos = y - (row * (buttonSize + spacing))
+
+ button:ClearAllPoints()
+ button:SetPoint("TOPLEFT", itemContainer, "TOPLEFT", xPos, yPos)
+
+ -- Set item data with filter match info
+ Guda_ItemButton_SetItem(button, bagID, slot, itemData, true, isOtherChar and charName or nil, matchesFilter)
+
+ -- Advance position
+ col = col + 1
+ if col >= perRow then
+ col = 0
+ row = row + 1
end
end
end
diff --git a/UI/BankFrame.xml b/UI/BankFrame.xml
index eeb6814..be0c59a 100644
--- a/UI/BankFrame.xml
+++ b/UI/BankFrame.xml
@@ -3,37 +3,38 @@
-
+
-
+
-
+
-
+
-
+
+
-
+
-
+
@@ -58,21 +59,44 @@
-
+
-
-
+
+
-
+
-
+
-
-
- Guda_BankFrame_OnSearchChanged(this)
-
-
- this:ClearFocus()
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ if this:GetText() == "Search bank..." then
+ this:SetText("")
+ this:SetTextColor(1, 1, 1, 1)
+ end
+
+
+ if this:GetText() == "" then
+ this:SetText("Search bank...")
+ this:SetTextColor(0.5, 0.5, 0.5, 1)
+ Guda_BankFrame_OnSearchChanged(this)
+ end
+
+
+ Guda_BankFrame_OnSearchChanged(this)
+
+
+ this:SetText("Search bank...")
+ this:SetTextColor(0.5, 0.5, 0.5, 1)
+ this:ClearFocus()
+ Guda_BankFrame_OnSearchChanged(this)
+
+
+
+
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+ -- Clear search focus when clicking in item area
+ local searchBox = getglobal("Guda_BankFrame_SearchBar_SearchBox")
+ if searchBox then
+ searchBox:ClearFocus()
+ end
+
+
@@ -141,6 +205,12 @@
Guda_BankFrame_OnHide(this)
+ -- Clear search box focus when clicking on bank frame
+ local searchBox = getglobal("Guda_BankFrame_SearchBar_SearchBox")
+ if searchBox then
+ searchBox:ClearFocus()
+ end
+
if (arg1 == "LeftButton") then
this:StartMoving()
end