This commit is contained in:
Hao Tran 2024-03-02 21:17:02 -05:00
commit 8673094b44
6 changed files with 105 additions and 0 deletions

10
KlazUnitFrames.toc Normal file
View File

@ -0,0 +1,10 @@
## Interface: 100205
## Title: Klaz|cff1994ffUnitFrames|r
## Author: Klaz
## Notes: Styles default unit frames.
## IconTexture: Interface\AddOns\KlazUnitFrames\Media\KlazAddOnIcon.blp
Modules\CastBarTimers.lua
Modules\DarkerTextures.lua
Modules\Hide.lua
Modules\StatusBars.lua

BIN
Media/KlazAddOnIcon.blp Normal file

Binary file not shown.

49
Modules/CastBarTimers.lua Normal file
View File

@ -0,0 +1,49 @@
--------------------------------------------------------------------------------
-- # MODULES > CAST BAR TIMERS
--------------------------------------------------------------------------------
local f = CreateFrame('Frame')
f:RegisterEvent('PLAYER_ENTERING_WORLD')
f:SetScript('OnEvent', function(self, event)
-- player cast bar timer
PlayerCastingBarFrame.timer = PlayerCastingBarFrame:CreateFontString(nil, nil, 'GameFontHighlightSmall')
PlayerCastingBarFrame.timer:SetPoint('BOTTOMRIGHT', PlayerCastingBarFrame, 'BOTTOMRIGHT', -4, -11)
PlayerCastingBarFrame.update = .1
PlayerCastingBarFrame:HookScript('OnUpdate', function(self, elapsed)
if not self.timer then return end
if self.update and self.update < elapsed then
if self.casting then
self.timer:SetText(format('%2.1f/%1.1f', max(self.maxValue - self.value, 0), self.maxValue))
elseif self.channeling then
self.timer:SetText(format('%.1f', max(self.value, 0)))
else
self.timer:SetText('')
end
self.update = .1
else
self.update = self.update - elapsed
end
end)
-- target cast bar timer
TargetFrameSpellBar.timer = TargetFrameSpellBar:CreateFontString(nil, nil, 'GameFontHighlightSmall')
TargetFrameSpellBar.timer:SetPoint('BOTTOMRIGHT', TargetFrameSpellBar, 'BOTTOMRIGHT', -4, -11)
TargetFrameSpellBar.update = .1
TargetFrameSpellBar:HookScript('OnUpdate', function(self, elapsed)
if not self.timer then return end
if self.update and self.update < elapsed then
if self.casting then
self.timer:SetText(format('%2.1f/%1.1f', max(self.maxValue - self.value, 0), self.maxValue))
elseif self.channeling then
self.timer:SetText(format('%.1f', max(self.value, 0)))
else
self.timer:SetText('')
end
self.update = .1
else
self.update = self.update - elapsed
end
end)
end)

View File

@ -0,0 +1,15 @@
--------------------------------------------------------------------------------
-- # MODULES > DARKER TEXTURES
--------------------------------------------------------------------------------
local f = CreateFrame('Frame')
f:RegisterEvent('PLAYER_ENTERING_WORLD')
f:SetScript('OnEvent', function(self, event)
for i, v in pairs ({
-- paladin holy power
PaladinPowerBarFrame.Background, -- no holy power
PaladinPowerBarFrame.ActiveTexture, -- with holy power
}) do
v:SetVertexColor(0.4, 0.4, 0.4)
end
end)

8
Modules/Hide.lua Normal file
View File

@ -0,0 +1,8 @@
--------------------------------------------------------------------------------
-- # MODULES > HIDE TEXT
--------------------------------------------------------------------------------
PlayerFrame:HookScript("OnEvent", function()
-- hide player leader icon
PlayerFrame.PlayerFrameContent.PlayerFrameContentMain.HitIndicator.HitText:Hide()
end)

23
Modules/StatusBars.lua Normal file
View File

@ -0,0 +1,23 @@
--------------------------------------------------------------------------------
-- # MODULES > STATUS BARS
--------------------------------------------------------------------------------
-- Changes health bars to class and target reaction colours
hooksecurefunc('UnitFrameHealthBar_Update', function(self)
local r, g, b
if UnitIsPlayer(self.unit) then
local _, englishClass = UnitClass(self.unit)
r, g, b = GetClassColor(englishClass)
else
local reaction = UnitReaction(self.unit, 'player')
if reaction then
r, g, b = FACTION_BAR_COLORS[reaction].r, FACTION_BAR_COLORS[reaction].g, FACTION_BAR_COLORS[reaction].b
else
r, g, b = 1, 1, 1
end
end
self:SetStatusBarDesaturated(true)
self:SetStatusBarColor(r, g, b)
end)