Quantcast

Modified addon:ScanTrainerData() to work with the new acquire_data system.

James D. Callahan III [03-18-10 - 03:42]
Modified addon:ScanTrainerData() to work with the new acquire_data system.
Filename
Datamine.lua
diff --git a/Datamine.lua b/Datamine.lua
index d919b0a..f3e87e8 100644
--- a/Datamine.lua
+++ b/Datamine.lua
@@ -1227,19 +1227,21 @@ do
 		local noteachflag = false

 		for i in pairs(recipe_list) do
-			local i_name = recipe_list[i].name
-			local acquire = recipe_list[i]["Acquire"]
-			local flags = recipe_list[i]["Flags"]
+			local recipe = recipe_list[i]
+			local i_name = recipe.name
+			local acquire = recipe["acquire_data"]
+			local flags = recipe["Flags"]
+
+			local train_data = acquire[A.TRAINER]

-			-- If the trainer teaches this recipe
 			if info[i_name] then
 				local found = false

-				-- Parse acquire info
-				for j in pairs(acquire) do
-					if acquire[j].type == private.acquire_types.TRAINER then
-						if acquire[j].ID == targetID then
+				if train_data then
+					for id_num in pairs(train_data) do
+						if id_num == targetID then
 							found = true
+							break
 						end
 					end
 				end
@@ -1256,10 +1258,11 @@ do
 			else
 				local found = false

-				for j in pairs(acquire) do
-					if acquire[j].type == private.acquire_types.TRAINER then
-						if acquire[j].ID == targetID then
+				if train_data then
+					for id_num in pairs(train_data) do
+						if id_num == targetID then
 							found = true
+							break
 						end
 					end
 				end