Skip to content

Commit

Permalink
Added rButtonTemplate:StyleAuraButton
Browse files Browse the repository at this point in the history
All button template theme can now style the player BuffFrame aura
buttons (BuffButton, DebuffButton, TempEnchant)
  • Loading branch information
zorker committed Jul 27, 2016
1 parent eaa144a commit eaf0b34
Show file tree
Hide file tree
Showing 13 changed files with 126 additions and 211 deletions.
71 changes: 71 additions & 0 deletions wow7.0/rButtonTemplate/core.lua
Expand Up @@ -280,4 +280,75 @@ function rButtonTemplate:StyleAllActionButtons(cfg)
for i=1, NUM_POSSESS_SLOTS do
rButtonTemplate:StyleActionButton(_G["PossessButton"..i],cfg)
end
end

function rButtonTemplate:StyleAuraButton(button, cfg)
if not button then return end
if button.__styled then return end

local buttonName = button:GetName()
local icon = _G[buttonName.."Icon"]
local count = _G[buttonName.."Count"]
local duration = _G[buttonName.."Duration"]
local border = _G[buttonName.."Border"]
local symbol = button.symbol

--backdrop
SetupBackdrop(button,cfg.backdrop)

--textures
SetupTexture(icon,cfg.icon,"SetTexture",icon)
SetupTexture(border,cfg.border,"SetTexture",border)

--create a normal texture on the aura button
if cfg.normalTexture and cfg.normalTexture.file then
button:SetNormalTexture(cfg.normalTexture.file)
local normalTexture = button:GetNormalTexture()
SetupTexture(normalTexture,cfg.normalTexture,"SetNormalTexture",button)
end

--count,duration,symbol
SetupFontString(count,cfg.count)
SetupFontString(duration,cfg.duration)
SetupFontString(symbol,cfg.symbol)

button.__styled = true
end

--style player BuffFrame buff buttons
local buffButtonIndex = 1
function rButtonTemplate:StyleBuffButtons(cfg)
local function UpdateBuffButtons()
if buffButtonIndex > BUFF_MAX_DISPLAY then return end
for i = buffButtonIndex, BUFF_MAX_DISPLAY do
local button = _G["BuffButton"..i]
if not button then break end
rButtonTemplate:StyleAuraButton(button, cfg)
if button.__styled then buffButtonIndex = i+1 end
end
end
hooksecurefunc("BuffFrame_UpdateAllBuffAnchors", UpdateBuffButtons)
end

--style player BuffFrame debuff buttons
function rButtonTemplate:StyleDebuffButtons(cfg)
local function UpdateDebuffButton(buttonName, i)
local button = _G["DebuffButton"..i]
rButtonTemplate:StyleAuraButton(button, cfg)
end
hooksecurefunc("DebuffButton_UpdateAnchors", UpdateDebuffButton)
end

--style player TempEnchant buttons
function rButtonTemplate:StyleTempEnchants(cfg)
rButtonTemplate:StyleAuraButton(TempEnchant1, cfg)
rButtonTemplate:StyleAuraButton(TempEnchant2, cfg)
rButtonTemplate:StyleAuraButton(TempEnchant3, cfg)
end

--style all aura buttons
function rButtonTemplate:StyleAllAuraButtons(cfg)
rButtonTemplate:StyleBuffButtons(cfg)
rButtonTemplate:StyleDebuffButtons(cfg)
rButtonTemplate:StyleTempEnchants(cfg)
end
36 changes: 27 additions & 9 deletions wow7.0/rButtonTemplate_Default/theme.lua
Expand Up @@ -116,10 +116,7 @@ actionButtonConfig.count = {
},
}

-----------------------------
-- rButtonTemplate:StyleAllActionButtons
-----------------------------

--rButtonTemplate:StyleAllActionButtons
rButtonTemplate:StyleAllActionButtons(actionButtonConfig)

-----------------------------
Expand All @@ -135,10 +132,7 @@ itemButtonConfig.stock = actionButtonConfig.name
itemButtonConfig.border = { file = "" }
itemButtonConfig.normalTexture = actionButtonConfig.normalTexture

-----------------------------
-- rButtonTemplate:StyleItemButton
-----------------------------

--rButtonTemplate:StyleItemButton
local itemButtons = { MainMenuBarBackpackButton, CharacterBag0Slot, CharacterBag1Slot, CharacterBag2Slot, CharacterBag3Slot }
for i, button in next, itemButtons do
rButtonTemplate:StyleItemButton(button, itemButtonConfig)
Expand All @@ -151,4 +145,28 @@ end
local extraButtonConfig = actionButtonConfig
extraButtonConfig.buttonstyle = { file = "" }

rButtonTemplate:StyleExtraActionButton(extraButtonConfig)
--rButtonTemplate:StyleExtraActionButton
rButtonTemplate:StyleExtraActionButton(extraButtonConfig)

-----------------------------
-- auraButtonConfig
-----------------------------

local auraButtonConfig = {}

auraButtonConfig.backdrop = actionButtonConfig.backdrop
auraButtonConfig.icon = actionButtonConfig.icon
auraButtonConfig.border = actionButtonConfig.border
auraButtonConfig.normalTexture = actionButtonConfig.normalTexture
auraButtonConfig.count = actionButtonConfig.count
auraButtonConfig.duration = actionButtonConfig.hotkey
auraButtonConfig.symbol = actionButtonConfig.name

--fix blizzard time abbrev
HOUR_ONELETTER_ABBR = "%dh"
DAY_ONELETTER_ABBR = "%dd"
MINUTE_ONELETTER_ABBR = "%dm"
SECOND_ONELETTER_ABBR = "%ds"

--rButtonTemplate:StyleAllAuraButtons
rButtonTemplate:StyleAllAuraButtons(auraButtonConfig)
Binary file removed wow7.0/rButtonTemplate_Gloss/media/backdrop.tga
Binary file not shown.
Binary file not shown.
Binary file removed wow7.0/rButtonTemplate_Gloss/media/border.tga
Binary file not shown.
Binary file removed wow7.0/rButtonTemplate_Gloss/media/checked.tga
Binary file not shown.
Binary file removed wow7.0/rButtonTemplate_Gloss/media/flash.tga
Binary file not shown.
Binary file removed wow7.0/rButtonTemplate_Gloss/media/highlight.tga
Binary file not shown.
Binary file removed wow7.0/rButtonTemplate_Gloss/media/normal.tga
Binary file not shown.
Binary file removed wow7.0/rButtonTemplate_Gloss/media/pushed.tga
Binary file not shown.
7 changes: 0 additions & 7 deletions wow7.0/rButtonTemplate_Gloss/rButtonTemplate_Gloss.toc

This file was deleted.

184 changes: 0 additions & 184 deletions wow7.0/rButtonTemplate_Gloss/theme.lua

This file was deleted.

39 changes: 28 additions & 11 deletions wow7.0/rButtonTemplate_Zork/theme.lua
Expand Up @@ -2,7 +2,7 @@
-- rButtonTemplate_Zork: theme
-- zork, 2016

-- Zork's' Button Theme for rButtonTemplate
-- Zork's Button Theme for rButtonTemplate

-----------------------------
-- Variables
Expand Down Expand Up @@ -96,7 +96,6 @@ actionButtonConfig.name = {
{"BOTTOMLEFT", 0, 0 },
{"BOTTOMRIGHT", 0, 0 },
},
alpha = 0,
}

--hotkey
Expand All @@ -117,10 +116,7 @@ actionButtonConfig.count = {
},
}

-----------------------------
-- rButtonTemplate:StyleAllActionButtons
-----------------------------

--rButtonTemplate:StyleAllActionButtons
rButtonTemplate:StyleAllActionButtons(actionButtonConfig)

-----------------------------
Expand All @@ -136,10 +132,7 @@ itemButtonConfig.stock = actionButtonConfig.name
itemButtonConfig.border = { file = "" }
itemButtonConfig.normalTexture = actionButtonConfig.normalTexture

-----------------------------
-- rButtonTemplate:StyleItemButton
-----------------------------

--rButtonTemplate:StyleItemButton
local itemButtons = { MainMenuBarBackpackButton, CharacterBag0Slot, CharacterBag1Slot, CharacterBag2Slot, CharacterBag3Slot }
for i, button in next, itemButtons do
rButtonTemplate:StyleItemButton(button, itemButtonConfig)
Expand All @@ -152,4 +145,28 @@ end
local extraButtonConfig = actionButtonConfig
extraButtonConfig.buttonstyle = { file = "" }

rButtonTemplate:StyleExtraActionButton(extraButtonConfig)
--rButtonTemplate:StyleExtraActionButton
rButtonTemplate:StyleExtraActionButton(extraButtonConfig)

-----------------------------
-- auraButtonConfig
-----------------------------

local auraButtonConfig = {}

auraButtonConfig.backdrop = actionButtonConfig.backdrop
auraButtonConfig.icon = actionButtonConfig.icon
auraButtonConfig.border = actionButtonConfig.border
auraButtonConfig.normalTexture = actionButtonConfig.normalTexture
auraButtonConfig.count = actionButtonConfig.count
auraButtonConfig.duration = actionButtonConfig.hotkey
auraButtonConfig.symbol = actionButtonConfig.name

--fix blizzard time abbrev
HOUR_ONELETTER_ABBR = "%dh"
DAY_ONELETTER_ABBR = "%dd"
MINUTE_ONELETTER_ABBR = "%dm"
SECOND_ONELETTER_ABBR = "%ds"

--rButtonTemplate:StyleAllAuraButtons
rButtonTemplate:StyleAllAuraButtons(auraButtonConfig)

0 comments on commit eaf0b34

Please sign in to comment.