Quantcast

seems to work

Eric Nickell [03-21-11 - 01:26]
seems to work
Filename
SageGearLevelTooltip.lua
diff --git a/SageGearLevelTooltip.lua b/SageGearLevelTooltip.lua
index 15dc7f4..6270175 100644
--- a/SageGearLevelTooltip.lua
+++ b/SageGearLevelTooltip.lua
@@ -322,6 +322,16 @@ local SageGearLevelTooltipUpdater do
 		self:Print("SageGearLevelTooltip loaded.")
 		return self
 	end
+
+	function class:HookTooltipScript(tooltipName)
+		local tooltip = _G[tooltipName] or error("Tooltip not found: " .. tooltipName)
+		local update =
+				function(tooltip, ...)
+						self:UpdateTooltip(tooltip)
+				end
+		tooltip:HookScript("OnTooltipSetItem", update)
+		return self
+	end

 	function class:HookTooltip(tooltipName, methods)
 		local tooltip = _G[tooltipName]
@@ -340,7 +350,7 @@ local SageGearLevelTooltipUpdater do
 			end
 		end
 		self:Debug("Tooltip " .. tostring(tooltipName) .. "(" .. tostring(tooltip) .. ") has " .. methodCount .. " methods hooked.")
-		return self;
+		return self
 	end

 	function class:AddSelfEvaluator(className, e)
@@ -369,11 +379,12 @@ end

 ----------------------------------------------------------------------------------------------------
 SageGearLevelTooltipUpdater:New(methodsToHook)
-		:HookTooltip("GameTooltip", {"SetAuctionItem", "SetAuctionSellItem", "SetBagItem", "SetBuybackItem",
-				"SetExistingSocketGem", "SetGuildBankItem", "SetInboxItem", "SetInventoryItem", "SetHyperlink",
-				"SetLootItem", "SetLootRollItem", "SetMerchantItem", "SetQuestItem", "SetQuestLogItem",
-				"SetSendMailItem", "SetSocketGem", "SetTradePlayerItem", "SetTradeSkillItem",
-				"SetTradeTargetItem", "SetTrainerService" })
+    :HookTooltipScript("GameTooltip")
+--		:HookTooltip("GameTooltip", {"SetAuctionItem", "SetAuctionSellItem", "SetBagItem", "SetBuybackItem",
+--				"SetExistingSocketGem", "SetGuildBankItem", "SetInboxItem", "SetInventoryItem", "SetHyperlink",
+--				"SetLootItem", "SetLootRollItem", "SetMerchantItem", "SetQuestItem", "SetQuestLogItem",
+--				"SetSendMailItem", "SetSocketGem", "SetTradePlayerItem", "SetTradeSkillItem",
+--				"SetTradeTargetItem", "SetTrainerService" })
 --		:HookTooltip("ItemRefTooltip", {"SetHyperlink", "Show", "Hide"})
 		:HookTooltip("ShoppingTooltip1", {"SetHyperlinkCompareItem"})
 		:HookTooltip("ShoppingTooltip2", {"SetHyperlinkCompareItem"})