From 994f6cb858f563722883c3f2a21671a2659ba228 Mon Sep 17 00:00:00 2001 From: Adrian L Lange Date: Tue, 4 Oct 2011 03:20:27 +0200 Subject: [PATCH] Normalize values --- oUF_Reputation.lua | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/oUF_Reputation.lua b/oUF_Reputation.lua index b5d1f2e..ddfd3c7 100644 --- a/oUF_Reputation.lua +++ b/oUF_Reputation.lua @@ -4,16 +4,16 @@ assert(oUF, 'oUF Reputation was unable to locate oUF install') for tag, func in pairs({ ['currep'] = function() - local _, _, _, _, value = GetWatchedFactionInfo() - return value + local _, _, min, _, value = GetWatchedFactionInfo() + return value - min end, ['maxrep'] = function() - local _, _, _, max = GetWatchedFactionInfo() - return max + local _, _, min, max = GetWatchedFactionInfo() + return max - min end, ['perrep'] = function() - local _, _, _, max, value = GetWatchedFactionInfo() - return math.floor(value / max * 100 + 0.5) + local _, _, min, max, value = GetWatchedFactionInfo() + return math.floor((value - min) / (max - min) * 100 + 0.5) end, ['standing'] = function() local _, standing = GetWatchedFactionInfo() @@ -29,16 +29,16 @@ end local function Update(self, event, unit) local reputation = self.Reputation - - if(not GetWatchedFactionInfo()) then + + local name, standing, min, max, value = GetWatchedFactionInfo() + if(not name) then return reputation:Hide() else reputation:Show() end - local name, standing, min, max, value = GetWatchedFactionInfo() - reputation:SetMinMaxValues(min, max) - reputation:SetValue(value) + reputation:SetMinMaxValues(0, max - min) + reputation:SetValue(value - min) if(reputation.PostUpdate) then return reputation:PostUpdate(unit, name, standing, min, max, value) -- 1.7.9.5