feat: guda keybindings

This commit is contained in:
Salikh Gurgenidze
2025-11-20 12:26:42 +04:00
parent 429d0c8095
commit 5d8a972bb0
4 changed files with 60 additions and 34 deletions
+8
View File
@@ -0,0 +1,8 @@
<Bindings>
<Binding name="GUDA_TOGGLE_BAGS" header="GUDA">
Guda.Modules.BagFrame:Toggle()
</Binding>
<Binding name="GUDA_TOGGLE_BANK" header="GUDA">
Guda.Modules.BankFrame:Toggle()
</Binding>
</Bindings>
+2
View File
@@ -6,6 +6,8 @@
## SavedVariables: Guda_DB ## SavedVariables: Guda_DB
## SavedVariablesPerCharacter: Guda_CharDB ## SavedVariablesPerCharacter: Guda_CharDB
Localization.lua
Core\Init.lua Core\Init.lua
Core\Database.lua Core\Database.lua
Core\Events.lua Core\Events.lua
+8
View File
@@ -0,0 +1,8 @@
-- Guda Localization
-- Keybinding localization
BINDING_HEADER_GUDA = "Guda"
BINDING_NAME_GUDA_TOGGLE_BAGS = "Toggle Bags"
BINDING_NAME_GUDA_TOGGLE_BANK = "Toggle Bank"
-- Additional localization strings can be added here
+42 -34
View File
@@ -1188,32 +1188,34 @@ end
-- Alternative approach: Completely replace the bag open functions -- Alternative approach: Completely replace the bag open functions
local function ReplaceBagOpenFunctions() local function ReplaceBagOpenFunctions()
-- Store original functions -- Override OpenBag (if it exists)
local originalOpenBag = OpenBag if OpenBag then
local originalToggleBag = ToggleBag local originalOpenBag = OpenBag
function OpenBag(bagId)
-- Override OpenBag if bagId and bagId >= 0 and bagId <= 4 then
function OpenBag(bagId) -- For regular bags, open Guda Bag View
if bagId and bagId >= 0 and bagId <= 4 then BagFrame:Toggle()
-- For regular bags, open Guda Bag View else
BagFrame:Toggle() -- For other containers, use original function
else if originalOpenBag then
-- For other containers, use original function originalOpenBag(bagId)
if originalOpenBag then end
originalOpenBag(bagId)
end end
end end
end end
-- Override ToggleBag -- Override ToggleBag (if it exists)
function ToggleBag(bagId) if ToggleBag then
if bagId and bagId >= 0 and bagId <= 4 then local originalToggleBag = ToggleBag
-- For regular bags, toggle Guda Bag View function ToggleBag(bagId)
BagFrame:Toggle() if bagId and bagId >= 0 and bagId <= 4 then
else -- For regular bags, toggle Guda Bag View
-- For other containers, use original function BagFrame:Toggle()
if originalToggleBag then else
originalToggleBag(bagId) -- For other containers, use original function
if originalToggleBag then
originalToggleBag(bagId)
end
end end
end end
end end
@@ -1221,22 +1223,28 @@ end
-- Hook to default bag opening -- Hook to default bag opening
local function HookDefaultBags() local function HookDefaultBags()
-- Override ToggleBackpack -- Override ToggleBackpack (if it exists)
local originalToggleBackpack = ToggleBackpack if ToggleBackpack then
function ToggleBackpack() local originalToggleBackpack = ToggleBackpack
BagFrame:Toggle() function ToggleBackpack()
BagFrame:Toggle()
end
end end
-- Override OpenAllBags -- Override OpenAllBags (if it exists)
local originalOpenAllBags = OpenAllBags if OpenAllBags then
function OpenAllBags() local originalOpenAllBags = OpenAllBags
Guda_BagFrame:Show() function OpenAllBags()
Guda_BagFrame:Show()
end
end end
-- Override CloseAllBags -- Override CloseAllBags (if it exists)
local originalCloseAllBags = CloseAllBags if CloseAllBags then
function CloseAllBags() local originalCloseAllBags = CloseAllBags
Guda_BagFrame:Hide() function CloseAllBags()
Guda_BagFrame:Hide()
end
end end
-- Hook individual bag opening functions (for bag slot buttons) -- Hook individual bag opening functions (for bag slot buttons)