Fix replace text garbage, stage 1
Tek Hudson [01-11-20 - 02:21]
Fix replace text garbage, stage 1
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 @@
<Layers>
<Layer level="FOREGROUND">
- <FontString name="DEnergyText" inherits="GameFontNormalSmall" wraponspaces="true">
+ <FontString name="DBarTextLeft" inherits="GameFontNormalSmall" wraponspaces="true">
<Size>
<AbsDimension x="0" y="60"/>
</Size>
<Anchors>
- <Anchor point="CENTER" relativeTo="PlayerFrameManaBar" relativePoint="CENTER"/>
- </Anchors>
- </FontString>
-
- <FontString name="DEnergyText1" inherits="TextStatusBarText" wraponspaces="true">
- <Size>
- <AbsDimension x="0" y="60"/>
- </Size>
-
- <Anchors>
- <Anchor point="CENTER" relativeTo="PlayerFrameManaBar" relativePoint="CENTER"/>
+ <Anchor point="LEFT" relativeTo="$Parent" relativePoint="LEFT">
+ <Offset>
+ <AbsDimension x="50" y="-4"/>
+ </Offset>
+ </Anchor>
</Anchors>
</FontString>
- <FontString name="DManaText" inherits="GameFontNormalSmall" wraponspaces="true">
+ <FontString name="DBarTextCenter" inherits="TextStatusBarText" wraponspaces="true">
<Size>
<AbsDimension x="0" y="60"/>
</Size>
<Anchors>
- <Anchor point="CENTER" relativeTo="DruidBarMana" relativePoint="CENTER"/>
+ <Anchor point="CENTER" relativeTo="$Parent" relativePoint="CENTER">
+ <Offset>
+ <AbsDimension x="0" y="-4"/>
+ </Offset>
+ </Anchor>
</Anchors>
</FontString>
- <FontString name="DManaText1" inherits="TextStatusBarText" wraponspaces="true">
+ <FontString name="DBarTextRight" inherits="GameFontNormalSmall" wraponspaces="true">
<Size>
<AbsDimension x="0" y="60"/>
</Size>
<Anchors>
- <Anchor point="CENTER" relativeTo="DruidBarMana" relativePoint="CENTER"/>
+ <Anchor point="RIGHT" relativeTo="$Parent" relativePoint="RIGHT">
+ <Offset>
+ <AbsDimension x="-10" y="-4"/>
+ </Offset>
+ </Anchor>
</Anchors>
</FontString>
</Layer>