Quantcast

Simplified class detection and executes

Scott King [07-06-15 - 04:43]
Simplified class detection and executes
Filename
CHANGELOG.txt
PortraitHealth.lua
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 7cc8cd1..dc5bcdd 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,3 +1,9 @@
+v3.1
+	- simplified execute phase code
+
+v3.0.1
+	- added delay to loading message so it wouldn't be buried
+
 v3.0
 	- added sound when execute phase is reached (off by default)
 	- added slash commands to disable/enable health display and sound
diff --git a/PortraitHealth.lua b/PortraitHealth.lua
index e3645ee..60e86c2 100755
--- a/PortraitHealth.lua
+++ b/PortraitHealth.lua
@@ -135,84 +135,19 @@ function HealthPercentage(event)
 	-- Class detection

   -- All in one experiment
-  if PlayerClass == PlayerClass and TargetPercentHealth < PH_p[PlayerClass] then
+  if PlayerClass ~= 2 and TargetPercentHealth < PH_p[PlayerClass] then
     PortraitHealth_Health:SetTextColor(1,0,0);
-    if not UnitIsDead("target") and limit == 0 and PH_sound == 1 then
+    if not UnitIsDead("target") and limit1 == 0 and PH_sound == 1 then
       PlaySoundFile(executeSound);
-      limit = 1;
+      limit1 = 1;
     end
---[[
-	if PlayerClass == 1 and TargetPercentHealth < 20 then 			-- Warrior
-		PortraitHealth_Health:SetTextColor(1,0,0);
+  elseif PlayerClass == 2 and TargetPercentHealth <= PH_p[PlayerClass] then
+    PortraitHealth_Health:SetTextColor(1,0,0);
     if not UnitIsDead("target") and limit1 == 0 and PH_sound == 1 then
       PlaySoundFile(executeSound);
       limit1 = 1;
     end

-		elseif PlayerClass == 2 and TargetPercentHealth <= 20 then 	-- Paladin
-				PortraitHealth_Health:SetTextColor(1,0,0);
-        if not UnitIsDead("target") and limit1 == 0 and PH_sound == 1 then
-          PlaySoundFile(executeSound);
-          limit1 = 1;
-        end
-
-		elseif PlayerClass == 3 and TargetPercentHealth <= 20 then 	-- Hunter
-				PortraitHealth_Health:SetTextColor(1,0,0);
-        if not UnitIsDead("target") and limit1 == 0 and PH_sound == 1 then
-          PlaySoundFile(executeSound);
-          limit1 = 1;
-        end
-
-		elseif PlayerClass == 4 and TargetPercentHealth < 35 then 	-- Rogue
-				PortraitHealth_Health:SetTextColor(1,0,0);
-        if not UnitIsDead("target") and limit1 == 0 and PH_sound == 1 then
-          PlaySoundFile(executeSound);
-          limit1 = 1;
-        end
-
-		elseif PlayerClass == 5 and TargetPercentHealth < 20 then 	-- Priest
-				PortraitHealth_Health:SetTextColor(1,0,0);
-        if not UnitIsDead("target") and limit1 == 0 and PH_sound == 1 then
-          PlaySoundFile(executeSound);
-          limit1 = 1;
-        end
-
-		elseif PlayerClass == 6 and TargetPercentHealth < 35 then 	-- Death Knight
-				PortraitHealth_Health:SetTextColor(1,0,0);
-        if not UnitIsDead("target") and limit1 == 0 and PH_sound == 1 then
-          PlaySoundFile(executeSound);
-          limit1 = 1;
-        end
-
-		elseif PlayerClass == 9 and TargetPercentHealth < 20 then 	-- Warlock
-				PortraitHealth_Health:SetTextColor(1,0,0);
-        if not UnitIsDead("target") and limit1 == 0 and PH_sound == 1 then
-          PlaySoundFile(executeSound);
-          limit1 = 1;
-        end
-
-		elseif PlayerClass == 10 and TargetPercentHealth <= 10 then -- Monk
-				PortraitHealth_Health:SetTextColor(1,0,0);
-        if not UnitIsDead("target") and limit1 == 0 and PH_sound == 1 then
-          PlaySoundFile(executeSound);
-          limit1 = 1;
-        end
-
-		elseif PlayerClass == 11 and TargetPercentHealth <= 25 then -- Druid
-				PortraitHealth_Health:SetTextColor(1,0,0);
-        if not UnitIsDead("target") and limit1 == 0 and PH_sound == 1 then
-          PlaySoundFile(executeSound);
-          limit1 = 1;
-        end
-
-		elseif TargetPercentHealth <= 10 then						-- Other classes
-				PortraitHealth_Health:SetTextColor(1,0,0);
-        if not UnitIsDead("target") and limit1 == 0 and PH_sound == 1 then
-          PlaySoundFile(executeSound);
-          limit1 = 1;
-        end
---]]
-
 	else
 		PortraitHealth_Health:SetTextColor(1,1,0);
 	end