ad67f41 - Allow MoveAnything to change tooltip location
[wowui.git] / OmaRF / RaidFrame.lua
index 2adcdb9..5d94ff0 100644 (file)
@@ -5,9 +5,10 @@ local format = string.format;
 local UnitInRange = UnitInRange;
 local InCombatLockdown = InCombatLockdown;
 local CreateFrame, RegisterStateDriver, RegisterUnitWatch = CreateFrame, RegisterStateDriver, RegisterUnitWatch;
 local UnitInRange = UnitInRange;
 local InCombatLockdown = InCombatLockdown;
 local CreateFrame, RegisterStateDriver, RegisterUnitWatch = CreateFrame, RegisterStateDriver, RegisterUnitWatch;
+local CTimerAfter = C_Timer.After;
 local STANDARD_TEXT_FONT = STANDARD_TEXT_FONT;
 local STANDARD_TEXT_FONT = STANDARD_TEXT_FONT;
-local GameTooltip = nil;
-local GameTooltip_SetDefaultAnchor = nil;
+local GameTooltip = GameTooltip;
+local GameTooltip_SetDefaultAnchor = GameTooltip_SetDefaultAnchor;
 
 local registerEvents = OmaRFEvents.RegisterEvents;
 local registerUnitEvents = OmaRFEvents.RegisterUnitEvents;
 
 local registerEvents = OmaRFEvents.RegisterEvents;
 local registerUnitEvents = OmaRFEvents.RegisterUnitEvents;
@@ -272,9 +273,6 @@ local function initializeFocus(parent)
 end
 
 local function initialize()
 end
 
 local function initialize()
-    -- let other addons hook these to anchor tooltip elsewhere
-    GameTooltip = _G["GameTooltip"];
-    GameTooltip_SetDefaultAnchor = _G["GameTooltip_SetDefaultAnchor"];
     _, class = UnitClass("player");
     anchorX, anchorY = Settings.Character.AnchorX, Settings.Character.AnchorY;
     attributes = Settings.Character.Clickheal;
     _, class = UnitClass("player");
     anchorX, anchorY = Settings.Character.AnchorX, Settings.Character.AnchorY;
     attributes = Settings.Character.Clickheal;
@@ -333,16 +331,25 @@ local function hideBlizzardRaid()
     end
 end
 
     end
 end
 
+local function updateTooltipFuncs()
+    -- let MoveAnything hook these to anchor tooltip elsewhere
+    GameTooltip = _G["GameTooltip"];
+    GameTooltip_SetDefaultAnchor = _G["GameTooltip_SetDefaultAnchor"];
+end
+
 CFrame:RegisterEvent("PLAYER_LOGIN");
 CFrame:RegisterEvent("PLAYER_LOGIN");
+CFrame:RegisterEvent("PLAYER_ENTERING_WORLD");
 CFrame:RegisterEvent("PLAYER_REGEN_ENABLED");
 CFrame:SetScript("OnEvent", function(self, event, addon)
 CFrame:RegisterEvent("PLAYER_REGEN_ENABLED");
 CFrame:SetScript("OnEvent", function(self, event, addon)
-    if event == "PLAYER_LOGIN" then
-        OmaRFLoadChar();
-        hideBlizzardRaid();
-        initialize();
-    elseif event == "PLAYER_REGEN_ENABLED" then
+    if event == "PLAYER_REGEN_ENABLED" then
         -- if CompactRaidFrameManager_UpdateOptionsFlowContainer was called in combat
         -- couldn't hide the button
         hideBlizzardRaidButton();
         -- if CompactRaidFrameManager_UpdateOptionsFlowContainer was called in combat
         -- couldn't hide the button
         hideBlizzardRaidButton();
+    elseif event == "PLAYER_ENTERING_WORLD" then
+        CTimerAfter(0.01, updateTooltipFuncs);
+    elseif event == "PLAYER_LOGIN" then
+        OmaRFLoadChar();
+        hideBlizzardRaid();
+        initialize();
     end
 end);
     end
 end);