cba0622 - Hide Blizzard main bar frames
[wowui.git] / OmaUF / UnitFrames.lua
index 6f40e0d..89cfa4a 100644 (file)
@@ -2,8 +2,11 @@
 local _;
 local pairs = pairs;
 local InCombatLockdown = InCombatLockdown;
+local CTimerAfter = C_Timer.After;
 
-local UnitFrames = CreateFrame("Frame", "OmaUnitFrames", UIParent);
+local updateAuraTooltips = OmaUFAuras.UpdateAuraTooltips;
+
+local UnitFrames = CreateFrame("Frame", "OmaUnitFrame", UIParent);
 
 local M = {};
 OmaUnitFrames = M;
@@ -33,13 +36,14 @@ local function hideBlizzardFrames()
         table.insert(frames, _G["Boss"..i.."TargetFrame"]);
         table.insert(frames, _G["Boss"..i.."TargetFrameHealthBar"]);
         table.insert(frames, _G["Boss"..i.."TargetFrameManaBar"]);
+        -- keep boss frame powerBarAlt
     end
     for _, frame in pairs(frames) do
         frame:UnregisterAllEvents();
         if frame.healthbar then frame.healthbar:UnregisterAllEvents() end
         if frame.manabar then frame.manabar:UnregisterAllEvents() end
         if frame.spellbar then frame.spellbar:UnregisterAllEvents() end
-        if frame.powerBarAlt then frame.powerBarAlt:UnregisterAllEvents() end
+        --if frame.powerBarAlt then frame.powerBarAlt:UnregisterAllEvents() end
         frame:Hide();
     end
 
@@ -70,14 +74,26 @@ local function hideArenaFrames()
     end
 end
 
+local function updateTooltipFuncs()
+    -- let MoveAnything hook these to anchor tooltip elsewhere
+    M.UpdatePlayerTooltips();
+    M.UpdatePetTooltips();
+    M.UpdateTargetTooltips();
+    M.UpdateBossTooltips();
+    updateAuraTooltips();
+end
+
 UnitFrames:RegisterEvent("PLAYER_LOGIN");
+UnitFrames:RegisterEvent("PLAYER_ENTERING_WORLD");
 UnitFrames:RegisterEvent("ADDON_LOADED");
 UnitFrames:SetScript("OnEvent", function(self, event, addon)
-    if event == "PLAYER_LOGIN" then
+    if event == "PLAYER_ENTERING_WORLD" then
+        CTimerAfter(0.01, updateTooltipFuncs);
+    elseif event == "ADDON_LOADED" and addon == "Blizzard_ArenaUI" then
+        hideArenaFrames();
+    elseif event == "PLAYER_LOGIN" then
         OmaUFLoadChar();
         hideBlizzardFrames();
         initialize();
-    elseif event == "ADDON_LOADED" and addon == "Blizzard_ArenaUI" then
-        hideArenaFrames();
     end
 end);