Skip to content

Commit 4b894aa

Browse files
committed
auto toggle to override what blizzard does
1 parent 92a275e commit 4b894aa

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

ElvUI/Core/Defaults/Profile.lua

+1
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ P.bags = {
471471
},
472472
shownBags = {},
473473
autoToggle = {
474+
enable = true,
474475
bank = true,
475476
mail = true,
476477
vendor = true,

ElvUI/Core/Modules/Bags/Bags.lua

+13-6
Original file line numberDiff line numberDiff line change
@@ -3347,15 +3347,25 @@ end
33473347

33483348
function B:AutoToggleFunction()
33493349
local option = B.AutoToggleEvents[self]
3350-
if not option or not B.db.autoToggle[option] then return end
3350+
if not option then return end
33513351

3352-
if not B.AutoToggleClose[self] then
3352+
if B.db.autoToggle[option] and not B.AutoToggleClose[self] then
33533353
B:OpenBags()
33543354
else
33553355
B:CloseBags()
33563356
end
33573357
end
33583358

3359+
function B:SetupAutoToggle()
3360+
for event in next, B.AutoToggleEvents do
3361+
if B.db.autoToggle.enable then
3362+
B:RegisterEvent(event, B.AutoToggleFunction)
3363+
else
3364+
B:UnregisterEvent(event)
3365+
end
3366+
end
3367+
end
3368+
33593369
function B:UpdateBagColors(table, indice, r, g, b)
33603370
local colorTable
33613371
if table == 'items' then
@@ -3509,6 +3519,7 @@ function B:Initialize()
35093519
B:SecureHook('ToggleBackpack')
35103520
B:SecureHook('BankFrame_ShowPanel', 'SetBankSelectedTab')
35113521

3522+
B:SetupAutoToggle()
35123523
B:DisableBlizzard()
35133524
B:UpdateGoldText()
35143525

@@ -3522,10 +3533,6 @@ function B:Initialize()
35223533
B:RegisterEvent('BANKFRAME_CLOSED', 'CloseBank')
35233534
B:RegisterEvent('CVAR_UPDATE', 'UpdateBindLines')
35243535

3525-
for event in next, B.AutoToggleEvents do
3526-
B:RegisterEvent(event, B.AutoToggleFunction)
3527-
end
3528-
35293536
--Enable/Disable 'Loot to Leftmost Bag'
35303537
SetInsertItemsLeftToRight(B.db.reverseLoot)
35313538
end

ElvUI_Options/Core/Bags.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ Bags.args.general.args.itemLevelGroup.args.positionGroup.args.itemLevelxOffset =
157157
Bags.args.general.args.itemLevelGroup.args.positionGroup.args.itemLevelyOffset = ACH:Range(L["Y-Offset"], nil, 12, { min = -45, max = 45, step = 1 }, nil, nil, nil, nil, function() return not E.db.bags.itemLevel end)
158158

159159
Bags.args.general.args.autoToggle = ACH:Group(L["Auto Toggle"], nil, 11)
160-
Bags.args.general.args.autoToggle.args.toggles = ACH:MultiSelect('', nil, 1, { bank = L["Bank"], mail = L["MAIL_LABEL"], guildBank = L["Guild Bank"], auctionHouse = L["Auction House"], professions = L["Professions"], trade = L["TRADE"], vendor = L["Vendor"] }, nil, nil, function(_, key) return E.db.bags.autoToggle[key] end, function(_, key, value) E.db.bags.autoToggle[key] = value end)
160+
Bags.args.general.args.autoToggle.args.enable = ACH:Toggle(L["Enable"], nil, 1, nil, nil, nil, function() return E.db.bags.autoToggle.enable end, function(_, value) E.db.bags.autoToggle.enable = value B:SetupAutoToggle() end)
161+
Bags.args.general.args.autoToggle.args.toggles = ACH:MultiSelect('', nil, 2, { bank = L["Bank"], mail = L["MAIL_LABEL"], guildBank = L["Guild Bank"], auctionHouse = L["Auction House"], professions = L["Professions"], trade = L["TRADE"], vendor = L["Vendor"] }, nil, nil, function(_, key) return E.db.bags.autoToggle[key] end, function(_, key, value) E.db.bags.autoToggle[key] = value end, function() return not E.db.bags.autoToggle.enable end)
161162

162163
if E.Retail then
163164
Bags.args.general.args.autoToggle.args.toggles.values.soulBind = L["Soul Binds"]

0 commit comments

Comments
 (0)