From 6599eda2f7e5bb31acf78f06ecde58ff880383f3 Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Wed, 7 Apr 2010 13:25:46 -0400 Subject: [PATCH] In addon:ScanTrainerData(): Re-factored some logic to eliminate duplicate code, and took a ginsu knife to some grammar. --- Scanner.lua | 55 ++++++++++++++++++------------------------------------- 1 file changed, 18 insertions(+), 37 deletions(-) diff --git a/Scanner.lua b/Scanner.lua index 6606c8c..7f37f61 100644 --- a/Scanner.lua +++ b/Scanner.lua @@ -1214,47 +1214,28 @@ do for i in pairs(recipe_list) do local recipe = recipe_list[i] local i_name = recipe.name - local acquire = recipe["acquire_data"] - - local train_data = acquire[A.TRAINER] - - if info[i_name] then - local found = false - - if train_data then - for id_num in pairs(train_data) do - if id_num == targetID then - found = true - break - end + local train_data = recipe.acquire_data[A.TRAINER] + local found = false + + if train_data then + for id_num in pairs(train_data) do + if id_num == targetID then + found = true + break end end + end - if not found then - tinsert(teach, i) - teachflag = true - - if not recipe:IsFlagged("common1", "TRAINER") then - tinsert(output, ": Trainer flag needs to be set.") - end - end - -- Trainer does not teach this recipe - else - local found = false - - if train_data then - for id_num in pairs(train_data) do - if id_num == targetID then - found = true - break - end - end - end + if info[i_name] and not found then + tinsert(teach, i) + teachflag = true - if found then - noteachflag = true - tinsert(noteach, i) + if not recipe:IsFlagged("common1", "TRAINER") then + tinsert(output, ": Trainer flag needs to be set.") end + elseif found then + noteachflag = true + tinsert(noteach, i) end end @@ -1276,7 +1257,7 @@ do end end tinsert(output, "Trainer Acquire Scan Complete.") - tinsert(output, "If you're doing an engineering scan, there may be some goggles listed as extra. These goggles ONLY show up for those classes who can make them, so they may be false positives.") + tinsert(output, "If this is an engineering scan, some goggles may be listed as extra. These goggles ONLY show up for the classes who can make them, so they may be false positives.") if teachflag or noteachflag then self:DisplayTextDump(nil, nil, tconcat(output, "\n")) -- 1.7.9.5