From 9f2897b63449faa55eef0fa8a06a59c754de8ddf Mon Sep 17 00:00:00 2001 From: Adrian L Lange Date: Fri, 7 Aug 2009 19:44:00 +0200 Subject: [PATCH] Set tooltip once --- oUF_Reputation.lua | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/oUF_Reputation.lua b/oUF_Reputation.lua index f787209..35b1e75 100644 --- a/oUF_Reputation.lua +++ b/oUF_Reputation.lua @@ -13,10 +13,11 @@ --]] -local function tooltip(self, min, max, name, id) +local function tooltip(self) + local name, id, min, max, value = GetWatchedFactionInfo() 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:AddLine(string.format('%d / %d (%d%%)', value - min, max - min, (value - min) / (max - min) * 100)) GameTooltip:Show() end @@ -37,12 +38,6 @@ local function update(self, event, unit) 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 @@ -58,6 +53,7 @@ local function enable(self, unit) if(bar.Tooltip) then bar:EnableMouse() bar:SetScript('OnLeave', GameTooltip_OnLeave) + bar:SetScript('OnEnter', tooltip) end return true -- 1.7.9.5