diff --git a/Frame.lua b/Frame.lua index 018171e..d1b645c 100644 --- a/Frame.lua +++ b/Frame.lua @@ -311,17 +311,18 @@ function Gladdy:CreateButton(i) local secure = CreateFrame("Button", "GladdyButton" .. i, button, "SecureActionButtonTemplate, SecureHandlerEnterLeaveTemplate") secure:RegisterForClicks("AnyUp") - secure:SetAttribute("*type*", "macro") + secure:RegisterForClicks("AnyDown") + --secure:SetAttribute("*type*", "macro") --secure:SetAttribute("*type1", "target") --secure:SetAttribute("*type2", "focus") - --secure:SetAttribute("unit", "target") secure:SetAttribute("unit", "arena" .. i) + --secure:SetAttribute("unit", i == 1 and "player" or "focus") --secure.texture = secure:CreateTexture(nil, "OVERLAY") --secure.texture:SetAllPoints(secure) --secure.texture:SetTexture("Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp") button.id = i - --button.unit = "target" + --button.unit = i == 1 and "player" or "focus" button.unit = "arena" .. i button.secure = secure diff --git a/Modules/Clicks.lua b/Modules/Clicks.lua index 654b247..3551ae5 100644 --- a/Modules/Clicks.lua +++ b/Modules/Clicks.lua @@ -120,18 +120,24 @@ function Clicks:SetupAttributes(unit) end function Clicks:SetupAttribute(button, key, mod, action, spell) - local attr = mod .. "macrotext" .. key + local attr = "" local text = "" if (action == "macro") then + attr = mod .. "macrotext" .. key text = spell:gsub("%*arena%*", button.unit) + button.secure:SetAttribute(mod .. "type" .. key, "macro") elseif (action ~= "disabled") then if (action == "target") then - text = "/target [@" .. button.unit .. "]" + attr = mod .. "type" .. key + text = "target" elseif (action == "focus") then - text = "/focus [@" .. button.unit .. "]" + attr = mod .. "type" .. key + text = "focus" elseif (action == "spell") then - text = "/cast [@" .. button.unit .. "] " .. spell + attr = mod .. "type" .. key + text = "spell" + button.secure:SetAttribute(mod .. "spell" .. key, spell) end end