From 99ea8862bb63a388cc01b0f79ee8985692bc138e Mon Sep 17 00:00:00 2001 From: shagu Date: Sat, 10 Feb 2018 11:19:59 +0100 Subject: [PATCH] xpbar: add previously added xp to session --- modules/xpbar.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/xpbar.lua b/modules/xpbar.lua index 3be59403..2b0403fe 100644 --- a/modules/xpbar.lua +++ b/modules/xpbar.lua @@ -15,11 +15,16 @@ pfUI:RegisterModule("xpbar", function () pfUI.xp:RegisterEvent("PLAYER_ENTERING_WORLD") pfUI.xp:SetScript("OnEvent", function() - if event == "PLAYER_ENTERING_WORLD" or event == "PLAYER_LEVEL_UP" then + if event == "PLAYER_ENTERING_WORLD" then pfUI.xp.starttime = GetTime() pfUI.xp.startxp = UnitXP("player") end + if event == "PLAYER_LEVEL_UP" then + -- add previously gained experience to the session + pfUI.xp.startxp = pfUI.xp.startxp - UnitXPMax("player") + end + if UnitXPMax("player") ~= 0 then pfUI.xp.bar:SetMinMaxValues(0, UnitXPMax("player")) pfUI.xp.bar:SetValue(UnitXP("player"))