Skip to content

Commit

Permalink
And now it works for Classic, Cata, and Retail
Browse files Browse the repository at this point in the history
  • Loading branch information
kiforsbe committed Aug 24, 2024
1 parent 5e660e7 commit 1abff93
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 12 deletions.
2 changes: 1 addition & 1 deletion UnitFramesImproved_Cata.toc
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ Libs\AceEvent-3.0\AceEvent-3.0.xml
#@end-no-lib-strip@

HelperFunctions.lua
UnitFramesImproved_Cata.lua
UnitFramesImproved.lua
UnitFramesImproved_Vanilla.lua
52 changes: 41 additions & 11 deletions UnitFramesImproved_Vanilla.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
function UnitFramesImproved:Style_PlayerFrame()
PlayerFrameHealthBar.healthbar = PlayerFrameHealthBar

-- Set up some local variables
local healthBar = PlayerFrameHealthBar
local manaBar = PlayerFrameManaBar
if not InCombatLockdown() then

if (not InCombatLockdown()) then
healthBar.lockColor = true
healthBar.capNumericDisplay = true
healthBar:SetWidth(119)
Expand All @@ -16,6 +18,11 @@ function UnitFramesImproved:Style_PlayerFrame()
healthBar.LeftText:SetPoint("LEFT",110,6)
healthBar.RightText:SetPoint("RIGHT",-8,6)

-- Style the manabar fontstrings
UnitFramesImproved:SetFontSize(healthBar.TextString, 14)
UnitFramesImproved:SetFontSize(healthBar.LeftText, 14)
UnitFramesImproved:SetFontSize(healthBar.RightText, 14)

-- Set fonts sizes for PlayerFrameManabar
UnitFramesImproved:SetFontSize(manaBar.TextString, 12)
UnitFramesImproved:SetFontSize(manaBar.LeftText, 12)
Expand All @@ -34,24 +41,47 @@ function UnitFramesImproved:Style_PlayerFrame()
end

function UnitFramesImproved:Style_TargetFrame(frame)
-- Exit early if the frame is nil, such as in Vanilla, where the FocusFrame doesn't exist. But the addon will anyway try to style it to keep the code common.
if (not frame) then
return
end

-- Set up some local variables
local healthBar = frame.healthbar
local manaBar = frame.manabar
if not InCombatLockdown() then
-- Create healthbar and manabar status texts
if (healthBar and not healthBar.LeftText and not healthBar.TextString and not healthBar.RightText) then
healthBar.TextString = UnitFramesImproved:CreateStatusBarText("Text", frame:GetName().."HealthBar", frame.textureFrame, "CENTER", -50, 6)
healthBar.LeftText = UnitFramesImproved:CreateStatusBarText("TextLeft", frame:GetName().."HealthBar", frame.textureFrame, "LEFT", 8, 6)
healthBar.RightText = UnitFramesImproved:CreateStatusBarText("TextRight", frame:GetName().."HealthBar", frame.textureFrame, "RIGHT", -110, 6)

if (not InCombatLockdown()) then
-- Create and/or style the healthBar texts
if (healthBar) then
if (not healthBar.LeftText and not healthBar.TextString and not healthBar.RightText) then
healthBar.TextString = UnitFramesImproved:CreateStatusBarText("Text", frame:GetName().."HealthBar", frame.textureFrame, "CENTER", -50, 6)
healthBar.LeftText = UnitFramesImproved:CreateStatusBarText("TextLeft", frame:GetName().."HealthBar", frame.textureFrame, "LEFT", 8, 6)
healthBar.RightText = UnitFramesImproved:CreateStatusBarText("TextRight", frame:GetName().."HealthBar", frame.textureFrame, "RIGHT", -110, 6)
else
-- Adjust fontstring anchors
healthBar.TextString:SetPoint("CENTER",50,6)
healthBar.LeftText:SetPoint("LEFT",8,6)
healthBar.RightText:SetPoint("RIGHT",-110,6)
end

-- Style the manabar fontstrings
UnitFramesImproved:SetFontSize(healthBar.TextString, 14)
UnitFramesImproved:SetFontSize(healthBar.LeftText, 14)
UnitFramesImproved:SetFontSize(healthBar.RightText, 14)
end

if (manaBar and not manaBar.LeftText and not manaBar.TextString and not manaBar.RightText) then
manaBar.TextString = UnitFramesImproved:CreateStatusBarText("Text", frame:GetName().."ManaBar", frame.textureFrame, "CENTER", -50, -8)
manaBar.LeftText = UnitFramesImproved:CreateStatusBarText("TextLeft", frame:GetName().."ManaBar", frame.textureFrame, "LEFT", 8, -8)
manaBar.RightText = UnitFramesImproved:CreateStatusBarText("TextRight", frame:GetName().."ManaBar", frame.textureFrame, "RIGHT", -110, -8)
-- Create and/or style the manaBar texts
if (manaBar) then
if (not manaBar.LeftText and not manaBar.TextString and not manaBar.RightText) then
manaBar.TextString = UnitFramesImproved:CreateStatusBarText("Text", frame:GetName().."ManaBar", frame.textureFrame, "CENTER", -50, -8)
manaBar.LeftText = UnitFramesImproved:CreateStatusBarText("TextLeft", frame:GetName().."ManaBar", frame.textureFrame, "LEFT", 8, -8)
manaBar.RightText = UnitFramesImproved:CreateStatusBarText("TextRight", frame:GetName().."ManaBar", frame.textureFrame, "RIGHT", -110, -8)
else
-- Adjust fontstring anchors
manaBar.TextString:SetPoint("CENTER",-50,-8)
manaBar.LeftText:SetPoint("LEFT",8,-8)
manaBar.RightText:SetPoint("RIGHT",-110,-8)
end

-- Style the manabar fontstrings
UnitFramesImproved:SetFontSize(manaBar.TextString, 12)
Expand Down

0 comments on commit 1abff93

Please sign in to comment.