From 077254f5b1efb94ba634026201eab6f854ea7203 Mon Sep 17 00:00:00 2001 From: Tek Hudson Date: Fri, 10 Jan 2020 18:21:38 -0800 Subject: [PATCH] Fix replace text garbage, stage 1 --- DruidBar.lua | 89 ++++++++++++++++++++++++++++++++-------------------------- DruidBar.xml | 34 +++++++++++----------- 2 files changed, 67 insertions(+), 56 deletions(-) diff --git a/DruidBar.lua b/DruidBar.lua index 517b4ca..5dcba58 100644 --- a/DruidBar.lua +++ b/DruidBar.lua @@ -113,6 +113,7 @@ function DruidBar_OnUpdate(self, elapsed) if DruidBarKey.Graphics then if DruidBarKey.Replace then DruidBar_ReplaceGraphics(); + DruidBar_ColorAndStrataAndTexture(); else DruidBarMana:SetMinMaxValues(0, DruidBarKey.maxmana); DruidBarMana:SetValue(DruidBarKey.currentmana); @@ -338,7 +339,7 @@ function DruidBar_MainGraphics() end end -function DruidBar_TextStyle() +function DruidBar_TextStyle if DruidBarKey.Percent then if DruidBarKey.Percent == 0 then -- Numbers dbarShow(DruidBarTextCenter); @@ -380,9 +381,7 @@ function DruidBar_TextRenderer() -- Text options -- if DruidBarKey.Text then - if DruidBarKey.Text == 0 or DruidBarKey.Text == 1 then - DruidBar_TextStyle() - elseif DruidBarKey.Text == 2 and (MouseIsOver(DruidBarFrame) or MouseIsOver(PlayerFrameManaBar)) then + if DruidBarKey.Text == 0 or DruidBarKey.Text == 1 or (DruidBarKey.Text == 2 and (MouseIsOver(DruidBarFrame) or MouseIsOver(PlayerFrameManaBar))) then DruidBar_TextStyle() end end @@ -406,57 +405,67 @@ end function DruidBar_ReplaceGraphics() if UnitPowerType("player") ~= 0 then - dbarShow(DruidBarFrame); dbarHide(DruidBarManaBackground); dbarHide(DruidBarBorder); dbarHide(DruidBarTextLeft); dbarHide(DruidBarTextCenter); dbarHide(DruidBarTextRight); dbarHide(PlayerFrameManaBarText); + + dbarShow(DruidBarFrame); dbarShow(DruidBarReplaceText); PlayerFrameManaBar:SetWidth(60); DruidBarFrame:ClearAllPoints(); - DruidBarFrame:SetPoint("TOPLEFT","PlayerFrame","TOPLEFT", 116, -50); + DruidBarFrame:SetPoint("CENTER","PlayerFrameManaBar","CENTER", 60, 0); DruidBarMana:SetWidth(60); DruidBarMana:SetHeight(10); - -- DruidBarMana:SetFrameLevel("1"); - local str, str1; - str = "|CFFFFFFFF"..UnitPower("player").."|r"; - if DruidBarKey.Percent and DruidBarKey.Percent == 1 then - str1 = "|CFFFFFFFF"..floor(DruidBarKey.currentmana / DruidBarKey.maxmana * 100).."%|r"; - elseif DruidBarKey.Percent then - str1 = "|CFFFFFFFF"..floor(DruidBarKey.currentmana).."|r"; - else - str1 = "|CFFFFFFFF"..(floor(DruidBarKey.currentmana / 100)/10).."k,"..floor(DruidBarKey.currentmana / DruidBarKey.maxmana * 100).."%|r"; - end - -- DruidBarReplaceText:SetFrameLevel("2"); - if (DruidBarKey.Text and DruidBarKey.Text == 1) or (DruidBarKey.Text == 2 and (MouseIsOver(DruidBarFrame) or MouseIsOver(PlayerFrameManaBar))) then - dbarShow(DEnergyText1); - dbarShow(DManaText1); - dbarHide(DManaText); - dbarHide(DEnergyText); - DEnergyText1:SetText(str); - DManaText1:SetText(str1); - elseif DruidBarKey.Text then - dbarShow(DEnergyText); - dbarHide(DEnergyText1); - dbarShow(DManaText); - dbarHide(DManaText1); - DEnergyText:SetText(str); - DManaText:SetText(str1); - else - dbarHide(DEnergyText); - dbarHide(DEnergyText1); - dbarHide(DManaText); - dbarHide(DManaText1); + + dbarHide(DBarTextLeft); + dbarHide(DBarTextCenter); + dbarHide(DBarTextRight); + if DruidBarKey.Text == 0 or DruidBarKey.Text == 1 or (DruidBarKey.Text == 2 and (MouseIsOver(DruidBarFrame) or MouseIsOver(PlayerFrameManaBar))) then + if DruidBarKey.Percent then + if DruidBarKey.Percent == 0 then -- Numbers + dbarShow(DBarTextCenter); + DBarTextCenter:SetText(ManaValues()); + DBarTextCenter:SetTextColor(1,1,1,1); + elseif DruidBarKey.Percent == 1 then -- Percent + dbarShow(DBarTextCenter); + DBarTextCenter:SetText(ManaPercentage()); + DBarTextCenter:SetTextColor(1,1,1,1); + elseif DruidBarKey.Percent == 2 then -- Bliz-Like + dbarShow(DBarTextLeft); + dbarShow(DBarTextRight); + DBarTextLeft:SetText(ManaPercentage()); + DBarTextRight:SetText(CurrentMana()); + DBarTextLeft:SetTextColor(1,1,1,1); + DBarTextRight:SetTextColor(1,1,1,1); + end + else -- Both + dbarShow(DBarTextLeft); + dbarShow(DBarTextRight); + DBarTextLeft:SetText(CurrentMana()); + DBarTextRight:SetText(ManaPercentage()); + DBarTextLeft:SetTextColor(1,1,1,1); + DBarTextRight:SetTextColor(1,1,1,1); + end + + if DruidBarKey.Text == 0 then + DBarTextLeft:SetFontObject("GameTooltipTextSmall"); + DBarTextCenter:SetFontObject("GameTooltipTextSmall"); + DBarTextRight:SetFontObject("GameTooltipTextSmall"); + elseif DruidBarKey.Text == 1 then + DBarTextLeft:SetFontObject("TextStatusBarText"); + DBarTextCenter:SetFontObject("TextStatusBarText"); + DBarTextRight:SetFontObject("TextStatusBarText"); + end end else dbarHide(DruidBarFrame); - dbarHide(DEnergyText); - dbarHide(DEnergyText1); - dbarHide(DManaText); - dbarHide(DManaText1); dbarHide(DruidBarReplaceText); + dbarHide(DBarTextLeft); + dbarHide(DBarTextCenter); + dbarHide(DBarTextRight); PlayerFrameManaBar:SetWidth(120); end end diff --git a/DruidBar.xml b/DruidBar.xml index 514828a..96aa209 100644 --- a/DruidBar.xml +++ b/DruidBar.xml @@ -130,43 +130,45 @@ - + - - - - - - - - - - - + + + + + - + - + + + + + - + - + + + + + -- 1.7.9.5