Skip to content

Commit

Permalink
update bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuller committed Jan 19, 2024
1 parent 9c9f45b commit 75ba34b
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 11 deletions.
42 changes: 42 additions & 0 deletions Dominos/bars/actionBar/button.classic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 4 additions & 11 deletions Dominos/bars/actionBar/buttons.classic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand Down

0 comments on commit 75ba34b

Please sign in to comment.