--[[ Copyright (c) 2014 Eyal Shilony <Lynxium> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] local _, addon = ... local MAX_BUBBLES = 20 function addon:GetXPInfo() local xp, xpMax = UnitXP("player"), UnitXPMax("player") local xpPercent = xp / xpMax * 100 local rested = GetXPExhaustion() or 0 local restedPercent = rested / xpMax * 100 local tnl = xpMax - xp local tnlPercent = tnl / xpMax * 100 local width = MainMenuExpBar:GetWidth() local divWidth = width / MAX_BUBBLES local totalProgress = xp / xpMax * width local bubbles = totalProgress / divWidth return xp, xpMax, xpPercent, rested, restedPercent, tnl, tnlPercent, bubbles, MAX_BUBBLES end function addon:Paste() local text local _, _, xpPercent, rested, restedPercent, _, _, bubbles = self:GetXPInfo() local level = UnitLevel("player") if rested ~= 0 then text = format("[Current Level %s] XP: %.1f%% (%.1f%%)", level, xpPercent, restedPercent) else text = format("[Current Level %s] XP: %.1f%%", level, xpPercent) end ChatFrame_OpenChat(text) end