From 9d973d45d5ee45287454e4d50db1492bf5183bdc Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Tue, 16 Mar 2010 21:10:56 -0400 Subject: [PATCH] In MainPanel.scroll_frame:Update(): Simplified the reputation code. --- Frame.lua | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/Frame.lua b/Frame.lua index f88e7ef..3d7e21f 100644 --- a/Frame.lua +++ b/Frame.lua @@ -2165,26 +2165,24 @@ do if recipe_entry.is_visible and recipe_entry.is_relevant then -- Determine if the player has an appropiate level in any applicable faction -- to learn the recipe. - local acquire_data = recipe_entry.acquire_data + local rep_data = recipe_entry.acquire_data[A.REPUTATION] local has_faction = true - for acquire_type, acquire_info in pairs(acquire_data) do - if acquire_type == A.REPUTATION then - for rep_id, rep_info in pairs(acquire_info) do - for rep_level in pairs(rep_info) do - if rep_id == FAC.HONOR_HOLD or rep_id == FAC.THRALLMAR then - rep_id = is_alliance and FAC.HONOR_HOLD or FAC.THRALLMAR - elseif rep_id == FAC.MAGHAR or rep_id == FAC.KURENAI then - rep_id = is_alliance and FAC.KURENAI or FAC.MAGHAR - end - local rep_name = private.reputation_list[rep_id].name - - if not player_rep[rep_name] or player_rep[rep_name] < rep_level then - has_faction = false - else - has_faction = true - break - end + if rep_data then + for rep_id, rep_info in pairs(rep_data) do + for rep_level in pairs(rep_info) do + if rep_id == FAC.HONOR_HOLD or rep_id == FAC.THRALLMAR then + rep_id = is_alliance and FAC.HONOR_HOLD or FAC.THRALLMAR + elseif rep_id == FAC.MAGHAR or rep_id == FAC.KURENAI then + rep_id = is_alliance and FAC.KURENAI or FAC.MAGHAR + end + local rep_name = private.reputation_list[rep_id].name + + if not player_rep[rep_name] or player_rep[rep_name] < rep_level then + has_faction = false + else + has_faction = true + break end end end @@ -2227,7 +2225,6 @@ do t.recipe_id = recipe_index t.is_header = true --- if expand_acquires and recipe_entry.acquire_data then if expand_acquires then -- we have acquire information for this. push the title entry into the strings -- and start processing the acquires -- 1.7.9.5