Quantcast

Vendor scans which find no recipe that matches the recipe item will attempt to find the correct recipe based on name and set the recipe item id on the recipe.

James D. Callahan III [03-13-11 - 08:37]
Vendor scans which find no recipe that matches the recipe item will attempt to find the correct recipe based on name and set the recipe item id on the recipe.
Filename
Scanner.lua
diff --git a/Scanner.lua b/Scanner.lua
index 3c20401..7ad556c 100644
--- a/Scanner.lua
+++ b/Scanner.lua
@@ -1096,7 +1096,8 @@ do
 				local match_text = string.match(item_name, "%a+: ")

 				if match_text and RECIPE_TYPES[match_text:lower()] then
-					local spell_id = RECIPE_ITEM_TO_SPELL_MAP[ItemLinkToID(_G.GetMerchantItemLink(index))]
+					local item_id = ItemLinkToID(_G.GetMerchantItemLink(index))
+					local spell_id = RECIPE_ITEM_TO_SPELL_MAP[item_id]

 					if spell_id then
 						local scanned_text = addon:TooltipScanRecipe(spell_id, true, true)
@@ -1169,9 +1170,16 @@ do
 							end
 						end
 					else
+						for spell_id, recipe in pairs(private.recipe_list) do
+							local recipe_type, match_text = (":"):split(item_name, 2)
+
+							if recipe.name == match_text:trim() then
+								recipe:SetRecipeItemID(item_id)
+							end
+						end
 						--@debug@
 						added_output = true
-						table.insert(output, ("Spell ID not found for: %s"):format(item_name))
+						table.insert(output, ("Spell ID not found for recipe item %d (%s)"):format(item_id, item_name))
 						--@end-debug@
 					end
 				end