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) |