xpbar: add previously added xp to session

This commit is contained in:
shagu
2018-02-10 11:19:59 +01:00
parent 371d553703
commit 99ea8862bb
+6 -1
View File
@@ -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"))