mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-18 02:30:50 +00:00
xpbar: fix nil error for non rested players
This commit is contained in:
+5
-2
@@ -47,9 +47,12 @@ pfUI:RegisterModule("xpbar", function ()
|
|||||||
pfUI.xp:SetAlpha(1)
|
pfUI.xp:SetAlpha(1)
|
||||||
local xp, xpmax, exh = UnitXP("player"), UnitXPMax("player"), GetXPExhaustion()
|
local xp, xpmax, exh = UnitXP("player"), UnitXPMax("player"), GetXPExhaustion()
|
||||||
local xp_perc = round(xp / xpmax * 100)
|
local xp_perc = round(xp / xpmax * 100)
|
||||||
local exh_perc = round(GetXPExhaustion() / xpmax * 100)
|
|
||||||
local remaining = xpmax - xp
|
local remaining = xpmax - xp
|
||||||
local remaining_perc = round(remaining / xpmax * 100)
|
local remaining_perc = round(remaining / xpmax * 100)
|
||||||
|
local exh_perc = 0
|
||||||
|
if GetXPExhaustion() then
|
||||||
|
exh_perc = round(GetXPExhaustion() / xpmax * 100)
|
||||||
|
end
|
||||||
|
|
||||||
GameTooltip:ClearLines()
|
GameTooltip:ClearLines()
|
||||||
GameTooltip_SetDefaultAnchor(GameTooltip, this)
|
GameTooltip_SetDefaultAnchor(GameTooltip, this)
|
||||||
@@ -60,7 +63,7 @@ pfUI:RegisterModule("xpbar", function ()
|
|||||||
if IsResting() then
|
if IsResting() then
|
||||||
GameTooltip:AddDoubleLine("Status", "|cffffffffResting")
|
GameTooltip:AddDoubleLine("Status", "|cffffffffResting")
|
||||||
end
|
end
|
||||||
if GetXPExhaustion() > 0 then
|
if GetXPExhaustion() then
|
||||||
GameTooltip:AddDoubleLine("Rested", "|cff5555ff+" .. exh .. " (" .. exh_perc .. "%)")
|
GameTooltip:AddDoubleLine("Rested", "|cff5555ff+" .. exh .. " (" .. exh_perc .. "%)")
|
||||||
end
|
end
|
||||||
GameTooltip:Show()
|
GameTooltip:Show()
|
||||||
|
|||||||
Reference in New Issue
Block a user