Quantcast
local _, addon = ...

function addon:DisplayTooltip(tooltip)
	tooltip:ClearLines()
	tooltip:AddLine(self.name, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1)
	tooltip:AddLine(" ")

	local xp, xpMax, xpPercent, rested, restedPercent, tnl, tnlPercent, bubbles, maxBubbles = self:GetXPInfo()

	tooltip:AddDoubleLine("XP Bar Progress: ", format("|cffffffff%.0f / " .. maxBubbles .."|r", bubbles))
	tooltip:AddDoubleLine("XP Current: ", format("|cffffffff%s / %s (%.1f%%)|r", xp, xpMax, xpPercent))

	if rested ~= 0 then
		tooltip:AddDoubleLine("XP Rested: ", format("|cffffffff%s (%.1f%%)|r", rested, restedPercent))
	end

	tooltip:AddDoubleLine("XP To Next Level: ", format("|cffffffff%s (%.1f%%)|r", tnl, tnlPercent))
	tooltip:AddLine(" ")
	tooltip:AddDoubleLine("Level: ", format("|cffffffff%s|r", UnitLevel("player")))

	tooltip:Show()
end

function addon:GetTitle()
	local _, _, xpPercent, rested, restedPercent = self:GetXPInfo()
	if rested ~= 0 then
		return format("%.1f%% (%.1f%%)", xpPercent, restedPercent)
	else
		return format("%.1f%%", xpPercent)
	end
end