commit 4732a6f41cb43c04abdaff9a78d0bfd8cd86945e Author: KlazHTT Date: Thu Mar 7 21:38:29 2024 -0500 Init diff --git a/KlazBars.toc b/KlazBars.toc new file mode 100644 index 0000000..f7364c7 --- /dev/null +++ b/KlazBars.toc @@ -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 diff --git a/Media/KlazAddOnIcon.blp b/Media/KlazAddOnIcon.blp new file mode 100644 index 0000000..f65d211 Binary files /dev/null and b/Media/KlazAddOnIcon.blp differ diff --git a/Modules/ButtonIndicators.lua b/Modules/ButtonIndicators.lua new file mode 100644 index 0000000..5f94856 --- /dev/null +++ b/Modules/ButtonIndicators.lua @@ -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) diff --git a/Modules/HotKeys.lua b/Modules/HotKeys.lua new file mode 100644 index 0000000..07b36a1 --- /dev/null +++ b/Modules/HotKeys.lua @@ -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) diff --git a/Modules/MacroNames.lua b/Modules/MacroNames.lua new file mode 100644 index 0000000..504a2d9 --- /dev/null +++ b/Modules/MacroNames.lua @@ -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) diff --git a/Modules/Style.lua b/Modules/Style.lua new file mode 100644 index 0000000..27c2cfd --- /dev/null +++ b/Modules/Style.lua @@ -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) diff --git a/README.md b/README.md new file mode 100644 index 0000000..5446ca8 --- /dev/null +++ b/README.md @@ -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.