From c5d2851fdc530efc2350f206bbde078ef4ce228d Mon Sep 17 00:00:00 2001 From: MilleXIV Date: Fri, 2 Sep 2016 07:41:24 -0400 Subject: [PATCH] XP tooltip --- locales/enUS.lua | 6 ++---- modules/currency.lua | 44 ++++++++++++++++++++++++++++++++++---------- 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/locales/enUS.lua b/locales/enUS.lua index 687ef00..850b8ab 100644 --- a/locales/enUS.lua +++ b/locales/enUS.lua @@ -40,11 +40,7 @@ L['Inactive'] = true; L['Use Class Colors for Hover'] = true; L['Hover'] = true; - - - -------------------- MODULES --------------------------- -L['Test Module'] = true; L['Micromenu'] = true; L['Show Social Tooltips'] = true; @@ -99,6 +95,8 @@ L['Currency Select'] = true; L['First Currency'] = true; L['Second Currency'] = true; L['Third Currency'] = true; +L['XP'] = true; +L['Rested'] = true; L['System'] = true; L['Show World Ping'] = true; diff --git a/modules/currency.lua b/modules/currency.lua index 109a3fb..0964711 100644 --- a/modules/currency.lua +++ b/modules/currency.lua @@ -232,6 +232,7 @@ function CurrencyModule:RegisterFrameEvents() self.xpFrame:SetScript('OnEnter', function() if InCombatLockdown() then return; end self.xpText:SetTextColor(unpack(xb:HoverColors())) + self:ShowTooltip() end) self.xpFrame:SetScript('OnLeave', function() @@ -254,21 +255,44 @@ function CurrencyModule:RegisterFrameEvents() end function CurrencyModule:ShowTooltip() - if xb.constants.playerLevel < MAX_PLAYER_LEVEL and xb.db.profile.modules.currency.showXPbar then return; end + if not xb.db.profile.modules.currency.showTooltip then return; end + GameTooltip:SetOwner(self.currencyFrame, 'ANCHOR_'..xb.miniTextPosition) - GameTooltip:AddLine("[|cff6699FF"..L['Currency'].."|r]") - GameTooltip:AddLine(" ") - for i = 1, 3 do - if xb.db.profile.modules.currency[self.intToOpt[i]] ~= '0' then - local curId = tonumber(xb.db.profile.modules.currency[self.intToOpt[i]]) - local name, count, _, _, _, totalMax, _, _ = GetCurrencyInfo(curId) - GameTooltip:AddDoubleLine(name, string.format('%d/%d', count, totalMax), 1, 1, 0, 1, 1, 1) + if xb.constants.playerLevel < MAX_PLAYER_LEVEL and xb.db.profile.modules.currency.showXPbar then + GameTooltip:AddLine("[|cff6699FF"..POWER_TYPE_EXPERIENCE.."|r]") + GameTooltip:AddLine(" ") + + local curXp = UnitXP('player') + local maxXp = UnitXPMax('player') + local rested = GetXPExhaustion() + -- XP + GameTooltip:AddDoubleLine(L['XP']..':', string.format('%d / %d (%d%%)', curXp, maxXp, floor((curXp / maxXp) * 100)), 1, 1, 0, 1, 1, 1) + -- Remaining + GameTooltip:AddDoubleLine(L['Remaining']..':', string.format('%d (%d%%)', (maxXp - curXp), floor(((maxXp - curXp) / maxXp) * 100)), 1, 1, 0, 1, 1, 1) + -- Rested + if rested then + GameTooltip:AddDoubleLine(L['Rested']..':', string.format('+%d (%d%%)', rested, floor((rested / maxXp) * 100)), 1, 1, 0, 1, 1, 1) + end + + --GameTooltip:AddLine(" ") + --GameTooltip:AddDoubleLine('<'..L['Left-Click']..'>', L['Toggle Currency Frame'], 1, 1, 0, 1, 1, 1) + else + GameTooltip:AddLine("[|cff6699FF"..L['Currency'].."|r]") + GameTooltip:AddLine(" ") + + for i = 1, 3 do + if xb.db.profile.modules.currency[self.intToOpt[i]] ~= '0' then + local curId = tonumber(xb.db.profile.modules.currency[self.intToOpt[i]]) + local name, count, _, _, _, totalMax, _, _ = GetCurrencyInfo(curId) + GameTooltip:AddDoubleLine(name, string.format('%d/%d', count, totalMax), 1, 1, 0, 1, 1, 1) + end end + + GameTooltip:AddLine(" ") + GameTooltip:AddDoubleLine('<'..L['Left-Click']..'>', L['Toggle Currency Frame'], 1, 1, 0, 1, 1, 1) end - GameTooltip:AddLine(" ") - GameTooltip:AddDoubleLine('<'..L['Left-Click']..'>', L['Toggle Currency Frame'], 1, 1, 0, 1, 1, 1) GameTooltip:Show() end -- 1.7.9.5