Skip to content

Commit 3b6511d

Browse files
committed
fixed right clicking items not going to the right account type
1 parent ba19783 commit 3b6511d

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

core/init.lua

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,31 @@ function addon:HideBlizzardBags()
222222
BankFrame:SetScript("OnHide", nil)
223223
BankFrame:SetScript("OnShow", nil)
224224
BankFrame:SetScript("OnEvent", nil)
225+
226+
-- Override BankFrame:GetActiveBankType() to return the correct bank type
227+
-- based on BetterBags' current tab selection. This is necessary because
228+
-- BetterBags hides the Blizzard BankPanel, causing the original function
229+
-- to return nil.
230+
if addon.isRetail and BankFrame.GetActiveBankType then
231+
BankFrame.GetActiveBankType = function(self)
232+
-- If BetterBags bank is not open, return nil
233+
if not addon.Bags or not addon.Bags.Bank or not addon.Bags.Bank:IsShown() then
234+
return nil
235+
end
236+
237+
-- Return the bank type based on BetterBags' current bank tab
238+
if addon.Bags.Bank.bankTab then
239+
-- Account bank tabs are >= 13 (Enum.BagIndex.AccountBankTab_1)
240+
if addon.Bags.Bank.bankTab >= (Enum.BagIndex.AccountBankTab_1 or 13) then
241+
return Enum.BankType.Account
242+
else
243+
return Enum.BankType.Character
244+
end
245+
end
246+
247+
return Enum.BankType.Character
248+
end
249+
end
225250
end
226251

227252
function addon:UpdateButtonHighlight()

frames/bag.lua

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,10 @@ function bagFrame.bagProto:Show(ctx)
271271
if addon.atWarbank then
272272
self:HideBankAndReagentTabs()
273273
self.tabs:SetTabByID(ctx, 13)
274+
-- Set the active bank type for warbank
275+
if BankPanel then
276+
BankPanel.bankType = Enum.BankType.Account
277+
end
274278
else
275279
self:ShowBankAndReagentTabs()
276280
-- Set first tab when using multiple character bank tabs
@@ -283,6 +287,10 @@ function bagFrame.bagProto:Show(ctx)
283287
self.bankTab = addon.isRetail and Enum.BagIndex.Bank or Enum.BagIndex.Characterbanktab
284288
self.tabs:SetTabByID(ctx, 1)
285289
end
290+
-- Set the active bank type for character bank
291+
if BankPanel then
292+
BankPanel.bankType = Enum.BankType.Character
293+
end
286294
end
287295
self.moneyFrame:Update()
288296
end
@@ -467,6 +475,10 @@ function bagFrame.bagProto:SwitchToBank(ctx)
467475
self.currentItemCount = -1
468476
BankFrame.activeTabIndex = 1
469477
BankPanel.selectedTabID = nil
478+
-- Set the active bank type so right-click item movement works correctly
479+
if addon.isRetail and BankPanel then
480+
BankPanel.bankType = Enum.BankType.Character
481+
end
470482
-- Clear bank cache to ensure clean state
471483
items:ClearBankCache(ctx)
472484
self:Wipe(ctx)
@@ -486,6 +498,10 @@ function bagFrame.bagProto:SwitchToCharacterBankTab(ctx, tabID)
486498
BankFrame.selectedTab = 1
487499
BankFrame.activeTabIndex = 1
488500
BankPanel.selectedTabID = nil
501+
-- Set the active bank type so right-click item movement works correctly
502+
if addon.isRetail and BankPanel then
503+
BankPanel.bankType = Enum.BankType.Character
504+
end
489505
self:SetTitle(format(L:G("Bank Tab %d"), tabID - const.BANK_ONLY_BAGS_LIST[1] + 1))
490506
self.currentItemCount = -1
491507
-- Clear bank cache to ensure no items from other tabs remain
@@ -507,6 +523,10 @@ function bagFrame.bagProto:SwitchToAccountBank(ctx, tabIndex)
507523
self.bankTab = tabIndex
508524
BankFrame.selectedTab = 1
509525
BankFrame.activeTabIndex = 3
526+
-- Set the active bank type so right-click item movement works correctly
527+
if addon.isRetail and BankPanel then
528+
BankPanel.bankType = Enum.BankType.Account
529+
end
510530
local tabData = C_Bank.FetchPurchasedBankTabData(Enum.BankType.Account)
511531
for _, data in pairs(tabData) do
512532
if data.ID == tabIndex then
@@ -535,6 +555,10 @@ function bagFrame.bagProto:SwitchToBankAndWipe(ctx)
535555
self.bankTab = addon.isRetail and Enum.BagIndex.Bank or Enum.BagIndex.Characterbanktab
536556
BankFrame.selectedTab = 1
537557
BankFrame.activeTabIndex = 1
558+
-- Set the active bank type so right-click item movement works correctly
559+
if addon.isRetail and BankPanel then
560+
BankPanel.bankType = Enum.BankType.Character
561+
end
538562
self:SetTitle(L:G("Bank"))
539563
items:ClearBankCache(ctx)
540564
self:Wipe(ctx)

0 commit comments

Comments
 (0)