Code:
-- rActionButtonStyler by Roth, modified by Haleth... then butchered by Qupe =(
local F, C, L = unpack(Aurora)
local r, g, b = unpack(CUSTOM_CLASS_COLORS)
local _G = _G
-- Config Options
local config = {
["HotKey"] = true,
}
cfg = config
local function applyBackground(bu)
if bu:GetFrameLevel() < 1 then bu:SetFrameLevel(1) end
bu.bg = CreateFrame("Frame", nil, bu)
bu.bg:SetAllPoints(bu)
bu.bg:SetFrameLevel(0)
bu.bg:SetBackdrop({
edgeFile = C.media.backdrop,
edgeSize = 1,
})
bu.bg:SetBackdropBorderColor(0, 0, 0)
end
local function styleExtraActionButton(bu)
if not bu or (bu and bu.styled) then return end
bu.style:SetTexture(nil)
hooksecurefunc(bu.style, "SetTexture", function(self, texture)
if texture and string.sub(texture, 1, 9) == "Interface" then
self:SetTexture(nil)
end
end)
bu:SetPushedTexture("")
_G[bu:GetName().."HotKey"]:Hide()
bu.icon:SetTexCoord(.08, .92, .08, .92)
bu.icon:SetPoint("TOPLEFT", bu, "TOPLEFT", 1, -1)
bu.icon:SetPoint("BOTTOMRIGHT", bu, "BOTTOMRIGHT", -1, 1)
bu.cooldown:SetAllPoints()
if not bu.bg then applyBackground(bu) end
bu.styled = true
end
local function styleActionButton(bu)
if not bu or (bu and bu.styled) then return end
local name = bu:GetName()
local bo = _G[name.."Border"]
local ic = _G[name.."Icon"]
local co = _G[name.."Count"]
local ho = _G[name.."HotKey"]
local nt = _G[name.."NormalTexture"]
local na = _G[name.."Name"]
local fl = _G[name.."FloatingBG"]
na:Hide()
bo:SetTexture(nil)
co:SetFont("Interface\\Addons\\SharedMedia\\fonts\\rondaseven.ttf", 8, "OUTLINEMONOCHROME")
co:ClearAllPoints()
co:SetPoint("BOTTOMRIGHT", bu, "BOTTOMRIGHT", 1, 2)
co:SetJustifyH("RIGHT")
co:SetDrawLayer("OVERLAY")
if cfg.hotkey == true then
ho:ClearAllPoints()
ho:SetFont("Interface\\Addons\\SharedMedia\\fonts\\rondaseven.ttf", 8, "OUTLINEMONOCHROME")
ho:SetPoint("TOPLEFT", bu, "TOPLEFT", 0, 0)
ho:SetJustifyH("LEFT")
ho:SetDrawLayer("OVERLAY")
else
ho:Hide()
end
bu:SetNormalTexture("")
bu:SetPushedTexture("")
bu:SetHighlightTexture("")
bu:SetCheckedTexture(C.media.backdrop)
local ch = bu:GetCheckedTexture()
ch:SetVertexColor(r, g, b)
ch:SetDrawLayer("ARTWORK")
ch:SetAllPoints(bu)
ic:SetTexCoord(.08, .92, .08, .92)
ic:SetDrawLayer("OVERLAY")
ic:SetPoint("TOPLEFT", bu, "TOPLEFT", 1, -1)
ic:SetPoint("BOTTOMRIGHT", bu, "BOTTOMRIGHT", -1, 1)
if fl then
fl:Hide()
end
if not bu.bg then applyBackground(bu) end
bu.styled = true
end
local function stylePetButton(bu)
if not bu or (bu and bu.styled) then return end
local name = bu:GetName()
local ic = _G[name.."Icon"]
_G[name.."NormalTexture2"]:SetAllPoints(bu)
_G[name.."AutoCastable"]:SetAlpha(0)
bu:SetNormalTexture("")
bu:SetCheckedTexture(C.media.checked)
bu:SetPushedTexture("")
hooksecurefunc(bu, "SetNormalTexture", function(self, texture)
if texture and texture ~= "" then
self:SetNormalTexture("")
end
end)
ic:SetTexCoord(.08, .92, .08, .92)
ic:SetPoint("TOPLEFT", bu, "TOPLEFT", 1, -1)
ic:SetPoint("BOTTOMRIGHT", bu, "BOTTOMRIGHT", -1, 1)
ic:SetDrawLayer("OVERLAY")
if not bu.bg then applyBackground(bu) end
bu.styled = true
end
local buttons = 0
local function flyoutbutton()
for i = 1, buttons do
local bu = _G["SpellFlyoutButton"..i]
if bu and not bu.styled then
styleActionButton(bu)
if bu:GetChecked() then
bu:SetChecked(nil)
end
bu.styled = true
end
end
end
SpellFlyout:HookScript("OnShow", flyoutbutton)
local function styleflyout(self)
if not self.reskinned then
if not self.FlyoutArrow then return end
self.FlyoutBorder:SetAlpha(0)
self.FlyoutBorderShadow:SetAlpha(0)
SpellFlyoutHorizontalBackground:SetAlpha(0)
SpellFlyoutVerticalBackground:SetAlpha(0)
SpellFlyoutBackgroundEnd:SetAlpha(0)
self.reskinned = true
end
for i=1, GetNumFlyouts() do
local x = GetFlyoutID(i)
local _, _, numSlots, isKnown = GetFlyoutInfo(x)
if isKnown then
buttons = numSlots
break
end
end
end
local function updateHotkey(self, actionButtonType)
local ho = _G[self:GetName() .. "HotKey"]
if ho and cfg.hotkey == false then
ho:Hide()
end
end
local function init()
for i = 1, NUM_ACTIONBAR_BUTTONS do
styleActionButton(_G["ActionButton"..i])
styleActionButton(_G["VehicleMenuBarActionButton"..i])
styleActionButton(_G["BonusActionButton"..i])
styleActionButton(_G["MultiBarBottomLeftButton"..i])
styleActionButton(_G["MultiBarBottomRightButton"..i])
styleActionButton(_G["MultiBarRightButton"..i])
styleActionButton(_G["MultiBarLeftButton"..i])
end
for i = 1, NUM_PET_ACTION_SLOTS do
stylePetButton(_G["PetActionButton"..i])
end
for i = 1, NUM_SHAPESHIFT_SLOTS do
local bu = _G["ShapeshiftButton"..i]
if bu then
local ic = _G[bu:GetName().."Icon"]
bu:SetNormalTexture("")
bu:SetPushedTexture("")
bu:SetCheckedTexture(C.media.checked)
F.CreateBG(bu)
ic:SetDrawLayer("ARTWORK")
ic:SetTexCoord(0.08, 0.92, 0.08, 0.92)
end
end
styleExtraActionButton(_G["ExtraActionButton1"])
hooksecurefunc("ActionButton_UpdateHotkeys", updateHotkey)
hooksecurefunc("ActionButton_UpdateFlyout", styleflyout)
end
-- Shortens Hotkey bindings - Thanks Neal!
local gsub = string.gsub
hooksecurefunc('ActionButton_UpdateHotkeys', function(self)
local hotkey = _G[self:GetName()..'HotKey']
local text = hotkey:GetText()
text = gsub(text, '(s%-)', 'S')
text = gsub(text, '(a%-)', 'A')
text = gsub(text, '(c%-)', 'C')
text = gsub(text, '(st%-)', 'C') -- german control 'Steuerung'
for i = 1, 30 do
text = gsub(text, _G['KEY_BUTTON'..i], 'M'..i)
end
for i = 1, 9 do
text = gsub(text, _G['KEY_NUMPAD'..i], 'Nu'..i)
end
text = gsub(text, KEY_MOUSEWHEELUP, 'MU')
text = gsub(text, KEY_MOUSEWHEELDOWN, 'MD')
text = gsub(text, KEY_NUMLOCK, 'NuL')
text = gsub(text, KEY_PAGEUP, 'PU')
text = gsub(text, KEY_PAGEDOWN, 'PD')
text = gsub(text, KEY_SPACE, '_')
text = gsub(text, KEY_INSERT, 'Ins')
text = gsub(text, KEY_HOME, 'Hm')
text = gsub(text, KEY_DELETE, 'Del')
hotkey:SetText(text)
end)
local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_LOGIN")
f:SetScript("OnEvent", init)