Quantcast

Make blizlike it's own option

Tek Hudson [09-05-19 - 06:45]
Make blizlike it's own option
Filename
CHANGELOG.txt
DruidBar.lua
Options.lua
localization.lua
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index b747dcf..0d22ad1 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -2,14 +2,15 @@

 #### 0.7.1
 Update width when attached to playerframe
+Add Bliz-like option to text to match blizzard layout.

 #### 0.7.0
-Alter events we act on
-Fix [mana regen in combat bug](https://github.com/tekHudson/DruidBarClassic/issues/2)
-Little more code cleanup
+Alter events we act on.
+Fix [mana regen in combat bug](https://github.com/tekHudson/DruidBarClassic/issues/2).
+Little more code cleanup.

 #### 0.6.0
-Change versioning
+Change versioning.

 #### 0.5
 Update Icon to use LibDBIcon.
diff --git a/DruidBar.lua b/DruidBar.lua
index 24d1da6..c2f148e 100644
--- a/DruidBar.lua
+++ b/DruidBar.lua
@@ -365,14 +365,18 @@ function DruidBar_TextRenderer()
 				dbarShow(DruidBarTextCenter);
 				DruidBarTextCenter:SetText(ManaPercentage());
 				DruidBarTextCenter:SetTextColor(1,1,1,1);
-			end
-		else -- Both
+			elseif DruidBarKey.Percent == 2 then -- Bliz-Like
 			dbarShow(DruidBarTextLeft);
 			dbarShow(DruidBarTextRight);
 			DruidBarTextLeft:SetText(ManaPercentage());
 			DruidBarTextRight:SetText(ManaValues());
 			DruidBarTextLeft:SetTextColor(1,1,1,1);
 			DruidBarTextRight:SetTextColor(1,1,1,1);
+			end
+		else -- Both
+			dbarShow(DruidBarTextCenter);
+			DruidBarTextCenter:SetText(ManaValuesAndPercentage());
+			DruidBarTextCenter:SetTextColor(1,1,1,1);
 		end

 		if DruidBarKey.Text == 0 then
@@ -387,6 +391,10 @@ function DruidBar_TextRenderer()
 	end
 end

+function ManaValuesAndPercentage()
+	return ManaValues().." "..ManaPercentage();
+end
+
 function ManaValues()
 	return floor(DruidBarKey.currentmana).."/"..floor(DruidBarKey.maxmana);
 end
diff --git a/Options.lua b/Options.lua
index 6642985..9b213a1 100644
--- a/Options.lua
+++ b/Options.lua
@@ -167,7 +167,7 @@ end

 function DRUIDBAROptions_Percent_Initialize()
 	local info;
-	for i = 0, 2, 1 do
+	for i = 0, 3, 1 do
 		info = { };
 		info.text = DRUIDBAR_OPTIONS_DROP.Percent[i];
 		info.func = DRUIDBAROptions_Percent_OnClick;
@@ -183,6 +183,8 @@ function DRUIDBAROptions_Percent_OnShow()
 		UIDropDownMenu_SetSelectedID(DRUIDBAROptionsPercentDropDown, 2);
 	elseif( DruidBarKey.Percent == nil ) then
 		UIDropDownMenu_SetSelectedID(DRUIDBAROptionsPercentDropDown, 3);
+	elseif( DruidBarKey.Percent == 2 ) then
+		UIDropDownMenu_SetSelectedID(DRUIDBAROptionsPercentDropDown, 4);
 	end
 	UIDropDownMenu_SetWidth(DRUIDBAROptionsPercentDropDown, 100);
 end
@@ -197,6 +199,8 @@ function DRUIDBAROptions_Percent_OnClick(self)
 		DruidBarKey.Percent = 1;
 	elseif(i == 3) then -- Both
 		DruidBarKey.Percent = nil;
+	elseif(i == 4) then -- Bliz-like
+		DruidBarKey.Percent = 2;
 	end
 end

diff --git a/localization.lua b/localization.lua
index cf548ab..58e02ae 100644
--- a/localization.lua
+++ b/localization.lua
@@ -63,6 +63,7 @@ DRUIDBAR_OPTIONS_DROP = {
 		[0] = "Raw numbers";
 		[1] = "Percentages";
 		[2] = "Both";
+		[3] = "Bliz-like";
 	};
 	["Message"] = {
 		[0] = "SAY";