From a14a396ec9377df5a2cee778aa289e29aae78760 Mon Sep 17 00:00:00 2001 From: torhal Date: Mon, 15 Jun 2009 22:27:01 +0000 Subject: [PATCH] Moved the actual scanning section of addon:ScanProfession() into ProfessionScan(). In addon:ScanProfession(): Added support for "all" as an argument, to scan all professions. In addon:ScanToolTip(): Added checks to prevent tradeskills such as "tailoring" from tagging an item/recipe as needing the "ring" flag. --- ARLDatamine.lua | 67 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 27 deletions(-) diff --git a/ARLDatamine.lua b/ARLDatamine.lua index 23a6bcb..ca8ce0e 100644 --- a/ARLDatamine.lua +++ b/ARLDatamine.lua @@ -1829,34 +1829,11 @@ do } local recipe_list = {} - --- Parses all recipes for a specified profession, scanning their tool tips. - -- @name AckisRecipeList:ScanProfession - -- @usage AckisRecipeList:ScanProfession("first aid") - -- @param prof_name The profession name or the spell ID of it, which you wish to scan. - -- @return Recipes in the given profession have their tooltips scanned. - function addon:ScanProfession(prof_name) - if (type(prof_name) == "number") then - prof_name = GetSpellInfo(prof_name) - end - - local found = false - prof_name = strlower(prof_name) - - for idx, name in ipairs(ORDERED_PROFESSIONS) do - if prof_name == name then - found = true - break - end - end - - if not found then - self:Print(L["DATAMINER_NODB_ERROR"]) - return - end + local function ProfessionScan(prof_name) local master_list = LoadRecipe() if not master_list then - self:Print(L["DATAMINER_NODB_ERROR"]) + addon:Print(L["DATAMINER_NODB_ERROR"]) return end twipe(recipe_list) @@ -1871,7 +1848,43 @@ do -- Parse the entire recipe database for i in pairs(recipe_list) do - self:TooltipScanRecipe(i) + addon:TooltipScanRecipe(i) + end + end + + --- Parses all recipes for a specified profession, scanning their tool tips. + -- @name AckisRecipeList:ScanProfession + -- @usage AckisRecipeList:ScanProfession("first aid") + -- @param prof_name The profession name or the spell ID of it, which you wish to scan. + -- @return Recipes in the given profession have their tooltips scanned. + function addon:ScanProfession(prof_name) + if (type(prof_name) == "number") then + prof_name = GetSpellInfo(prof_name) + end + + local found = false + prof_name = strlower(prof_name) + + local scan_all = prof_name == "all" + + if not scan_all then + for idx, name in ipairs(ORDERED_PROFESSIONS) do + if prof_name == name then + found = true + break + end + end + + if not found then + self:Print(L["DATAMINER_NODB_ERROR"]) + return + end + + ProfessionScan(prof_name) + else + for idx, name in ipairs(ORDERED_PROFESSIONS) do + ProfessionScan(name) + end end end @@ -2362,7 +2375,7 @@ do scan_data.Plate = true elseif (strmatch(text, "cloak")) then scan_data.Cloak = true - elseif (strmatch(text, "ring")) then + elseif (strmatch(text, "ring")) and strmatch(text, "ring:") == nil and strmatch(text, "requires") == nil then scan_data.Ring = true elseif (strmatch(text, "necklace")) then scan_data.Necklace = true -- 1.7.9.5