From eb87650c7bd04a479a70f05f26c6f2838ba8968f Mon Sep 17 00:00:00 2001 From: Darthpred Date: Thu, 24 Jul 2014 23:43:25 +0400 Subject: [PATCH] tooltip hooking --- ElvUI_SLE/modules/tooltip.lua | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/ElvUI_SLE/modules/tooltip.lua b/ElvUI_SLE/modules/tooltip.lua index 61c69a4..24eb4f7 100644 --- a/ElvUI_SLE/modules/tooltip.lua +++ b/ElvUI_SLE/modules/tooltip.lua @@ -17,9 +17,7 @@ local function AnchorFrameToMouse(frame) frame:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", (x/scale + (E.db.tooltip.mouseOffsetX - tipWidth/2)), (y/scale + E.db.tooltip.mouseOffsetY)); end -TT.GameTooltip_SetDefaultAnchorSLE = TT.GameTooltip_SetDefaultAnchor -function TT:GameTooltip_SetDefaultAnchor(tt, parent) - TT:GameTooltip_SetDefaultAnchorSLE(tt, parent) +local function SetDefaultAnchor(self, tt, parent) if E.private["tooltip"].enable ~= true then return end if(tt:GetAnchorType() ~= "ANCHOR_CURSOR") then return end if InCombatLockdown() and self.db.visibility.combat then @@ -34,9 +32,7 @@ function TT:GameTooltip_SetDefaultAnchor(tt, parent) end end -TT.GameTooltip_OnTooltipSetUnitSLE = TT.GameTooltip_OnTooltipSetUnit -function TT:GameTooltip_OnTooltipSetUnit(tt) - TT:GameTooltip_OnTooltipSetUnitSLE(tt) +local function OnTooltipSetUnit(self, tt) if not E.db.sle.tooltipicon then return end local unit = select(2, tt:GetUnit()) if(UnitIsPlayer(unit)) then @@ -51,8 +47,9 @@ local function AddonName_OnUpdate(self, elapsed) AnchorFrameToMouse(self); end -TT.InitializeSLE = TT.Initialize -function TT:Initialize() - TT:InitializeSLE() - self:HookScript(GameTooltip, "OnUpdate", AddonName_OnUpdate); -end \ No newline at end of file +local function Init() + TT:HookScript(GameTooltip, "OnUpdate", AddonName_OnUpdate); + hooksecurefunc(TT, "GameTooltip_OnTooltipSetUnit", OnTooltipSetUnit) + hooksecurefunc(TT, "GameTooltip_SetDefaultAnchor", SetDefaultAnchor) +end +hooksecurefunc(TT, "Initialize", Init) \ No newline at end of file -- 1.7.9.5