X-Git-Url: https://www.aleksib.fi/git/wowui.git/blobdiff_plain/970f9377d0344b60ab9b77796135726bfecfdd20..5adea533cd42eb9aa9ab72ea8306234e83ff5626:/OmaAB/ExpBar.lua?ds=sidebyside diff --git a/OmaAB/ExpBar.lua b/OmaAB/ExpBar.lua index 021ac76..9505c78 100644 --- a/OmaAB/ExpBar.lua +++ b/OmaAB/ExpBar.lua @@ -4,17 +4,15 @@ local min = math.min; local IsResting = IsResting; local UnitXP, UnitXPMax, GetXPExhaustion = UnitXP, UnitXPMax, GetXPExhaustion; local CTimerAfter = C_Timer.After; -local ExhaustionToolTipText = ExhaustionToolTipText; -local GameTooltip = nil; local width = 300; local running = false; -local frame = CreateFrame("Frame", "OmaExpBar", UIParent); +local frame = CreateFrame("Frame", "OmaArtifactBar", UIParent); local function expBar() - frame:SetPoint("BOTTOM"); + frame:SetPoint("BOTTOM", UIParent, "BOTTOM", 0, 8); frame:SetWidth(width); - frame:SetHeight(10); + frame:SetHeight(8); frame.base = frame:CreateTexture(nil, "BACKGROUND"); frame.base:SetAllPoints(); frame.base:SetColorTexture(0, 0, 0, 0.5); @@ -57,7 +55,7 @@ local function expBar() frame:SetScript("OnEvent", function(self, event) if event == "PLAYER_XP_UPDATE" or event == "PLAYER_LEVEL_UP" then updateXP(); - elseif event == "PLAYER_UPDATE_RESTING" then + elseif event == "PLAYER_UPDATE_RESTING" or event == "PLAYER_ENTERING_WORLD" then if IsResting() then running = true; CTimerAfter(6, updater); @@ -70,17 +68,15 @@ local function expBar() frame:RegisterEvent("PLAYER_XP_UPDATE"); frame:RegisterEvent("PLAYER_LEVEL_UP"); frame:RegisterEvent("PLAYER_UPDATE_RESTING"); + frame:RegisterEvent("PLAYER_ENTERING_WORLD"); -- from FrameXML/MainMenuBar.lua - frame:SetScript("OnEnter", function(frame) frame.text:Show(); ExhaustionToolTipText(); end); - frame:SetScript("OnLeave", function(frame) frame.text:Hide(); GameTooltip:Hide(); end); + frame:SetScript("OnEnter", function(frame) frame.text:Show(); end); + frame:SetScript("OnLeave", function(frame) frame.text:Hide(); end); end -frame:RegisterEvent("PLAYER_LOGIN"); frame:SetScript("OnEvent", function(self, event) - if event == "PLAYER_LOGIN" then - GameTooltip = _G["GameTooltip"]; - if UnitLevel("player") < 110 and not IsXPUserDisabled() then - return expBar(); - end + if UnitLevel("player") < 60 and not IsXPUserDisabled() then + return expBar(); end end); +frame:RegisterEvent("PLAYER_LOGIN");