Quantcast

Stable: Using cladhaire's hooking technique. Hooks more tooltips now.

Eric Nickell [03-24-11 - 01:11]
Stable: Using cladhaire's hooking technique. Hooks more tooltips now.
Filename
SageGearLevelTooltip.lua
diff --git a/SageGearLevelTooltip.lua b/SageGearLevelTooltip.lua
index 6270175..d8d2b4d 100644
--- a/SageGearLevelTooltip.lua
+++ b/SageGearLevelTooltip.lua
@@ -332,26 +332,6 @@ local SageGearLevelTooltipUpdater do
 		tooltip:HookScript("OnTooltipSetItem", update)
 		return self
 	end
-
-	function class:HookTooltip(tooltipName, methods)
-		local tooltip = _G[tooltipName]
-		local update =
-				function(tooltip, ...)
-						self:UpdateTooltip(tooltip)
-				end
-		local methodCount = 0
-		for _, method in ipairs(methods) do
-			local hasMethodToHook = tooltip[method]
-			if hasMethodToHook then
-				hooksecurefunc(tooltip, method, update)
-				methodCount = methodCount + 1
-			else
-				self:Debug("Tooltip " .. tostring(tooltipName) .. " is missing method " .. method)
-			end
-		end
-		self:Debug("Tooltip " .. tostring(tooltipName) .. "(" .. tostring(tooltip) .. ") has " .. methodCount .. " methods hooked.")
-		return self
-	end

 	function class:AddSelfEvaluator(className, e)
 		local playerClassLocal, playerClass = UnitClass('player')
@@ -380,15 +360,9 @@ end
 ----------------------------------------------------------------------------------------------------
 SageGearLevelTooltipUpdater:New(methodsToHook)
     :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"})
-
+		:HookTooltipScript("ItemRefTooltip")
+		:HookTooltipScript("ShoppingTooltip1")
+		:HookTooltipScript("ShoppingTooltip2")

 		:AddItemCommenter(ItemLevelIdCommenter:New())