Skip to content

Commit

Permalink
Fix a bug where the XP bar wouldn't hide on reaching max level
Browse files Browse the repository at this point in the history
  • Loading branch information
azuraji committed Jan 9, 2023
1 parent 867ae81 commit 928e361
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions FuBar_FuXPFu/FuBar_FuXPFu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ end

function FuXP:ShowBar()
self:HideBar()
if self.db.profile.ShowXP == true then
if self.db.profile.ShowXP == true and not UnitLevel("player") == MAX_PLAYER_LEVEL then
self.XPBar:Show()
self.Spark:Show()
self.Spark2:Show()
Expand Down Expand Up @@ -720,9 +720,6 @@ function FuXP:OnTextUpdate()
self:OnDataUpdate()
self:Reanchor()

local max, xp = UnitXPMax("player"), UnitXP("player")
local toGo = max - xp

-- Setup watched factions

if factionID ~= 0 then -- 'Unknown' usually means that the player just started their character and aren't tracking any faction
Expand Down Expand Up @@ -787,6 +784,9 @@ function FuXP:OnTextUpdate()
end

if UnitLevel("player") ~= MAX_PLAYER_LEVEL then
local max, xp = UnitXPMax("player"), UnitXP("player")
local toGo = max - xp

if maxRep - currentRep > 0 then
self:SetText(string.format(L["%s: %3.0f%% (%s/%s) (%s) // XP: %3.0f%%/%s to go"], name, ((currentRep - minRep) / (maxRep - minRep)) * 100, numWithCommas(currentRep - minRep), numWithCommas(maxRep - minRep), factionStandingLabel .. "|r", math.floor(xp / max * 100), numWithCommas(toGo)))
else
Expand Down
2 changes: 1 addition & 1 deletion FuBar_FuXPFu/FuBar_FuXPFu.toc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## Notes: Lightweight XP Bar
## Notes-zhCN: 迷你经验条
## Notes-zhTW: 輕量級的經驗值條模組。
## Version: 10.0.2.7
## Version: 10.0.2.8
## Author: Wobin, azuraji
## eMail: [email protected]
## X-Credits: Bant (For the design)
Expand Down

0 comments on commit 928e361

Please sign in to comment.