Quantcast
WoWInterface: SVN - oUF_Reputation - Path Comparison - / Rev 7 and / Rev 8

WoWInterface SVN oUF_Reputation

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 7 to Rev 8
    Reverse comparison

Rev 7 → Rev 8

trunk/oUF_Reputation/oUF_Reputation.toc
1,6 → 1,6
## Interface: 30100
## Interface: 30200
## Author: p3lim
## Version: 30100.wowi:revision
## Version: 30200.wowi:revision
## Title: oUF Reputation
## Notes: Reputation Bar support for oUF layouts.
## RequiredDeps: oUF
trunk/oUF_Reputation/oUF_Reputation.lua
4,25 → 4,23
.Reputation [statusbar]
.Reputation.Text [fontstring] (optional)
 
Shared:
- MouseOver [boolean]
- Tooltip [boolean]
Booleans:
- Tooltip
 
Functions that can be overridden from within a layout:
- :PostUpdate(event, unit, bar, min, max, value, name, id)
- :OverrideText(min, max, value, name, id)
- PostUpdate(self, event, unit, bar, min, max, value, name, id)
- OverrideText(bar, min, max, value, name, id)
 
--]]
local function Tooltip(self, min, max, name, id)
if(self.MouseOver) then self:SetAlpha(1) end
 
local function tooltip(self, min, max, name, id)
GameTooltip:SetOwner(self, 'ANCHOR_BOTTOMRIGHT', 5, -5)
GameTooltip:AddLine(string.format('%s (%s)', name, _G['FACTION_STANDING_LABEL'..id]))
GameTooltip:AddLine(string.format('%d/%d (%.1f%%)', min, max, min/max*100))
GameTooltip:AddLine(string.format('%d / %d (%d%%)', min, max, min / max * 100))
GameTooltip:Show()
end
 
local function Update(self, event, unit)
local function update(self, event, unit)
local bar = self.Reputation
if(not GetWatchedFactionInfo()) then return bar:Hide() end
 
41,46 → 39,35
 
if(bar.Tooltip) then
bar:SetScript('OnEnter', function()
Tooltip(bar, value - min, max - min, name, id)
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
end
 
local function Enable(self, unit)
local function enable(self, unit)
local reputation = self.Reputation
if(reputation and unit == 'player') then
self:RegisterEvent('UPDATE_FACTION', Update)
 
if(reputation.Tooltip or reputation.MouseOver) then
reputation:EnableMouse()
end
 
if(reputation.Tooltip and reputation.MouseOver) then
reputation:SetAlpha(0)
reputation:SetScript('OnLeave', function(self) self:SetAlpha(0); GameTooltip:Hide() end)
elseif(reputation.MouseOver and not reputation.Tooltip) then
reputation:SetAlpha(0)
reputation:SetScript('OnEnter', function(self) self:SetAlpha(1) end)
reputation:SetScript('OnLeave', function(self) self:SetAlpha(0) end)
elseif(reputation.Tooltip and not reputation.MouseOver) then
reputation:SetScript('OnLeave', function() GameTooltip:Hide() end)
end
 
if(not reputation:GetStatusBarTexture()) then
reputation:SetStatusBarTexture([=[Interface\TargetingFrame\UI-StatusBar]=])
end
 
self:RegisterEvent('UPDATE_FACTION', update)
 
if(reputation.Tooltip) then
reputation:EnableMouse()
reputation:SetScript('OnLeave', GameTooltip_OnLeave)
end
 
return true
end
end
 
local function Disable(self)
local function disable(self)
if(self.Reputation) then
self:UnregisterEvent('UPDATE_FACTION', Update)
self:UnregisterEvent('UPDATE_FACTION', update)
end
end
 
oUF:AddElement('Reputation', Update, Enable, Disable)
\ No newline at end of file +oUF:AddElement('Reputation', update, enable, disable) \ No newline at end of file