WoWInterface SVN oUF_Experience

Compare Revisions

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

Rev 28 → Rev 27

trunk/oUF_Experience/oUF_Experience.lua
13,15 → 13,19
- :OverrideText(min, max)
 
--]]
 
local localized, class = UnitClass('player')
 
local function Tooltip(self, unit, min, max, num)
if(self.MouseOver) then self:SetAlpha(1) end
 
local function Tooltip(self, unit, min, max)
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
38,33 → 42,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
 
local min, max = GetXP(self.unit)
bar:SetMinMaxValues(0, max)
bar:SetValue(min)
bar:Show()
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)
 
if(bar.Text) then
if(bar.OverrideText) then
bar:OverrideText(min, max)
else
bar.Text:SetFormattedText('%d / %d', min, max)
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
end
end
 
if(bar.Tooltip) then
bar:SetScript('OnEnter', function()
Tooltip(bar, self.unit, min, max, self.unit == 'pet' and 6 or 20)
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()
end
 
if(bar.PostUpdate) then bar.PostUpdate(self, event, unit, bar, min, max) end
end
 
local function Enable(self, unit)
81,6 → 85,10
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)
92,10 → 100,6
experience:SetScript('OnLeave', function() GameTooltip:Hide() end)
end
 
if(not experience:GetStatusBarTexture()) then
experience:SetStatusBarTexture([=[Interface\TargetingFrame\UI-StatusBar]=])
end
 
return true
end
end