--- ActionBars.lua
+-- ExpBar.lua
local _;
local min = math.min;
-local CreateFrame, IsResting = CreateFrame, IsResting;
+local IsResting = IsResting;
local UnitXP, UnitXPMax, GetXPExhaustion = UnitXP, UnitXPMax, GetXPExhaustion;
local CTimerAfter = C_Timer.After;
local ExhaustionToolTipText = ExhaustionToolTipText;
local width = 300;
local running = false;
+local frame = CreateFrame("Frame", "OmaExpBar", UIParent);
-local ActionBars = CreateFrame("Frame", "OmaActionBars");
-
-local function expBar(parent)
- local frame = CreateFrame("Frame", "OmaExpBar", parent);
+local function expBar()
frame:SetPoint("BOTTOM");
frame:SetWidth(width);
frame:SetHeight(10);
end
end
end);
+ frame:UnregisterAllEvents();
frame:RegisterEvent("PLAYER_XP_UPDATE");
frame:RegisterEvent("PLAYER_LEVEL_UP");
frame:RegisterEvent("PLAYER_UPDATE_RESTING");
frame:SetScript("OnLeave", function(frame) frame.text:Hide(); GameTooltip:Hide(); end);
end
-local function initialize()
- -- let other addons hook this to anchor tooltip elsewhere
- GameTooltip = _G["GameTooltip"];
- if UnitLevel("player") < 110 and not IsXPUserDisabled() then
- expBar(UIParent);
- end
-end
-
-ActionBars:RegisterEvent("PLAYER_LOGIN");
-ActionBars:SetScript("OnEvent", function(self, event)
+frame:RegisterEvent("PLAYER_LOGIN");
+frame:SetScript("OnEvent", function(self, event)
if event == "PLAYER_LOGIN" then
- initialize();
+ GameTooltip = _G["GameTooltip"];
+ if UnitLevel("player") < 110 and not IsXPUserDisabled() then
+ return expBar();
+ end
end
end);