diff ICU.lua @ 15:21cefa363c73 tip

Last modification to ready checking broke something ... Now its fixed and ready checking is working as intended.
author Xiiph
date Fri, 25 Feb 2011 01:21:13 +0100
parents ed15bd476bbb
children
line wrap: on
line diff
--- a/ICU.lua	Tue Feb 22 00:00:24 2011 +0100
+++ b/ICU.lua	Fri Feb 25 01:21:13 2011 +0100
@@ -580,13 +580,21 @@
 	local raider = UnitName(unit);
 
 	--@debug@
-	print(unit);
+	print("Thingy:",unit,responders[#responders],responders[#responders-1]);
 	--@end-debug@
-	
-	-- Check if the latest entires contain the raider... 
+
+	-- Iterate through all responders to avoid duplicates, abort on match
 	-- The event fires twice for units in your party, 
 	-- and may fire a THIRD time if you have the person targetted ...
-	if (responders[#responders] == raider or responders[#responders-1] == raider) then return end
+	for i = 1,#responders do
+		if responders[i] == raider then
+			--@debug@
+			print("Found match, aborting");
+			print(responders[i],raider);
+			--@end-debug@
+			return true;
+		end
+	end
 	
 	-- Raider is NOT afk, but might not be ready
 	responders[#responders+1] = raider;
@@ -616,8 +624,6 @@
 			--@end-debug@
 					
 			for i = 1, #responders do
-				print("Iterating through responders ...");
-				print(responders[i],raider);
 				if responders[i] == raider then
 					--@debug@
 					print(responders[i],raider);