diff --git a/api/config.lua b/api/config.lua index 9b252f76..95599cd6 100644 --- a/api/config.lua +++ b/api/config.lua @@ -596,9 +596,12 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("panel", "xp", "xp_mode", "VERTICAL") pfUI:UpdateConfig("panel", "xp", "xp_anchor", "pfChatLeft") pfUI:UpdateConfig("panel", "xp", "xp_position", "RIGHT") + pfUI:UpdateConfig("panel", "xp", "xp_text", "0") + pfUI:UpdateConfig("panel", "xp", "xp_text_off_y", "0") + pfUI:UpdateConfig("panel", "xp", "xp_text_mouse", "0") pfUI:UpdateConfig("panel", "xp", "xp_color", ".25,.25,1,1") pfUI:UpdateConfig("panel", "xp", "rest_color", "1,.25,1,.5") - pfUI:UpdateConfig("panel", "xp", "texture", "Interface\\AddOns\\pfUI\\img\\bar") + pfUI:UpdateConfig("panel", "xp", "texture", "Interface\\AddOns\\pfUI\\img\\bar") pfUI:UpdateConfig("panel", "xp", "rep_always", "0") pfUI:UpdateConfig("panel", "xp", "rep_display", "REP") @@ -608,6 +611,9 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("panel", "xp", "rep_mode", "VERTICAL") pfUI:UpdateConfig("panel", "xp", "rep_anchor", "pfChatRight") pfUI:UpdateConfig("panel", "xp", "rep_position", "LEFT") + pfUI:UpdateConfig("panel", "xp", "rep_text", "0") + pfUI:UpdateConfig("panel", "xp", "rep_text_off_y", "0") + pfUI:UpdateConfig("panel", "xp", "rep_text_mouse", "0") pfUI:UpdateConfig("panel", "xp", "dont_overlap", "0") pfUI:UpdateConfig("castbar", "player", "hide_blizz", "1") diff --git a/modules/gui.lua b/modules/gui.lua index 28f24a57..e5de8c32 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -2103,6 +2103,11 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function () CreateConfig(U["xpbar"], T["Aligned Position"], C.panel.xp, "xp_position", "dropdown", pfUI.gui.dropdowns.xp_position) CreateConfig(U["xpbar"], T["Don't overlap rested"], C.panel.xp, "dont_overlap", "checkbox") + CreateConfig(nil, T["Text"], nil, nil, "header") + CreateConfig(U["xpbar"], T["Show Text"], C.panel.xp, "xp_text", "checkbox") + CreateConfig(U["xpbar"], T["Vertical Text Offset"], C.panel.xp, "xp_text_off_y") + CreateConfig(U["xpbar"], T["Only Show On Mouse Over"], C.panel.xp, "xp_text_mouse", "checkbox") + CreateConfig(nil, T["Colors"], nil, nil, "header") CreateConfig(U["xpbar"], T["Experience Color"], C.panel.xp, "xp_color", "color") CreateConfig(U["xpbar"], T["Rested Color"], C.panel.xp, "rest_color", "color") @@ -2118,6 +2123,11 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function () CreateConfig(U["xpbar"], T["Orientation"], C.panel.xp, "rep_mode", "dropdown", pfUI.gui.dropdowns.orientation) CreateConfig(U["xpbar"], T["Frame Anchor"], C.panel.xp, "rep_anchor", "dropdown", pfUI.gui.dropdowns.xpanchors) CreateConfig(U["xpbar"], T["Aligned Position"], C.panel.xp, "rep_position", "dropdown", pfUI.gui.dropdowns.xp_position) + + CreateConfig(nil, T["Text"], nil, nil, "header") + CreateConfig(U["xpbar"], T["Show Text"], C.panel.xp, "rep_text", "checkbox") + CreateConfig(U["xpbar"], T["Vertical Text Offset"], C.panel.xp, "rep_text_off_y") + CreateConfig(U["xpbar"], T["Only Show On Mouse Over"], C.panel.xp, "rep_text_mouse", "checkbox") end) CreateGUIEntry(T["Tooltip"], nil, function() diff --git a/modules/xpbar.lua b/modules/xpbar.lua index e985bdb8..7b1ed36f 100644 --- a/modules/xpbar.lua +++ b/modules/xpbar.lua @@ -115,6 +115,14 @@ end local function OnUpdate(self) local self = self or this + if self.text_mouse == "1" then + if MouseIsOver(self) then + self.bar.text:Show() + else + self.bar.text:Hide() + end + end + if self.always then return end if self:GetAlpha() == 0 or MouseIsOver(self) then return end if ( self.tick or 1) > GetTime() then return else self.tick = GetTime() + .01 end @@ -160,6 +168,13 @@ end self.restedbar:Hide() end + local text = "%s: %s%%" + local xp, xpmax, ex = UnitXP("player"), UnitXPMax("player"), GetXPExhaustion() + local xpperc = round(xp / xpmax * 100) + local experc = ex and round(ex / xpmax * 100) or 0 + if ex then text = "%s: %s%% (%s%% %s)" end + self.bar.text:SetText(string.format(text, T["Experience"], xpperc, experc, T["Rested"])) + self.tick = GetTime() + self.timeout return elseif mode == "PETXP" then @@ -170,6 +185,11 @@ end local currXP, nextXP = GetPetExperience() self.bar:SetMinMaxValues(min(0, currXP), nextXP) self.bar:SetValue(currXP) + + local text = "%s: %s%%" + local xpperc = nextXP and nextXP ~= 0 and round(currXP / nextXP * 100) or 0 + self.bar.text:SetText(string.format(text, T["Pet Experience"], xpperc)) + self.tick = GetTime() + self.timeout return elseif mode == "REP" then @@ -194,6 +214,11 @@ end self.bar:SetStatusBarColor(.5,.5,.5,1) end + local text = "%s: %s%% (%s)" + local perc = round(barValue / barMax * 100) + local standing = GetText("FACTION_STANDING_LABEL"..standingID, gender) + self.bar.text:SetText(string.format(text, name, perc, standing)) + self.tick = GetTime() + self.timeout return end @@ -218,6 +243,9 @@ end b.anchor = t == "XP" and C.panel.xp.xp_anchor or C.panel.xp.rep_anchor b.position = t == "XP" and C.panel.xp.xp_position or C.panel.xp.rep_position b.display = t == "XP" and C.panel.xp.xp_display or C.panel.xp.rep_display + b.text = t == "XP" and C.panel.xp.xp_text or C.panel.xp.rep_text + b.text_off_y = t == "XP" and C.panel.xp.xp_text_off_y or C.panel.xp.rep_text_off_y + b.text_mouse = t == "XP" and C.panel.xp.xp_text_mouse or C.panel.xp.rep_text_mouse local barLevel, restedLevel = 0, 1 if C.panel.xp.dont_overlap == "1" then @@ -251,6 +279,17 @@ end b.bar:SetStatusBarColor(cr,cg,cb,ca) b.bar:SetOrientation(b.mode) + b.bar.text = b.bar.text or b.bar:CreateFontString() + b.bar.text:SetPoint("CENTER", b, "CENTER", 0, b.text_off_y) + b.bar.text:SetJustifyH("CENTER") + b.bar.text:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE") + + if b.text == "1" then + b.bar.text:Show() + else + b.bar.text:Hide() + end + b.restedbar = b.restedbar or CreateFrame("StatusBar", nil, b) b.restedbar:SetStatusBarTexture(pfUI.media[C.panel.xp.texture]) b.restedbar:ClearAllPoints()