Quantcast

Added loading message with class color and execute phase information

Scott King [01-14-14 - 04:19]
Added loading message with class color and execute phase information
Filename
.gitattributes
.gitignore
PortraitHealth.lua
PortraitHealth.xml
diff --git a/.gitattributes b/.gitattributes
old mode 100644
new mode 100755
diff --git a/.gitignore b/.gitignore
old mode 100644
new mode 100755
diff --git a/PortraitHealth.lua b/PortraitHealth.lua
index 7066dbb..77b16c6 100755
--- a/PortraitHealth.lua
+++ b/PortraitHealth.lua
@@ -1,25 +1,36 @@
+-- Global information

 classDisplayName, class, classID = UnitClass("player");
 PlayerClass = classID;
+PlayerClassName = classDisplayName;
+PlayerClassNameIndex = class;

--- Class ID Listing
+PH_p = {}			-- Class:			ID:
+PH_p[1] = "20" 		-- Warrior 			1
+PH_p[2] = "20" 		-- Paladin 			2
+PH_p[3] = "20" 		-- Hunter 			3
+PH_p[4] = "35" 		-- Rogue			4
+PH_p[5] = "25" 		-- Priest			5
+PH_p[6] = "35" 		-- Death Knight		6
+PH_p[7] = "10" 		-- Shaman			7
+PH_p[8] = "10" 		-- Mage				8
+PH_p[9] = "25" 		-- Warlock			9
+PH_p[10] = "10" 	-- Monk				10
+PH_p[11] = "25" 	-- Druid			11

--- Warrior 		1
--- Paladin 		2
--- Hunter 		3
--- Rogue 		4
--- Priest 		5
--- Death Knight 6
--- Shaman 		7
--- Mage 		8
--- Warlock 		9
--- Monk 		10
--- Druid 		11

+-- Tell the player what their execute phase is set to
+function DisplayClass(class)
+	local class = PlayerClass;
+	local className = PlayerClassName;
+	local x = RAID_CLASS_COLORS[PlayerClassNameIndex];
+	DEFAULT_CHAT_FRAME:AddMessage("|cffffff9aPortrait Health|r loaded. Your class: |c"..x.colorStr..""..PlayerClassName.."|r.\nExecute phase set to |cFFFF0000"..PH_p[class].."%|r");
+end

+-- Set the text color and update health output
 function HealthPercentage()

-	-- health value to display. whole numbers only.
+	-- Health value to display. Whole numbers only.
 	TargetPercentHealth = math.ceil((UnitHealth("target") / UnitHealthMax("target") * 100));

 	-- Class detection
diff --git a/PortraitHealth.xml b/PortraitHealth.xml
index 9d9a242..866e2cd 100755
--- a/PortraitHealth.xml
+++ b/PortraitHealth.xml
@@ -33,6 +33,7 @@
 					self:RegisterEvent("UNIT_HEALTH");
 					self:RegisterEvent("PLAYER_TARGET_CHANGED");
 					self:RegisterEvent("PLAYER_ENTERING_WORLD");
+					DisplayClass();
 				</OnLoad>
 				<OnEvent>
 					HealthPercentage();