Quantcast

Hook GameTooltip:GetUnit() so later addons have something to go by.

Scott Sibley [10-27-10 - 20:32]
Hook GameTooltip:GetUnit() so later addons have something to go by.
Filename
StarTip.lua
diff --git a/StarTip.lua b/StarTip.lua
index 3090126..dc6033c 100644
--- a/StarTip.lua
+++ b/StarTip.lua
@@ -488,8 +488,7 @@ function StarTip:OnEnable()
 	self:RawHook(GameTooltip, "FadeOut", "GameTooltipFadeOut", true)
 	self:RawHook(GameTooltip, "Hide", "GameTooltipHide", true)
 	self:RawHook(GameTooltip, "Show", "GameTooltipShow", true)
-	self:SecureHook(GameTooltip, "AddDoubleLine", self.GameTooltipAddLine)
-	self:SecureHook(GameTooltip, "AddLine", self.GameTooltipAddLine)
+	self:RawHook(GameTooltip, "GetUnit", "GameTooltipGetUnit", true)

 	for k,v in self:IterateModules() do
 		if (self.db.profile.modules[k]  == nil and not v.defaultOff) or self.db.profile.modules[k] then
@@ -796,6 +795,15 @@ function StarTip:GameTooltipShow(...)
 	end
 end

+function StarTip:GameTooltipGetUnit()
+	if StarTip.unit and UnitExists(StarTip.unit) then
+		local name = UnitName(StarTip.unit)
+		return name, StarTip.unit
+	end
+	return self.hooks[GameTooltip].GetUnit(GameTooltip)
+end
+
+
 function StarTip.OnTooltipShow(...)

 	if not StarTip.justShow then