From c9fd909cdfed0e29c0cadd2b81c422bbd98e9f4f Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Fri, 2 Apr 2010 02:24:23 -0400 Subject: [PATCH] In SearchRecipes(): Only search if the recipe's profession is the same as the currently opened window. If a result is found, do not sure further. --- Frame.lua | 62 +++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 26 deletions(-) diff --git a/Frame.lua b/Frame.lua index e0e82d2..d44d2b5 100644 --- a/Frame.lua +++ b/Frame.lua @@ -1342,45 +1342,55 @@ do for index, entry in pairs(private.recipe_list) do entry:RemoveState("RELEVANT") - for location_name in pairs(location_list) do - local breakout = false + if entry.profession == Player.current_prof then + local found = false - for spell_id in pairs(location_list[location_name].recipes) do - if spell_id == entry.spell_id then - local str = location_name:lower() + for field in pairs(search_params) do + local str = entry[field] and tostring(entry[field]):lower() or nil - if str and str:find(pattern) then + if str and str:find(pattern) then + entry:AddState("RELEVANT") + found = true + break + end + end + + if not found then + for acquire_type in pairs(acquire_names) do + local str = acquire_names[acquire_type]:lower() + + if str and str:find(pattern) and entry.acquire_data[acquire_type] then entry:AddState("RELEVANT") - breakout = true + found = true break end end end - if breakout then - break - end - end + if not found then + for location_name in pairs(location_list) do + local breakout = false - for acquire_type in pairs(acquire_names) do - local str = acquire_names[acquire_type]:lower() - - if str and str:find(pattern) and entry.acquire_data[acquire_type] then - entry:AddState("RELEVANT") - break - end - end + for spell_id in pairs(location_list[location_name].recipes) do + if spell_id == entry.spell_id then + local str = location_name:lower() - for field in pairs(search_params) do - local str = entry[field] and tostring(entry[field]):lower() or nil + if str and str:find(pattern) then + entry:AddState("RELEVANT") + breakout = true + break + end + end + end - if str and str:find(pattern) then - entry:AddState("RELEVANT") - break + if breakout then + break + end + end end end - end - end + end -- if entry.profession + end -- for end -- do local ARL_SearchButton = GenericCreateButton("ARL_SearchButton", MainPanel, 25, 74, "GameFontDisableSmall", "GameFontHighlightSmall", _G.SEARCH, "CENTER", -- 1.7.9.5