Add support for Role coloured health bars and bump version number.

Mere [06-28-13 - 01:06]
Add support for Role coloured health bars and bump version number.
Filename
ConfigUI_Layouts.lua
HealingBar.lua
HealingPanel.RoleIcon.lua
HealingPanel.lua
HealingPanelLayout.lua
RiftAddon.toc
diff --git a/ConfigUI_Layouts.lua b/ConfigUI_Layouts.lua
index d81363b..3a52dc4 100644
--- a/ConfigUI_Layouts.lua
+++ b/ConfigUI_Layouts.lua
@@ -360,7 +360,14 @@ function MereHealingFrames.Config.UI.Layouts:CreatePanelSettingsTab()
 	panelSettings.callingColouredHealth:GetContent():SetLabelPos("left")

 	previousFrame = panelSettings.callingColouredHealth:GetContent()
-
+
+    panelSettings.roleColouredHealth = checkboxWrapper:new()
+    panelSettings.roleColouredHealth:CreateUI("callingColouredHealth", "Health Bar is role coloured:", panelSettings.Frame)
+    panelSettings.roleColouredHealth:GetContent():SetPoint("TOPLEFT", previousFrame, "BOTTOMLEFT", indentX, 5)
+    panelSettings.roleColouredHealth:GetContent():SetLabelPos("left")
+
+    previousFrame = panelSettings.roleColouredHealth:GetContent()
+
 	panelSettings.HealthTextBordered = checkboxWrapper:new()
 	panelSettings.HealthTextBordered:CreateUI("HealthTextBordered", "Health Text is bordered:", panelSettings.Frame)
 	panelSettings.HealthTextBordered:GetContent():SetPoint("TOPLEFT", previousFrame, "BOTTOMLEFT", indentX, 5)
@@ -556,7 +563,23 @@ function MereHealingFrames.Config.UI.Layouts:CreatePanelSettingsTab()

     panelSettings.callingColouredText:SetCallback(function (layoutname, value) MereHealingFrames.Config.UI.Layouts.ChangePanelSetting(self, "callingColouredText", value) end)
 	panelSettings.borderPlayerName:SetCallback(function (layoutname, value) MereHealingFrames.Config.UI.Layouts.ChangePanelSetting(self, "borderPlayerName", value) end)
-	panelSettings.callingColouredHealth:SetCallback(function (layoutname, value) MereHealingFrames.Config.UI.Layouts.ChangePanelSetting(self, "callingColouredHealth", value) end)
+
+    -- really these should merge into a drop down, something for the future
+    panelSettings.callingColouredHealth:SetCallback(function (layoutname, value)
+        if (value) then
+            self.panelSettings.roleColouredHealth:SetCurrentValue(false, true)
+            MereHealingFrames.Config.UI.Layouts.ChangePanelSetting(self, "roleColouredHealth", false)
+        end
+        MereHealingFrames.Config.UI.Layouts.ChangePanelSetting(self, "callingColouredHealth", value)
+    end)
+
+    panelSettings.roleColouredHealth:SetCallback(function (layoutname, value)
+        if (value) then
+            self.panelSettings.callingColouredHealth:SetCurrentValue(false, true)
+            MereHealingFrames.Config.UI.Layouts.ChangePanelSetting(self, "callingColouredHealth", false)
+        end
+        MereHealingFrames.Config.UI.Layouts.ChangePanelSetting(self, "roleColouredHealth", value)
+    end)

 	panelSettings.HealthTextBordered:SetCallback(function (layoutname, value) MereHealingFrames.Config.UI.Layouts.ChangePanelSetting(self, "HealthTextBordered", value) end)
 	panelSettings.ManaTextBordered:SetCallback(function (layoutname, value) MereHealingFrames.Config.UI.Layouts.ChangePanelSetting(self, "ManaTextBordered", value) end)
@@ -606,6 +629,7 @@ function MereHealingFrames.Config.UI.Layouts:RefreshPanelSettings()
 	self.panelSettings.callingColouredText:SetCurrentValue(panelSetting.callingColouredText, true)
 	self.panelSettings.borderPlayerName:SetCurrentValue(panelSetting.borderPlayerName, true)
 	self.panelSettings.callingColouredHealth:SetCurrentValue(panelSetting.callingColouredHealth, true)
+    self.panelSettings.roleColouredHealth:SetCurrentValue(panelSetting.roleColouredHealth, true)

     self.panelSettings.nameFontSize:SetCurrentValue(panelSetting.NameFontSize, true)
     self.panelSettings.healthFontSize:SetCurrentValue(panelSetting.HealthFontSize, true)
diff --git a/HealingBar.lua b/HealingBar.lua
index d6ab538..029aad0 100644
--- a/HealingBar.lua
+++ b/HealingBar.lua
@@ -320,10 +320,27 @@ function MereHealingFrames.HealingBar:SetCallingMode(callingMode, callingName)
 	self:UpdateHealthBarColour()
 end

+function MereHealingFrames.HealingBar:SetRoleMode(roleMode, roleName)
+    self.roleMode = roleMode
+    self.roleName = roleName
+    self:UpdateHealthBarColour()
+end
+
 function MereHealingFrames.HealingBar:UpdateHealthBarColour()
 	if self.barMode == "health" then
 		local barColour = "BarHealth"
-		if self.callingMode then
+        if self.roleMode then
+            local roleName = self.roleName
+            if roleName == "tank" then
+                barColour = "RoleTank"
+            elseif roleName == "dps" then
+                barColour = "RoleDps"
+            elseif roleName == "heal" then
+                barColour = "RoleHealer"
+            elseif roleName == "support" then
+                barColour = "RoleSupport"
+            end
+		elseif self.callingMode then
 			local callingName = self.callingName
 			if callingName == "warrior" then
 				barColour = "WarriorColour"
diff --git a/HealingPanel.RoleIcon.lua b/HealingPanel.RoleIcon.lua
index c02b4b2..4994a2d 100644
--- a/HealingPanel.RoleIcon.lua
+++ b/HealingPanel.RoleIcon.lua
@@ -159,10 +159,6 @@ function MereHealingFrames.HealingPanel:MoveRoleIcon(borderWidth)
     return self.RoleIcon:MoveIcon(borderWidth)
 end

-function MereHealingFrames.HealingPanel:SetRole(role)
-    return self.RoleIcon:SetRole(role)
-end
-
 function MereHealingFrames.HealingPanel:Ready(readyState)
     return self.RoleIcon:SetReadyStatus(readyState)
 end
\ No newline at end of file
diff --git a/HealingPanel.lua b/HealingPanel.lua
index 087d89e..e45e27c 100644
--- a/HealingPanel.lua
+++ b/HealingPanel.lua
@@ -232,6 +232,11 @@ function MereHealingFrames.HealingPanel:SetupPlayerValues()
 	self:UpdateSpells()
 end

+function MereHealingFrames.HealingPanel:SetRole(role)
+    self.Health:SetRoleMode(self.PanelSettings.roleColouredHealth, role)
+    return self.RoleIcon:SetRole(role)
+end
+
 function MereHealingFrames.HealingPanel:Calling()
 	-- what we show varies a for the resource bar:
 	local playerInfo = self.playerInfo
diff --git a/HealingPanelLayout.lua b/HealingPanelLayout.lua
index f53dee0..491e833 100644
--- a/HealingPanelLayout.lua
+++ b/HealingPanelLayout.lua
@@ -136,6 +136,7 @@ MereHealingFrames.HealingPanelSettings = {
 		callingColouredText = true,
 		borderPlayerName = true,
 		callingColouredHealth = false,
+        roleColouredHealth = false,

 		borderSize = 2,
 		buffConfiguration = nil,
diff --git a/RiftAddon.toc b/RiftAddon.toc
index ef8f79a..81779c8 100644
--- a/RiftAddon.toc
+++ b/RiftAddon.toc
@@ -7,7 +7,7 @@ Name = "Mere Healing Frames"
 NameShort = "MHF"
 Description = "A set of healing frames"
 Author = "Mere"
-Version = "0.4.29"
+Version = "0.4.30"
 Email = "rift@dokein.co.uk"
 Environment = "2.3"