Trying out Atom
Scott King [06-30-15 - 14:00]
Trying out Atom
Added a comment just to try out the editor
diff --git a/PortraitHealth.lua b/PortraitHealth.lua
index f141ff2..ed4774e 100755
--- a/PortraitHealth.lua
+++ b/PortraitHealth.lua
@@ -24,22 +24,23 @@ function PH_SlashCommandHandler( msg, class )
local class = PlayerClass;
local className = PlayerClassName;
local x = RAID_CLASS_COLORS[PlayerClassNameIndex];
-
+
-- turn off the health display
if msg == 'off' then
PortraitHealth:Hide();
DEFAULT_CHAT_FRAME:AddMessage("Portrait Health disabled. Type |cFF00aaff/ph on|r to re-enable.");
-
+
-- turn on the health display
elseif msg == 'on' then
PortraitHealth:Show();
DEFAULT_CHAT_FRAME:AddMessage("Portrait Health enabled.");
-
- -- show the current setup
- elseif msg == 'info' then
+
+ -- show the current setup
+ elseif msg == 'info' then
DEFAULT_CHAT_FRAME:AddMessage("Addon version |cFFFFFF00" ..PH_v.. "|r");
DEFAULT_CHAT_FRAME:AddMessage("Execute at |cFFFF0000"..PH_p[class].."%|r \(|c"..x.colorStr..""..PlayerClassName.."|r\)");
-
+
+ -- display list of available commands
elseif msg == '' then
DEFAULT_CHAT_FRAME:AddMessage( "|cffffff00Portrait Health "..PH_v.."|r commands:");
DEFAULT_CHAT_FRAME:AddMessage( "Type |cff00aaff/ph|r before the command. Ex: |cff00aaff/ph off|r disables the health display.");
@@ -70,45 +71,45 @@ function HealthPercentage()
TargetPercentHealth = (UnitHealth("target") / UnitHealthMax("target") * 100);
-- Class detection
-
+
if PlayerClass == 1 and TargetPercentHealth < 20 then -- Warrior
PortraitHealth_Health:SetTextColor(1,0,0);
elseif PlayerClass == 2 and TargetPercentHealth <= 20 then -- Paladin
PortraitHealth_Health:SetTextColor(1,0,0);
-
+
elseif PlayerClass == 3 and TargetPercentHealth <= 20 then -- Hunter
PortraitHealth_Health:SetTextColor(1,0,0);
-
+
elseif PlayerClass == 4 and TargetPercentHealth < 35 then -- Rogue
PortraitHealth_Health:SetTextColor(1,0,0);
-
+
elseif PlayerClass == 5 and TargetPercentHealth < 20 then -- Priest
PortraitHealth_Health:SetTextColor(1,0,0);
-
+
elseif PlayerClass == 6 and TargetPercentHealth < 35 then -- Death Knight
PortraitHealth_Health:SetTextColor(1,0,0);
-
+
elseif PlayerClass == 9 and TargetPercentHealth < 20 then -- Warlock
PortraitHealth_Health:SetTextColor(1,0,0);
-
+
elseif PlayerClass == 10 and TargetPercentHealth <= 10 then -- Monk
PortraitHealth_Health:SetTextColor(1,0,0);
-
+
elseif PlayerClass == 11 and TargetPercentHealth <= 25 then -- Druid
PortraitHealth_Health:SetTextColor(1,0,0);
-
+
elseif TargetPercentHealth <= 10 then -- Other classes
PortraitHealth_Health:SetTextColor(1,0,0);
-
- else
+
+ else
PortraitHealth_Health:SetTextColor(1,1,0);
end
-
+
-- reformat health without decimals
local h = string.format("%.0f",TargetPercentHealth);
local i = string.format("%.1f",TargetPercentHealth);
-
+
-- change the portrait to show current health
if UnitIsDead("target") then
PortraitHealth_Health:SetText('Dead');
@@ -116,8 +117,7 @@ function HealthPercentage()
TargetPercentHealth >= 1 then PortraitHealth_Health:SetText(h .. '%');
elseif
TargetPercentHealth < 1 then PortraitHealth_Health:SetText(i .. '%');
-
+
end
-
-end
+end