|
local function Update(self, event, unit) |
local bar = self.Reputation |
if(not GetWatchedFactionInfo()) then return bar:Hide() |
|
if(GetWatchedFactionInfo()) then |
local name, id, min, max, value = GetWatchedFactionInfo() |
|
local name, id, min, max, value = GetWatchedFactionInfo() |
bar:SetMinMaxValues(min, max) |
bar:SetValue(value) |
bar:Show() |
bar:SetMinMaxValues(min, max) |
bar:SetValue(value) |
bar:EnableMouse() |
bar:Show() |
|
if(bar.Text) then |
if(bar.OverrideText) then |
bar:OverrideText(min, max, value, name, id) |
else |
bar.Text:SetFormattedText('%d / %d - %s', value - min, max - min, name) |
if(bar.Text) then |
if(bar.OverrideText) then |
bar:OverrideText(min, max, value, name, id) |
else |
bar.Text:SetFormattedText('%d / %d - %s', value - min, max - min, name) |
end |
end |
end |
|
if(bar.Tooltip) then |
bar:SetScript('OnEnter', function() |
Tooltip(bar, value - min, max - min, name, id) |
end) |
end |
if(bar.Tooltip and bar.MouseOver) then |
bar:SetScript('OnEnter', function() bar:SetAlpha(1); Tooltip(bar, value - min, max - min, name, id) end) |
elseif(bar.Tooltip and not bar.MouseOver) then |
bar:SetScript('OnEnter', function() Tooltip(bar, value - min, max - min, name, id) end) |
end |
|
if(bar.PostUpdate) then bar.PostUpdate(self, event, unit, bar, min, max, value, name, id) end |
if(bar.PostUpdate) then bar.PostUpdate(self, event, unit, bar, min, max, value, name, id) end |
else |
bar:Hide() |
end |
end |
|
local function Enable(self, unit) |
local function Enable(self) |
local reputation = self.Reputation |
if(reputation and unit == 'player') then |
if(reputation) then |
self:RegisterEvent('UPDATE_FACTION', Update) |
|
if(reputation.Tooltip or reputation.MouseOver) then |
reputation:EnableMouse() |
if(not reputation:GetStatusBarTexture()) then |
reputation:SetStatusBarTexture([=[Interface\TargetingFrame\UI-StatusBar]=]) |
end |
|
if(reputation.Tooltip and reputation.MouseOver) then |