diff --git a/TipBuddy.lua b/TipBuddy.lua index cf565d8..f295849 100644 --- a/TipBuddy.lua +++ b/TipBuddy.lua @@ -17,8 +17,8 @@ function TipBuddy_OnLoad(self) self:RegisterEvent("PLAYER_FLAGS_CHANGED"); self:RegisterEvent("UNIT_HEALTH"); self:RegisterEvent("UNIT_MAXHEALTH"); - self:RegisterEvent("UNIT_POWER"); - self:RegisterEvent("UNIT_MAXPOWER"); + self:RegisterEvent("UNIT_POWER"); + self:RegisterEvent("UNIT_MAXPOWER"); self:RegisterEvent("UNIT_DISPLAYPOWER"); self:RegisterEvent("UNIT_PVP_UPDATE"); self:RegisterEvent("UPDATE_SHAPESHIFT_FORMS"); @@ -952,7 +952,7 @@ end function TipBuddy_TargetBuffs_Update(type,unit) -- Init Vars local targettype = TipBuddy_SavedVars[type]; - local _, buff, frame, bframe; + local _, buff, frame, bframe, count; if (TipBuddy_SavedVars["general"].blizdefault == 1 or targettype.off ~= 1) then frame = "TipBuddy_BuffFrameGTT"; else @@ -1445,7 +1445,7 @@ end -- Parent On Update -- -------------------------------------------------------------------------------------------------------- function TipBuddy_ParentTip_OnUpdate(self, elapsed) - + self:ClearAllPoints(); -- Get positions and anchors local x, y = TipBuddy_PositionFrameToCursor(); @@ -2024,25 +2024,17 @@ end -------------------------------------------------------------------------------------------------------- function TB_GameTooltip_IniHooks() -- HOOK: GameTooltip's AddLine - if (not GameTooltip.tborgAddLine) then - GameTooltip.tborgAddLine = GameTooltip.AddLine; - GameTooltip.AddLine = TipBuddy_GameTooltip_AddLine; - end + hooksecurefunc(GameTooltip, "AddLine", TipBuddy_GameTooltip_AddLine); + -- HOOK: GameTooltip's AddDoubleLine - if (not GameTooltip.tborgAddDoubleLine) then - GameTooltip.tborgAddDoubleLine = GameTooltip.AddDoubleLine; - GameTooltip.AddDoubleLine = TipBuddy_GameTooltip_AddDoubleLine; - end + hooksecurefunc(GameTooltip, "AddDoubleLine", TipBuddy_GameTooltip_AddDoubleLine); + -- HOOK: GameTooltip's SetUnit - if (not GameTooltip.orgSetUnit) then - GameTooltip.orgSetUnit = GameTooltip.SetUnit; - GameTooltip.SetUnit = TipBuddy_GameTooltip_SetUnit; - end + hooksecurefunc(GameTooltip, "SetUnit", TipBuddy_GameTooltip_SetUnit); + -- HOOK GameTooltip's FadeOut - if (not GameTooltip.orgFadeOut) then - GameTooltip.orgFadeOut = GameTooltip.FadeOut; - GameTooltip.FadeOut = TipBuddy_GameTooltip_FadeOut; - end + hooksecurefunc(GameTooltip, "FadeOut", TipBuddy_GameTooltip_FadeOut); + -- HOOK GameTooltip's SetOwner if (not GameTooltip.orgSetOwner) then GameTooltip.orgSetOwner = GameTooltip.SetOwner; @@ -2054,22 +2046,21 @@ function TB_GameTooltip_IniHooks() GameTooltip.SetPoint = TipBuddy_GameTooltip_SetPoint; end -- HOOK: GameTooltip's OnEvent - if (not lGameTooltip_OnEvent_Orig) then - lGameTooltip_OnEvent_Orig = GameTooltip:GetScript("OnEvent"); - GameTooltip:SetScript("OnEvent",TipBuddy_GameTooltip_OnEvent); - end + GameTooltip:HookScript("OnEvent", TipBuddy_GameTooltip_OnEvent); + -- HOOK: GameTooltip's OnShow - if (not lGameTooltip_OnShow_Orig) then - lGameTooltip_OnShow_Orig = GameTooltip:GetScript("OnShow"); - GameTooltip:SetScript("OnShow",TipBuddy_GameTooltip_OnShow); - end + GameTooltip:HookScript("OnShow", TipBuddy_GameTooltip_OnShow); + + -- HOOK: GameTooltip's SetDefaultAnchor + hooksecurefunc("GameTooltip_SetDefaultAnchor", TB_GameTooltip_SetDefaultAnchor); + + -- HOOK: GameTooltip's OnHide + GameTooltip:HookScript("OnHide", TB_GameTooltip_OnHide); end -- HOOK: GameTooltip_SetDefaultAnchor -TB_GameTooltip_SetDefaultAnchor_Old = GameTooltip_SetDefaultAnchor; -function GameTooltip_SetDefaultAnchor(tooltip, parent) +function TB_GameTooltip_SetDefaultAnchor(tooltip, parent) if (tooltip:GetName() ~= "GameTooltip" and tooltip:GetName() ~= "TipBuddyTooltip") then - --TB_GameTooltip_SetDefaultAnchor_Old(tooltip,parent); TipBuddy.defanch = nil; return; end @@ -2147,10 +2138,7 @@ end function TipBuddy_GameTooltip_OnShow(self) TipBuddy.xpoint, TipBuddy.xpos, TipBuddy.ypos = TipBuddy_GetFrameCursorOffset(); TipBuddy.anchor, TipBuddy.fanchor, TipBuddy.offset = TipBuddy_GetFrameAnchorPos(); - -- call original function - if (lGameTooltip_OnShow_Orig) then - lGameTooltip_OnShow_Orig(); - end + -- hmm if (TipBuddy_SavedVars["general"].reposmods) and (TipBuddy_SavedVars["general"].reposmods == 1) then --self adjusts the xy of the tooltip position ONLY if GameTooltip_SetDefaultAnchor hasn't @@ -2221,9 +2209,7 @@ function TipBuddy_GameTooltip_OnShow(self) end -- HOOK: GameTooltip_OnHide -TB_GameTooltip_OnHide_Old = GameTooltip_OnHide; -function GameTooltip_OnHide(self) - TB_GameTooltip_OnHide_Old(self); +function TB_GameTooltip_OnHide(self) TipBuddy_GTT_ClearExtras(); TipBuddy.d_own = nil; TipBuddy.d_point = nil; @@ -2231,14 +2217,13 @@ end -- HOOK: GameTooltip_OnEvent function TipBuddy_GameTooltip_OnEvent() - lGameTooltip_OnEvent_Orig(event); TB_DebugMsg("TipBuddy_GameTooltip_OnEvent = "..event); end + -- HOOK: GameTooltip_SetUnit function TipBuddy_GameTooltip_SetUnit(self,unit) TipBuddy_GTT_ClearExtras(); - GameTooltip:orgSetUnit(unit); -- Az 2007.01.10: Added so it shows units for all types of unitframes, not just Blizz (in response to x-perl support) if (UnitIsUnit(unit,"mouseover")) then TipBuddy.hasTarget = 1; @@ -2248,8 +2233,7 @@ end -- HOOK: GameTooltip_FadeOut function TipBuddy_GameTooltip_FadeOut() - TB_DebugMsg("GameTooltip_FadeOut()") - GameTooltip:orgFadeOut(); + TB_DebugMsg("GameTooltip_FadeOut()"); end -- HOOK: GameTooltip_SetOwner @@ -2332,8 +2316,6 @@ function TipBuddy_GameTooltip_AddLine(frame,text,r,g,b,nowrap) if (not TipBuddy.targetUnit) then TipBuddy.targetUnit = "mouseover"; end - -- call original handler - GameTooltip:tborgAddLine(text,r,g,b,nowrap); if (not text or text == "") then return; end @@ -2394,8 +2376,6 @@ function TipBuddy_GameTooltip_AddDoubleLine(frame, textL, textR, Lr, Lg, Lb, Rr, if (not TipBuddy.targetUnit) then TipBuddy.targetUnit = "mouseover"; end - -- call original handler - GameTooltip:tborgAddDoubleLine(textL, textR, Lr, Lg, Lb, Rr, Rg, Rb); if (not textL or textL == "") then return; end diff --git a/TipBuddy_Main.xml b/TipBuddy_Main.xml index b40c42b..1e660d8 100644 --- a/TipBuddy_Main.xml +++ b/TipBuddy_Main.xml @@ -195,7 +195,7 @@ </OnMouseUp> <OnShow> self:SetAlpha(0.75); - UIFrameFlash(TipBuddy_Header_FlashFrame, 0.3, 2.5, 2.9, nil, 0.1, 0); + --UIFrameFlash(TipBuddy_Header_FlashFrame, 0.3, 2.5, 2.9, nil, 0.1, 0); TipBuddy_SavedVars["general"].anchor_vis = 1; </OnShow> <OnHide> diff --git a/TipBuddy_OptionsFrame.lua b/TipBuddy_OptionsFrame.lua index 795d36c..84d8880 100644 --- a/TipBuddy_OptionsFrame.lua +++ b/TipBuddy_OptionsFrame.lua @@ -1135,7 +1135,7 @@ end function TipBuddy_ClickResetVarsButton() StaticPopupDialogs["TIPBUDDY_RESETVARS"] = { - preferredIndex = 3 + preferredIndex = 4, text = TEXT(TB_RESETVARS_DIALOG), button1 = TEXT(ACCEPT), button2 = TEXT(DECLINE),