Skip to content

Commit

Permalink
Cleanup and updates.
Browse files Browse the repository at this point in the history
I tired to fix the health alert and improve it for pets causing the error.
  • Loading branch information
Kkthnx committed Dec 11, 2024
1 parent 1a0f842 commit beea6ce
Show file tree
Hide file tree
Showing 16 changed files with 308 additions and 311 deletions.
Binary file removed KkthnxUI/Media/Textures/bgTex.blp
Binary file not shown.
49 changes: 27 additions & 22 deletions KkthnxUI/Modules/ActionBars/ButtonStyle.lua
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
local K = KkthnxUI[1]
local Module = K:GetModule("ActionBar")

-- WoW API
local CreateFrame = CreateFrame

-- Lua functions
local gsub = string.gsub
local ipairs = ipairs

-- Constants
local KEY_BUTTON4, KEY_NUMPAD1, RANGE_INDICATOR = KEY_BUTTON4, KEY_NUMPAD1, RANGE_INDICATOR

-- Processing key strings
local keyButton = gsub(KEY_BUTTON4, "%d", "") -- Removes digits from KEY_BUTTON4
local keyNumpad = gsub(KEY_NUMPAD1, "%d", "") -- Removes digits from KEY_NUMPAD1
local keyButton = gsub(KEY_BUTTON4, "%d", "")
local keyNumpad = gsub(KEY_NUMPAD1, "%d", "")

local replaces = {
{ "(" .. keyButton .. ")", "M" },
Expand Down Expand Up @@ -48,7 +37,7 @@ function Module:UpdateHotKey()
if text == RANGE_INDICATOR then
text = ""
else
for _, value in ipairs(replaces) do
for _, value in pairs(replaces) do
text = gsub(text, value[1], value[2])
end
end
Expand All @@ -71,6 +60,7 @@ function Module:StyleActionButton(button)
if not button then
return
end

if button.__styled then
return
end
Expand All @@ -79,6 +69,8 @@ function Module:StyleActionButton(button)
local icon = button.icon
local cooldown = button.cooldown
local hotkey = button.HotKey
local count = button.Count
local name = button.Name
local flash = button.Flash
local border = button.Border
local normal = button.NormalTexture
Expand All @@ -96,35 +88,45 @@ function Module:StyleActionButton(button)
if normal then
normal:SetAlpha(0)
end

if normal2 then
normal2:SetAlpha(0)
end

if flash then
flash:SetTexture(nil)
end

if newActionTexture then
newActionTexture:SetTexture(nil)
end

if border then
border:SetTexture(nil)
end

if slotbg then
slotbg:Hide()
end

if iconMask then
iconMask:Hide()
end

if button.style then
button.style:SetAlpha(0)
end

if petShine then
petShine:SetAllPoints()
end

if autoCastable then
autoCastable:SetTexCoord(0.217, 0.765, 0.217, 0.765)
autoCastable:SetDrawLayer("OVERLAY", 3)
autoCastable:SetAllPoints()
end

if icon then
icon:SetAllPoints()
if not icon.__lockdown then
Expand All @@ -138,12 +140,12 @@ function Module:StyleActionButton(button)
button.__bg:CreateBorder(nil, nil, nil, nil, nil, nil, K.MediaFolder .. "Skins\\UI-Slot-Background", nil, nil, nil, { 1, 1, 1 })
end
end

if cooldown then
cooldown:SetPoint("TOPLEFT", button, "TOPLEFT", 1, -1)
cooldown:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -1, 1)
cooldown:SetDrawEdge(false)
cooldown:SetSwipeColor(0, 0, 0, 1)
end

if pushed then
pushed:SetTexture("Interface\\Buttons\\ButtonHilight-Square")
pushed:SetDesaturated(true)
Expand All @@ -152,21 +154,25 @@ function Module:StyleActionButton(button)
pushed:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -0, 0)
pushed:SetBlendMode("ADD")
end

if checked then
checked:SetTexture("Interface\\Buttons\\CheckButtonHilight")
checked:SetPoint("TOPLEFT", button, "TOPLEFT", 0, -0)
checked:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -0, 0)
checked:SetBlendMode("ADD")
end

if highlight then
highlight:SetTexture("Interface\\Buttons\\ButtonHilight-Square")
highlight:SetPoint("TOPLEFT", button, "TOPLEFT", 0, -0)
highlight:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -0, 0)
highlight:SetBlendMode("ADD")
end

if spellHighlight then
spellHighlight:SetAllPoints()
end

if hotkey then
Module.UpdateHotKey(hotkey)
hooksecurefunc(hotkey, "SetText", Module.UpdateHotKey)
Expand All @@ -186,30 +192,29 @@ function Module:ReskinBars()
for i = 1, NUM_PET_ACTION_SLOTS do
Module:StyleActionButton(_G["PetActionButton" .. i])
end

-- stancebar buttons
for i = 1, 10 do
Module:StyleActionButton(_G["StanceButton" .. i])
end

-- leave vehicle
Module:StyleActionButton(_G["KKUI_LeaveVehicleButton"])

-- extra action button
Module:StyleActionButton(ExtraActionButton1)

-- spell flyout
SpellFlyout.Background:SetAlpha(0)
local numFlyouts = 1

local function checkForFlyoutButtons()
local button = _G["SpellFlyoutButton" .. numFlyouts]
while button do
Module:StyleActionButton(button)
numFlyouts = numFlyouts + 1
button = _G["SpellFlyoutButton" .. numFlyouts]
end
numFlyouts = 1 -- Reset numFlyouts after styling all buttons
end

SpellFlyout:HookScript("OnShow", checkForFlyoutButtons)
SpellFlyout:HookScript("OnHide", function()
numFlyouts = 1
end) -- Also reset when the flyout is hidden
SpellFlyout:HookScript("OnHide", checkForFlyoutButtons)
end
Loading

0 comments on commit beea6ce

Please sign in to comment.