diff --git a/Core.lua b/Core.lua index f950bea..b636db2 100644 --- a/Core.lua +++ b/Core.lua @@ -15,11 +15,19 @@ F.Events:SetScript("OnEvent", function(self, event, ...) F.InitDB() F.State.session.startTime = time() F.State.session.lastXP = UnitXP("player") + -- Hide Blizzard XP / Reputation bars if configured + if F.UI and F.UI.HideBlizzardBars then + F.UI.HideBlizzardBars() + end end if event == "PLAYER_ENTERING_WORLD" then F.State:UpdatePlayerXP() F.State:UpdateQuestXP() + -- Ensure Blizzard bars stay hidden after entering world (in case something re-enabled them) + if F.UI and F.UI.HideBlizzardBars then + F.UI.HideBlizzardBars() + end elseif event == "PLAYER_XP_UPDATE" then local currentXP = UnitXP("player") diff --git a/UI.lua b/UI.lua index 8e3e3a4..07445f8 100644 --- a/UI.lua +++ b/UI.lua @@ -198,6 +198,39 @@ function F.UI.Create() -- Perform an initial update to set values F.UI.Update() + + -- Hide default Blizzard bars if the option is enabled (guarded in the function) + F.UI.HideBlizzardBars() +end + +-- Utility: Hide Blizzard's default experience and reputation bars (if configured) +-- This is safe even if the global Blizzard frames don't exist (we check for them). +function F.UI.HideBlizzardBars() + if not (F and F.DB and F.DB.hideBlizzardXPBar) then return end + + -- Hide the main experience bar if present + if MainMenuExpBar then + MainMenuExpBar:UnregisterAllEvents() + MainMenuExpBar:Hide() + end + + -- Hide the reputation watch bar (classic name) + if ReputationWatchBar then + ReputationWatchBar:UnregisterAllEvents() + ReputationWatchBar:Hide() + end + + -- Hide the status-tracking manager (modern clients) + if StatusTrackingBarManager then + StatusTrackingBarManager:UnregisterAllEvents() + StatusTrackingBarManager:Hide() + end + + -- Some clients expose a performance/progress bar container; hide if present + if MainMenuBarPerformanceBar then + MainMenuBarPerformanceBar:UnregisterAllEvents() + MainMenuBarPerformanceBar:Hide() + end end --- The Main Draw Function (Called from Core.lua)