commit 8673094b447dc34607ed15d263c531faceb3bead Author: KlazHTT Date: Sat Mar 2 21:17:02 2024 -0500 Init diff --git a/KlazUnitFrames.toc b/KlazUnitFrames.toc new file mode 100644 index 0000000..ceb8bff --- /dev/null +++ b/KlazUnitFrames.toc @@ -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 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/CastBarTimers.lua b/Modules/CastBarTimers.lua new file mode 100644 index 0000000..05d5895 --- /dev/null +++ b/Modules/CastBarTimers.lua @@ -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) diff --git a/Modules/DarkerTextures.lua b/Modules/DarkerTextures.lua new file mode 100644 index 0000000..9cc0de4 --- /dev/null +++ b/Modules/DarkerTextures.lua @@ -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) diff --git a/Modules/Hide.lua b/Modules/Hide.lua new file mode 100644 index 0000000..dda276a --- /dev/null +++ b/Modules/Hide.lua @@ -0,0 +1,8 @@ +-------------------------------------------------------------------------------- +-- # MODULES > HIDE TEXT +-------------------------------------------------------------------------------- + +PlayerFrame:HookScript("OnEvent", function() + -- hide player leader icon + PlayerFrame.PlayerFrameContent.PlayerFrameContentMain.HitIndicator.HitText:Hide() +end) diff --git a/Modules/StatusBars.lua b/Modules/StatusBars.lua new file mode 100644 index 0000000..0bcd921 --- /dev/null +++ b/Modules/StatusBars.lua @@ -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)