Quantcast

Modified addon:AddRecipeAcquire(), GenericAddRecipeAcquire(), and addon:AddRecipeRepVendor() to insert the spell IDs in the appropriate section of private.location_list

James D. Callahan III [03-21-10 - 06:44]
Modified addon:AddRecipeAcquire(), GenericAddRecipeAcquire(), and addon:AddRecipeRepVendor() to insert the spell IDs in the appropriate section of private.location_list
Filename
ARL.lua
Datamine.lua
diff --git a/ARL.lua b/ARL.lua
index b8613ca..410805f 100644
--- a/ARL.lua
+++ b/ARL.lua
@@ -921,13 +921,7 @@ end
 -- @param ... A listing of acquire methods.  See [[API/database-documentation]] for a listing of acquire methods and how they work
 -- @return None, array is passed as a reference.
 do
-	-- Tables for getting the locations
-	local location_list = {}
-	local location_checklist = {}
-
-	local function LocationSort(a, b)
-		return a < b
-	end
+	local location_list = private.location_list

 	function addon:AddRecipeAcquire(spell_id, ...)
 		local numvars = select('#', ...)	-- Find out how many flags we're adding
@@ -935,9 +929,6 @@ do
 		local recipe_list = private.recipe_list
 		local acquire_data = recipe_list[spell_id].acquire_data

-		twipe(location_list)
-		twipe(location_checklist)
-
 		while i <= numvars do
 			local location
 			local acquire_type, acquire_id = select(i, ...)
@@ -1057,13 +1048,11 @@ do
 				end	-- acquire_id
 			end	-- acquire_type

-			if location and not location_checklist[location] then
-				tinsert(location_list, location)
-				location_checklist[location] = true
+			if location then
+				location_list[location] = location_list[location] or {}
+				location_list[location][spell_id] = true
 			end
 		end	-- while
-		table.sort(location_list, LocationSort)
-		recipe_list[spell_id].locations = (#location_list == 0 and "" or tconcat(location_list, ", "))
 	end

 	local function GenericAddRecipeAcquire(spell_id, acquire_type, type_string, unit_list, ...)
@@ -1076,9 +1065,6 @@ do

 		local acquire = acquire_data[acquire_type]

-		twipe(location_list)
-		twipe(location_checklist)
-
 		while cur_var <= num_vars do
 			local location
 			local id_num = select(cur_var, ...)
@@ -1098,16 +1084,11 @@ do
 				unit.item_list[spell_id] = true
 			end

-			if location and not location_checklist[location] then
-				tinsert(location_list, location)
-				location_checklist[location] = true
+			if location then
+				location_list[location] = location_list[location] or {}
+				location_list[location][spell_id] = true
 			end
 		end
-		local locations = recipe.locations
-		locations = locations or ""
-
-		table.sort(location_list, LocationSort)
-		locations = locations .. (#location_list == 0 and "" or tconcat(location_list, ", "))
 	end

 	function addon:AddRecipeMobDrop(spell_id, ...)
@@ -1139,9 +1120,6 @@ do
 		local faction = acquire[faction_id]
 		faction[rep_level] = faction[rep_level] or {}

-		twipe(location_list)
-		twipe(location_checklist)
-
 		while cur_var <= num_vars do
 			local location
 			local vendor_id = select(cur_var, ...)
@@ -1171,16 +1149,11 @@ do
 				end
 			end

-			if location and not location_checklist[location] then
-				tinsert(location_list, location)
-				location_checklist[location] = true
+			if location then
+				location_list[location] = location_list[location] or {}
+				location_list[location][spell_id] = true
 			end
 		end
-		local locations = recipe.locations
-		locations = locations or ""
-
-		table.sort(location_list, LocationSort)
-		locations = locations .. (#location_list == 0 and "" or tconcat(location_list, ", "))
 	end
 end	-- do block

diff --git a/Datamine.lua b/Datamine.lua
index bfb6762..723c523 100644
--- a/Datamine.lua
+++ b/Datamine.lua
@@ -1678,7 +1678,7 @@ do
 					local item_link = GetMerchantItemLink(i)
 					local item_id = ItemLinkToID(item_link)
 					local spell_id = RECIPE_TO_SPELL_MAP[item_id]
-
+
 					if spell_id then
 						local ttscantext = addon:TooltipScanRecipe(spell_id, true, true)