Quantcast

Update to GitHub

Adrian L Lange [08-07-09 - 16:11]
Update to GitHub
Filename
oUF_Reputation.lua
oUF_Reputation.toc
oUF_Reputation/oUF_Reputation.lua
oUF_Reputation/oUF_Reputation.toc
diff --git a/oUF_Reputation.lua b/oUF_Reputation.lua
new file mode 100644
index 0000000..b90542e
--- /dev/null
+++ b/oUF_Reputation.lua
@@ -0,0 +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)
diff --git a/oUF_Reputation.toc b/oUF_Reputation.toc
new file mode 100644
index 0000000..3cb9300
--- /dev/null
+++ b/oUF_Reputation.toc
@@ -0,0 +1,8 @@
+## Interface: 30200
+## Author: p3lim
+## Version: Alpha
+## Title: oUF Reputation
+## Notes: Reputation Bar support for oUF layouts.
+## RequiredDeps: oUF
+
+oUF_Reputation.lua
diff --git a/oUF_Reputation/oUF_Reputation.lua b/oUF_Reputation/oUF_Reputation.lua
deleted file mode 100644
index b1614a8..0000000
--- a/oUF_Reputation/oUF_Reputation.lua
+++ /dev/null
@@ -1,73 +0,0 @@
---[[
-
-	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)
\ No newline at end of file
diff --git a/oUF_Reputation/oUF_Reputation.toc b/oUF_Reputation/oUF_Reputation.toc
deleted file mode 100644
index dcf2695..0000000
--- a/oUF_Reputation/oUF_Reputation.toc
+++ /dev/null
@@ -1,8 +0,0 @@
-## Interface: 30200
-## Author: p3lim
-## Version: 30200.wowi:revision
-## Title: oUF Reputation
-## Notes: Reputation Bar support for oUF layouts.
-## RequiredDeps: oUF
-
-oUF_Reputation.lua
\ No newline at end of file