Quantcast

Slash command

Scott King [06-29-15 - 05:44]
Slash command

Working slash command added. Needs more work.
- implement as a toggle
Filename
CHANGELOG.txt
PortraitHealth.lua
PortraitHealth.toc
PortraitHealth.xml
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 0249a2e..4bfc8d9 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,3 +1,6 @@
+v3.0
+	- toggle the health output off with /ph
+
 v2.3.4
 	- updates to repository (sync problem)

diff --git a/PortraitHealth.lua b/PortraitHealth.lua
index 8eed6dc..21f8f70 100755
--- a/PortraitHealth.lua
+++ b/PortraitHealth.lua
@@ -18,6 +18,21 @@ PH_p[9] = "25" 		-- Warlock			9
 PH_p[10] = "10" 	-- Monk				10
 PH_p[11] = "25" 	-- Druid			11

+-- Slash Command: Disables the output
+function PH_SlashCommandHandler( msg )
+	DEFAULT_CHAT_FRAME:AddMessage( "Command: " .. msg );
+	if msg == 'hi' then
+		PortraitHealth:Hide();
+	else
+		PortraitHealth:Show();
+	end
+end
+
+function PH_OnLoad()
+  SlashCmdList["PH"] = PH_SlashCommandHandler; -- Add our slash command handler to the list of slash commands
+  SLASH_PH1 = "/ph"; -- Associate /ph with the slash command list entry for PORTRAITHEALTH
+end
+

 -- Tell the player what their execute phase is set to
 function DisplayClass(class)
diff --git a/PortraitHealth.toc b/PortraitHealth.toc
index 59ce6cc..aacd313 100755
--- a/PortraitHealth.toc
+++ b/PortraitHealth.toc
@@ -2,10 +2,6 @@
 ## Title: Portrait Health
 ## Notes: See your target's health percentage in bold text over their portrait.
 ## Author: Cilcraft
-## Version: 2.3.4
-## X-Curse-Packaged-Version: v2.3.1
-## X-Curse-Project-Name: Portrait Health
-## X-Curse-Project-ID: portrait-health
-## X-Curse-Repository-ID: wow/portrait-health/mainline
+## Version: 3.0.0
 PortraitHealth.lua
 PortraitHealth.xml
diff --git a/PortraitHealth.xml b/PortraitHealth.xml
index 866e2cd..7408a51 100755
--- a/PortraitHealth.xml
+++ b/PortraitHealth.xml
@@ -34,6 +34,7 @@
 					self:RegisterEvent("PLAYER_TARGET_CHANGED");
 					self:RegisterEvent("PLAYER_ENTERING_WORLD");
 					DisplayClass();
+					PH_OnLoad();
 				</OnLoad>
 				<OnEvent>
 					HealthPercentage();