From fd2ecbaa87a9d9d3a1a4c0d0a3b172c314116f13 Mon Sep 17 00:00:00 2001 From: Adrian L Lange Date: Fri, 7 Aug 2009 19:37:08 +0200 Subject: [PATCH] Messy commit is messy --- oUF_Reputation.lua | 146 ++++++++++++++++++++++++++-------------------------- oUF_Reputation.toc | 16 +++--- 2 files changed, 81 insertions(+), 81 deletions(-) diff --git a/oUF_Reputation.lua b/oUF_Reputation.lua index b90542e..7ee44ad 100644 --- a/oUF_Reputation.lua +++ b/oUF_Reputation.lua @@ -1,73 +1,73 @@ ---[[ - - Elements handled: - .Reputation [statusbar] - .Reputation.Text [fontstring] (optional) - - Booleans: - - Tooltip - - Functions that can be overridden from within a layout: - - 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) - 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 (%d%%)', min, max, min / max * 100)) - GameTooltip:Show() -end - -local function update(self, event, unit) - local bar = self.Reputation - if(not GetWatchedFactionInfo()) then return bar:Hide() end - - local name, id, min, max, value = GetWatchedFactionInfo() - bar:SetMinMaxValues(min, max) - bar:SetValue(value) - 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) - end - end - - if(bar.Tooltip) 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 -end - -local function enable(self, unit) - local reputation = self.Reputation - if(reputation and unit == 'player') then - 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) - if(self.Reputation) then - self:UnregisterEvent('UPDATE_FACTION', update) - end -end - -oUF:AddElement('Reputation', update, enable, disable) +--[[ + + Elements handled: + .Reputation [statusbar] + .Reputation.Text [fontstring] (optional) + + Booleans: + - Tooltip + + Functions that can be overridden from within a layout: + - 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) + 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 (%d%%)', min, max, min / max * 100)) + GameTooltip:Show() +end + +local function update(self, event, unit) + local bar = self.Reputation + if(not GetWatchedFactionInfo()) then return bar:Hide() end + + local name, id, min, max, value = GetWatchedFactionInfo() + bar:SetMinMaxValues(min, max) + bar:SetValue(value) + 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) + end + end + + if(bar.Tooltip) 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 +end + +local function enable(self, unit) + local reputation = self.Reputation + if(reputation and unit == 'player') then + 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) + if(self.Reputation) then + self:UnregisterEvent('UPDATE_FACTION', update) + end +end + +oUF:AddElement('Reputation', update, enable, disable) diff --git a/oUF_Reputation.toc b/oUF_Reputation.toc index 3cb9300..7754903 100644 --- a/oUF_Reputation.toc +++ b/oUF_Reputation.toc @@ -1,8 +1,8 @@ -## Interface: 30200 -## Author: p3lim -## Version: Alpha -## Title: oUF Reputation -## Notes: Reputation Bar support for oUF layouts. -## RequiredDeps: oUF - -oUF_Reputation.lua +## Interface: 30200 +## Author: p3lim +## Version: Alpha +## Title: oUF Reputation +## Notes: Reputation Bar support for oUF layouts. +## RequiredDeps: oUF + +oUF_Reputation.lua -- 1.7.9.5