Quantcast

Add some throttling to the rep updates. Number pulled out of my ass is 10.

John Pasula [03-04-10 - 21:35]
Add some throttling to the rep updates. Number pulled out of my ass is 10.
Filename
ARL.lua
diff --git a/ARL.lua b/ARL.lua
index b7646d0..64324f1 100644
--- a/ARL.lua
+++ b/ARL.lua
@@ -745,9 +745,22 @@ function addon:MERCHANT_SHOW()
 	addon:ScanVendor()
 end

----Event used to update the internal faction database when your faction changes.
-function addon:UPDATE_FACTION()
-	Player:SetReputationLevels()
+do
+
+	-- We don't want to update the reputation with every kill, lets keep track of how many we've done
+	-- and only do it every 10th update.
+	local factionincrement = 0
+
+	---Event used to update the internal faction database when your faction changes.
+	function addon:UPDATE_FACTION()
+		-- Increment the faction counter
+		factionincrement = factionincrement + 1
+		-- Only update the rep levels on every 10th event firing.
+		if (factionincrement % 10) then
+			Player:SetReputationLevels()
+		end
+	end
+
 end

 do