From 4df06717921f8f2a65f1c30fa8395f8ec84639d0 Mon Sep 17 00:00:00 2001 From: wutname1 Date: Mon, 20 May 2024 16:07:11 -0500 Subject: [PATCH 1/2] Disable replacement of the bag bar when BT4 is in control of it --- config/config.lua | 15 +++++++++++++-- core/init.lua | 35 ++++++++++++++++++----------------- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/config/config.lua b/config/config.lua index cb5372a7..04eac235 100644 --- a/config/config.lua +++ b/config/config.lua @@ -85,10 +85,13 @@ function config:GetGeneralOptions() width = "full", order = 2, name = L:G("Show Blizzard Bag Button"), - desc = L:G("Show or hide the default Blizzard bag button."), + desc = L:G("Show or hide the default Blizzard bag button."), + disabled = function() + return select(4, C_AddOns.GetAddOnInfo('Bartender4')) + end, get = DB.GetShowBagButton, set = function(_, value) - local sneakyFrame = _G["BetterBagsSneakyFrame"] ---@type Frame + local sneakyFrame = _G["BetterBagsSneakyFrame"] ---@type Frame if value then BagsBar:SetParent(UIParent) else @@ -96,6 +99,14 @@ function config:GetGeneralOptions() end DB:SetShowBagButton(value) end, + }, + showBagButtonDisabled = { + type = "description", + name = L:G("|cffThis option is disabled because Bartender4 is installed."), + hidden = function() + return not select(4, C_AddOns.GetAddOnInfo('Bartender4')) + end, + order = 2.5, }, newItemTime = { type = "range", diff --git a/core/init.lua b/core/init.lua index ae2008ab..0fcf236a 100644 --- a/core/init.lua +++ b/core/init.lua @@ -125,7 +125,7 @@ function addon:OnInitialize() end for _, button in pairs(addon._buttons) do - button:HookScript("OnClick", + button:SetScript("OnClick", function() addon:ToggleAllBags() end) @@ -156,23 +156,24 @@ function addon:HideBlizzardBags() _G["ContainerFrame"..i]:SetParent(sneakyFrame) end - MainMenuBarBackpackButton:SetScript("OnClick", function() - self:ToggleAllBags() - end) - - BagBarExpandToggle:SetParent(sneakyFrame) - for i = 0, 3 do - local bagButton = _G["CharacterBag"..i.."Slot"] --[[@as Button]] - bagButton:SetParent(sneakyFrame) - end - for i = 0, 0 do - local bagButton = _G["CharacterReagentBag"..i.."Slot"] --[[@as Button]] - bagButton:SetParent(sneakyFrame) - end - if not database:GetShowBagButton() then - BagsBar:SetParent(sneakyFrame) - end + if not select(4, C_AddOns.GetAddOnInfo("Bartender4")) then + MainMenuBarBackpackButton:SetScript("OnClick", function() + self:ToggleAllBags() + end) + BagBarExpandToggle:SetParent(sneakyFrame) + for i = 0, 3 do + local bagButton = _G["CharacterBag"..i.."Slot"] --[[@as Button]] + bagButton:SetParent(sneakyFrame) + end + for i = 0, 0 do + local bagButton = _G["CharacterReagentBag"..i.."Slot"] --[[@as Button]] + bagButton:SetParent(sneakyFrame) + end + if not database:GetShowBagButton() then + BagsBar:SetParent(sneakyFrame) + end + end BankFrame:SetParent(sneakyFrame) BankFrame:SetScript("OnHide", nil) From 3ac8e7ddcbbb6493812b75a260f573297da49b5f Mon Sep 17 00:00:00 2001 From: wutname1 Date: Mon, 20 May 2024 16:17:44 -0500 Subject: [PATCH 2/2] fix formatting --- config/config.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/config.lua b/config/config.lua index 04eac235..c78a89a3 100644 --- a/config/config.lua +++ b/config/config.lua @@ -85,7 +85,7 @@ function config:GetGeneralOptions() width = "full", order = 2, name = L:G("Show Blizzard Bag Button"), - desc = L:G("Show or hide the default Blizzard bag button."), + desc = L:G("Show or hide the default Blizzard bag button."), disabled = function() return select(4, C_AddOns.GetAddOnInfo('Bartender4')) end, @@ -99,7 +99,7 @@ function config:GetGeneralOptions() end DB:SetShowBagButton(value) end, - }, + }, showBagButtonDisabled = { type = "description", name = L:G("|cffThis option is disabled because Bartender4 is installed."),