WoWInterface SVN oUF_Experience

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 27 to Rev 28
    Reverse comparison

Rev 27 → Rev 28

trunk/oUF_Experience/oUF_Experience.lua
13,19 → 13,15
- :OverrideText(min, max)
 
--]]
 
local localized, class = UnitClass('player')
 
local function Tooltip(self, unit, min, max)
local function Tooltip(self, unit, min, max, num)
if(self.MouseOver) then self:SetAlpha(1) end
 
GameTooltip:SetOwner(self, 'ANCHOR_BOTTOMRIGHT', 5, -5)
GameTooltip:AddLine(string.format('XP: %d/%d (%.1f%%)', min, max, min/max*100))
GameTooltip:AddLine(string.format('%d needed (%.1f%% - %.1f bars)', max-min, (max-min)/max*100, num*(max-min)/max))
 
if(unit == 'pet') then
GameTooltip:AddLine(string.format('%d needed (%.1f%% - %.1f bars)', max-min, (max-min)/max*100, 6*(max-min)/max))
else
GameTooltip:AddLine(string.format('%d needed (%.1f%% - %.1f bars)', max-min, (max-min)/max*100, 20*(max-min)/max))
end
 
if(unit == 'player' and GetXPExhaustion()) then
GameTooltip:AddLine(string.format('|cff0090ffRested: +%d (%.1f%%)', GetXPExhaustion(), GetXPExhaustion()/max*100))
end
42,33 → 38,33
end
 
local function Update(self, event, unit)
if(event == 'UNIT_PET' and unit ~= 'player') then return end
 
local bar = self.Experience
if(self.unit == 'player' and UnitLevel('player') == MAX_PLAYER_LEVEL) then return bar:Hide() end
if(self.unit == 'pet' and class ~= 'HUNTER') then return bar:Hide() end
if(self.unit == 'pet' and UnitLevel('pet') >= UnitLevel('player')) then bar:Hide() end
 
if(self.unit == 'player' and (UnitLevel(self.unit) ~= MAX_PLAYER_LEVEL) or (self.unit == 'pet' and class == 'HUNTER') and (UnitLevel(self.unit) < UnitLevel('player'))) then
local min, max = GetXP(self.unit)
local min, max = GetXP(self.unit)
bar:SetMinMaxValues(0, max)
bar:SetValue(min)
bar:Show()
 
bar:SetMinMaxValues(0, max)
bar:SetValue(min)
bar:Show()
 
if(bar.Text) then
if(bar.OverrideText) then
bar:OverrideText(min, max)
else
bar.Text:SetFormattedText('%d / %d', min, max)
end
if(bar.Text) then
if(bar.OverrideText) then
bar:OverrideText(min, max)
else
bar.Text:SetFormattedText('%d / %d', min, max)
end
end
 
if(bar.Tooltip and bar.MouseOver) then
bar:SetScript('OnEnter', function() bar:SetAlpha(1); Tooltip(bar, self.unit, min, max) end)
elseif(bar.Tooltip and not bar.MouseOver) then
bar:SetScript('OnEnter', function() Tooltip(bar, self.unit, min, max) end)
end
 
if(bar.PostUpdate) then bar.PostUpdate(self, event, unit, bar, min, max) end
else
bar:Hide()
if(bar.Tooltip) then
bar:SetScript('OnEnter', function()
Tooltip(bar, self.unit, min, max, self.unit == 'pet' and 6 or 20)
end)
end
 
if(bar.PostUpdate) then bar.PostUpdate(self, event, unit, bar, min, max) end
end
 
local function Enable(self, unit)
85,10 → 81,6
experience:EnableMouse()
end
 
if(not experience:GetStatusBarTexture()) then
experience:SetStatusBarTexture([=[Interface\TargetingFrame\UI-StatusBar]=])
end
 
if(experience.Tooltip and experience.MouseOver) then
experience:SetAlpha(0)
experience:SetScript('OnLeave', function(self) self:SetAlpha(0); GameTooltip:Hide() end)
100,6 → 92,10
experience:SetScript('OnLeave', function() GameTooltip:Hide() end)
end
 
if(not experience:GetStatusBarTexture()) then
experience:SetStatusBarTexture([=[Interface\TargetingFrame\UI-StatusBar]=])
end
 
return true
end
end