From 75ba34bc0c956315a0933e90899ecd9f5cfad8b9 Mon Sep 17 00:00:00 2001 From: Jason Greer Date: Thu, 18 Jan 2024 20:19:26 -0500 Subject: [PATCH] update bindings --- Dominos/bars/actionBar/button.classic.lua | 42 ++++++++++++++++++++++ Dominos/bars/actionBar/buttons.classic.lua | 15 +++----- 2 files changed, 46 insertions(+), 11 deletions(-) diff --git a/Dominos/bars/actionBar/button.classic.lua b/Dominos/bars/actionBar/button.classic.lua index 23dcd8c6..2ba6d2e6 100644 --- a/Dominos/bars/actionBar/button.classic.lua +++ b/Dominos/bars/actionBar/button.classic.lua @@ -8,11 +8,53 @@ if Addon:IsBuild("retail") then return end local ActionButton = { } +local function GetActionButtonCommand(id) + -- 0 + if id <= 0 then + return + -- 1 + elseif id <= 12 then + return "ACTIONBUTTON" .. id + -- 2 + elseif id <= 24 then + return + -- 3 + elseif id <= 36 then + return "MULTIACTIONBAR3BUTTON" .. (id - 24) + -- 4 + elseif id <= 48 then + return "MULTIACTIONBAR4BUTTON" .. (id - 36) + -- 5 + elseif id <= 60 then + return "MULTIACTIONBAR2BUTTON" .. (id - 48) + -- 6 + elseif id <= 72 then + return "MULTIACTIONBAR1BUTTON" .. (id - 60) + -- 7-11 + elseif id <= 132 then + return + -- 12 + elseif id <= 144 then + return "MULTIACTIONBAR5BUTTON" .. (id - 132) + -- 13 + elseif id <= 156 then + return "MULTIACTIONBAR6BUTTON" .. (id - 144) + -- 14 + elseif id <= 168 then + return "MULTIACTIONBAR7BUTTON" .. (id - 156) + end +end + + function ActionButton:OnCreate(id) -- initialize state self.id = id self.action = 0 + if self.commandName == nil then + self.commandName = GetActionButtonCommand(id) + end + -- initialize secure state self:SetAttributeNoHandler("action", 0) self:SetAttributeNoHandler("id", id) diff --git a/Dominos/bars/actionBar/buttons.classic.lua b/Dominos/bars/actionBar/buttons.classic.lua index f4cbb5bb..cfbbab40 100644 --- a/Dominos/bars/actionBar/buttons.classic.lua +++ b/Dominos/bars/actionBar/buttons.classic.lua @@ -94,16 +94,16 @@ local function GetActionButtonName(id) return ACTION_BUTTON_NAME_TEMPLATE:format(id) -- 3 elseif id <= 36 then - return "VerticalMultiBar3Button" .. (id - 24) + return "MultiBarRightButton" .. (id - 24) -- 4 elseif id <= 48 then - return "VerticalMultiBar4Button" .. (id - 36) + return "MultiBarLeftButton" .. (id - 36) -- 5 elseif id <= 60 then - return "HorizontalMultiBar2Button" .. (id - 48) + return "MultiBarBottomRightButton" .. (id - 48) -- 6 elseif id <= 72 then - return "HorizontalMultiBar1Button" .. (id - 60) + return "MultiBarBottomLeftButton" .. (id - 60) -- 7+ else return ACTION_BUTTON_NAME_TEMPLATE:format(id) @@ -126,17 +126,10 @@ function ActionButtons:GetOrCreateActionButton(id, parent) -- a standard UI button we're reusing elseif self.buttons[button] == nil then Mixin(button, Addon.ActionButton) - button:SetID(0) - - if not button.commandName then - button.commandName = button:GetName():upper() - end - button:OnCreate(id) self:WrapScript(button, "OnClick", ActionButton_ClickBefore) - self.buttons[button] = id end