Quantcast

-Added a slash command to switch between showing auras and not showing them.

Xruptor [01-02-11 - 14:47]
-Added a slash command to switch between showing auras and not showing them.
-Changed the addon's name so that it makes much more sense
-Added some Tooltip checks to make sure that tooltips are hidden.
Filename
xanHoudiniTooltip.lua
xanHoudiniTooltip.toc
xanTooltipHoudini.lua
xanTooltipHoudini.toc
diff --git a/xanHoudiniTooltip.lua b/xanHoudiniTooltip.lua
deleted file mode 100644
index b70a3d2..0000000
--- a/xanHoudiniTooltip.lua
+++ /dev/null
@@ -1,45 +0,0 @@
-
-local f = CreateFrame("frame","xanHoudiniTooltip_frame",UIParent)
-f:SetScript("OnEvent", function(self, event, ...) if self[event] then return self[event](self, event, ...) end end)
-
-local auraSwitch = false
-
-----------------------
---      Enable      --
-----------------------
-
-local function processAuraTooltip(self, unitid, index, filter)
-	auraSwitch = true
-end
-
-function f:PLAYER_LOGIN()
-
-	-- GameTooltip:HookScript("OnShow", function(self)
-		-- local name, unitid = self:GetUnit()
-		-- local parent = self:GetParent()
-		-- if InCombatLockdown() then
-			-- self:Hide()
-			-- return
-		-- end
-	-- end)
-
-	GameTooltip:HookScript("OnHide", function(self)
-		auraSwitch = false
-	end)
-
-	GameTooltip:HookScript("OnUpdate", function(self, elapsed)
-		if self:IsShown() and InCombatLockdown() and not auraSwitch then
-			self:Hide()
-		end
-	end)
-
-	--decide if we want to show aura tooltips while in battle
-	hooksecurefunc(GameTooltip, "SetUnitAura", processAuraTooltip)
-	hooksecurefunc(GameTooltip, "SetUnitBuff", processAuraTooltip)
-	hooksecurefunc(GameTooltip, "SetUnitDebuff", processAuraTooltip)
-
-	self:UnregisterEvent("PLAYER_LOGIN")
-	self.PLAYER_LOGIN = nil
-end
-
-if IsLoggedIn() then f:PLAYER_LOGIN() else f:RegisterEvent("PLAYER_LOGIN") end
diff --git a/xanHoudiniTooltip.toc b/xanHoudiniTooltip.toc
deleted file mode 100644
index 9202a60..0000000
--- a/xanHoudiniTooltip.toc
+++ /dev/null
@@ -1,7 +0,0 @@
-## Interface: 40000
-## Title: xanHoudiniTooltip
-## Notes: Hides the game tooltip while in combat.
-## Author: Xruptor
-## Version: 1.1
-
-xanHoudiniTooltip.lua
diff --git a/xanTooltipHoudini.lua b/xanTooltipHoudini.lua
new file mode 100644
index 0000000..ff05a07
--- /dev/null
+++ b/xanTooltipHoudini.lua
@@ -0,0 +1,72 @@
+
+local f = CreateFrame("frame","xanTooltipHoudini_frame",UIParent)
+f:SetScript("OnEvent", function(self, event, ...) if self[event] then return self[event](self, event, ...) end end)
+
+local auraSwitch = false
+
+----------------------
+--      Enable      --
+----------------------
+
+local function processAuraTooltip(self, unitid, index, filter)
+	auraSwitch = true
+end
+
+function f:PLAYER_LOGIN()
+
+	--do DB stuff
+	if not XTH_DB then XTH_DB = {} end
+	if XTH_DB.showAuras == nil then XTH_DB.showAuras = true end
+
+	SLASH_XANTOOLTIPHOUDINI1 = "/xht"
+	SlashCmdList["XANTOOLTIPHOUDINI"] = function(msg)
+
+	local a,b,c = strfind(msg, "(%S+)") --contiguous string of non-space characters
+
+	if a then
+		if c and c:lower() == "auras" then
+			if XTH_DB.showAuras then
+				XTH_DB.showAuras = false
+				DEFAULT_CHAT_FRAME:AddMessage("XanTooltipHoudini: Aura (Buff/Debuff) toolips are now [|cFF99CC33OFF|r]")
+			else
+				XTH_DB.showAuras = true
+				DEFAULT_CHAT_FRAME:AddMessage("XanTooltipHoudini: Aura (Buff/Debuff) toolips are now [|cFF99CC33ON|r]")
+			end
+			return true
+		end
+	end
+
+	GameTooltip:HookScript("OnShow", function(self)
+		--only use this if showAuras is false
+		if XTH_DB and not XTH_DB.showAuras then
+			if InCombatLockdown() then
+				self:Hide()
+				return
+			end
+		end
+	end)
+
+	GameTooltip:HookScript("OnHide", function(self)
+		auraSwitch = false
+	end)
+
+	GameTooltip:HookScript("OnUpdate", function(self, elapsed)
+		--check if showauras is on
+		if XTH_DB and XTH_DB.showAuras then
+			--hide everything BUT auras
+			if self:IsShown() and InCombatLockdown() and not auraSwitch then
+				self:Hide()
+			end
+		end
+	end)
+
+	--decide if we want to show aura tooltips while in battle
+	hooksecurefunc(GameTooltip, "SetUnitAura", processAuraTooltip)
+	hooksecurefunc(GameTooltip, "SetUnitBuff", processAuraTooltip)
+	hooksecurefunc(GameTooltip, "SetUnitDebuff", processAuraTooltip)
+
+	self:UnregisterEvent("PLAYER_LOGIN")
+	self.PLAYER_LOGIN = nil
+end
+
+if IsLoggedIn() then f:PLAYER_LOGIN() else f:RegisterEvent("PLAYER_LOGIN") end
diff --git a/xanTooltipHoudini.toc b/xanTooltipHoudini.toc
new file mode 100644
index 0000000..1c82a35
--- /dev/null
+++ b/xanTooltipHoudini.toc
@@ -0,0 +1,8 @@
+## Interface: 40000
+## Title: xanTooltipHoudini
+## Notes: Hides the game tooltip while in combat.
+## Author: Xruptor
+## Version: 1.1
+## SavedVariables: XTH_DB
+
+xanTooltipHoudini.lua