This commit is contained in:
Hao Tran 2024-03-07 21:38:29 -05:00
commit 4732a6f41c
7 changed files with 177 additions and 0 deletions

11
KlazBars.toc Normal file
View File

@ -0,0 +1,11 @@
## Interface: 100205
## Title: Klaz|cff1994ffBars|r
## Author: Klaz
## Notes: Styles default action bars
## OptionalDeps: LibStub, LibSharedMedia-3.0, Masque
## IconTexture: Interface\AddOns\KlazBars\Media\KlazAddOnIcon.blp
Modules\ButtonIndicators.lua
Modules\HotKeys.lua
Modules\MacroNames.lua
Modules\Style.lua

BIN
Media/KlazAddOnIcon.blp Normal file

Binary file not shown.

View File

@ -0,0 +1,32 @@
--------------------------------------------------------------------------------
-- # MODULES > BUTTON INDICATORS
--------------------------------------------------------------------------------
local f = CreateFrame('Frame')
f:RegisterEvent('PLAYER_ENTERING_WORLD')
f:SetScript('OnEvent', function(self, event)
hooksecurefunc('ActionButton_UpdateRangeIndicator', function(self, checksRange, inRange)
local icon = self.icon
if self.action then
local normalTexture = self.NormalTexture
if not normalTexture then return end
local isUsable, notEnoughMana = IsUsableAction(self.action)
if isUsable then
icon:SetVertexColor(1, 1, 1)
normalTexture:SetVertexColor(1, 1, 1)
elseif notEnoughMana then
icon:SetVertexColor(0.2, 0.2, 1)
normalTexture:SetVertexColor(0.2, 0.2, 1)
else
icon:SetVertexColor(0.5, 0.5, 0.5)
normalTexture:SetVertexColor(0.5, 0.5, 0.5)
end
if checksRange and not inRange then
icon:SetVertexColor(1, 0, 0)
end
end
end)
end)

57
Modules/HotKeys.lua Normal file
View File

@ -0,0 +1,57 @@
--------------------------------------------------------------------------------
-- # MODULES > HOT KEYS
--------------------------------------------------------------------------------
local f = CreateFrame('Frame')
f:RegisterEvent('PLAYER_ENTERING_WORLD')
f:RegisterEvent('UPDATE_BINDINGS')
f:SetScript('OnEvent', function(self, event)
local gsub = string.gsub
local function UpdateHotkey(self)
local alpha = 0.75
local hotkey = _G[self:GetName()..'HotKey']
local text = hotkey:GetText()
if not text then return end
text = gsub(text, '(s%-)', 'S')
text = gsub(text, '(a%-)', 'A')
text = gsub(text, '(а%-)', 'A')
text = gsub(text, '(c%-)', 'C')
text = gsub(text, '(Mouse Button )', 'M')
text = gsub(text, '(Кнопка мыши )', 'M')
text = gsub(text, KEY_BUTTON3, 'M3')
text = gsub(text, KEY_PAGEUP, 'PU')
text = gsub(text, KEY_PAGEDOWN, 'PD')
text = gsub(text, KEY_SPACE, 'SpB')
text = gsub(text, KEY_INSERT, 'Ins')
text = gsub(text, KEY_HOME, 'Hm')
text = gsub(text, KEY_DELETE, 'Del')
text = gsub(text, KEY_NUMPADDECIMAL, 'Nu.')
text = gsub(text, KEY_NUMPADDIVIDE, 'Nu/')
text = gsub(text, KEY_NUMPADMINUS, 'Nu-')
text = gsub(text, KEY_NUMPADMULTIPLY, 'Nu*')
text = gsub(text, KEY_NUMPADPLUS, 'Nu+')
text = gsub(text, KEY_NUMLOCK, 'NuL')
text = gsub(text, KEY_MOUSEWHEELDOWN, 'MWD')
text = gsub(text, KEY_MOUSEWHEELUP, 'MWU')
hotkey:SetText(text)
hotkey:SetAlpha(alpha)
end
for i = 1, 12 do
UpdateHotkey(_G['ActionButton'..i]) -- main bar
UpdateHotkey(_G['MultiBarBottomLeftButton'..i]) -- bottom right bar
UpdateHotkey(_G['MultiBarBottomRightButton'..i]) -- bottom left bar
UpdateHotkey(_G['MultiBarLeftButton'..i]) -- right bar
UpdateHotkey(_G['MultiBarRightButton'..i]) -- left bar
UpdateHotkey(_G['MultiBar5Button'..i]) -- multi bar 5 (added in Dragonflight)
UpdateHotkey(_G['MultiBar6Button'..i]) -- multi bar 6 (added in Dragonflight)
UpdateHotkey(_G['MultiBar7Button'..i]) -- multi bar 7 (added in Dragonflight)
end
for i = 1, 10 do
UpdateHotkey(_G['StanceButton'..i])
UpdateHotkey(_G['PetActionButton'..i])
end
UpdateHotkey(ExtraActionButton1)
end)

19
Modules/MacroNames.lua Normal file
View File

@ -0,0 +1,19 @@
--------------------------------------------------------------------------------
-- # MODULES > MACRO NAMES
--------------------------------------------------------------------------------
local f = CreateFrame('Frame')
f:RegisterEvent('PLAYER_ENTERING_WORLD')
f:SetScript('OnEvent', function(self, event)
local macroNamesAlpha = 0
for i = 1, 12 do
_G['ActionButton'..i..'Name']:SetAlpha(macroNamesAlpha) -- main bar
_G['MultiBarBottomRightButton'..i..'Name']:SetAlpha(macroNamesAlpha) -- bottom right bar
_G['MultiBarBottomLeftButton'..i..'Name']:SetAlpha(macroNamesAlpha) -- bottom left bar
_G['MultiBarRightButton'..i..'Name']:SetAlpha(macroNamesAlpha) -- right bar
_G['MultiBarLeftButton'..i..'Name']:SetAlpha(macroNamesAlpha) -- left bar
_G['MultiBar5Button'..i..'Name']:SetAlpha(macroNamesAlpha) -- multi bar 5 (added in Dragonflight)
_G['MultiBar6Button'..i..'Name']:SetAlpha(macroNamesAlpha) -- multi bar 6 (added in Dragonflight)
_G['MultiBar7Button'..i..'Name']:SetAlpha(macroNamesAlpha) -- multi bar 7 (added in Dragonflight)
end
end)

37
Modules/Style.lua Normal file
View File

@ -0,0 +1,37 @@
if IsAddOnLoaded("Masque") ~= true then return end
--------------------------------------------------------------------------------
-- # MODULES > STYLE
--------------------------------------------------------------------------------
local Masque = LibStub('Masque', true)
assert(Masque, 'Masque not found')
local group = Masque:Group('KlazBars')
local function AddActionBarButtons()
for _, name in pairs({
'PetActionButton',
'PossessButton',
'StanceButton',
'ActionButton',
'MultiBarBottomLeftButton',
'MultiBarBottomRightButton',
'MultiBarLeftButton',
'MultiBarRightButton',
'MultiBar5Button',
'MultiBar6Button',
'MultiBar7Button',
}) do
for i = 1, 12 do
local button = _G[name..i]
if button then group:AddButton(button) end
end
end
end
local f = CreateFrame('Frame')
f:RegisterEvent('PLAYER_ENTERING_WORLD')
f:SetScript('OnEvent', function(self, event)
AddActionBarButtons()
end)

21
README.md Normal file
View File

@ -0,0 +1,21 @@
# KlazBars
A World of Warcraft add-on that styles default action bars.
There are no in-game options. All settings are hard-coded.
## Features
- Enable styling action buttons with [Masque](https://www.curseforge.com/wow/addons/masque)
- Reduce transparency/alpha for hotkey bindings text
- Reduce transparency/alpha for macro names text
- Add action button indicators
- Red = Out of range
- Blue = Out of resources
## Installation
1. Backup `World of Warcraft\_retail_\Interface` and `World of Warcraft\_retail_\WTF` folders. Just in case.
2. Download and extract folder.
3. Place extracted folder in `World of Warcraft\_retail_\Interface\AddOns\` directory.
4. Restart World of Warcraft client.