From 97ccabd48ebf3d649e5e71fb80a35f2f58c36b6b Mon Sep 17 00:00:00 2001 From: p3lim-52096 Date: Thu, 28 Aug 2008 00:14:53 +0000 Subject: [PATCH] Added tooltip support git-svn-id: svn://svn.wowinterface.com/oUF_Experience-227/trunk@5 f81be506-7a38-4956-9b9f-d707db2888a5 --- oUF_Experience/oUF_Experience.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/oUF_Experience/oUF_Experience.lua b/oUF_Experience/oUF_Experience.lua index 50c8b82..01cc1d2 100644 --- a/oUF_Experience/oUF_Experience.lua +++ b/oUF_Experience/oUF_Experience.lua @@ -1,3 +1,18 @@ +local function CreateTooltip(self) + local min, max = UnitXP('player'), UnitXPMax('player') + + GameTooltip:SetOwner(self, "ANCHOR_BOTTOMRIGHT") + if(GetXPExhaustion()) then + GameTooltip:AddLine(format('Rested XP left: %s', GetXPExhaustion())) + GameTooltip:AddLine(' ') + end + GameTooltip:AddLine(format('Percentage through: %s%%', floor(min / max * 100))) + GameTooltip:AddLine(format('Percentage left: %s%%', floor((max - min) / max * 100))) + GameTooltip:AddLine(format('Bars through: %s', floor(min / max * 20))) + GameTooltip:AddLine(format('Bars left: %s', floor((max - min) / max * 20))) + GameTooltip:Show() +end + local function UpdateElement(self, bar) local min, max = UnitXP('player'), UnitXPMax('player') bar:SetMinMaxValues(0, max) @@ -14,6 +29,12 @@ local function UpdateElement(self, bar) if(bar.text) then bar.text:SetFormattedText('%s / %s', min, max) end + + if(bar.tooltip) then + bar:EnableMouse() + bar:SetScript('OnEnter', CreateTooltip) + bar:SetScript('OnLeave', function() GameTooltip:Hide() end) + end end function oUF:PLAYER_XP_UPDATE() -- 1.7.9.5