From 7a441bfaee9620b44f6d1d46860fd5f349d22b69 Mon Sep 17 00:00:00 2001 From: Ackis Date: Mon, 27 Oct 2008 19:24:24 +0000 Subject: [PATCH] Ackis Recipe List: - Fix typo in ARLFrame (fix ticket 148) - Start location sorting stuff - Dry-coded (Compiles with luac -p) --- ARLDataminer.rb | 4 ++-- ARLFrame.lua | 2 +- AckisRecipeList.lua | 65 ++++++++++++++++++++++++++++++++++++--------------- 3 files changed, 49 insertions(+), 22 deletions(-) diff --git a/ARLDataminer.rb b/ARLDataminer.rb index 7ca33dd..f96e6b6 100644 --- a/ARLDataminer.rb +++ b/ARLDataminer.rb @@ -237,6 +237,7 @@ EOF proflua.puts "\t-- #{name} -- #{details[:spellid]}" details[:method].split(",").each do |method| + case method # trainers @@ -503,6 +504,7 @@ EOF $quests[quest[:id]] = {:name => quest[:name]} if quest[:side] == 1 + flags << 1 << 2 $quests[quest[:id]][:faction] = 0 @@ -934,8 +936,6 @@ EOF sorted_keys.each do |k| v = list[k] - #list.each_pair do |k,v| - if count == 50 print "\n" diff --git a/ARLFrame.lua b/ARLFrame.lua index ce13df8..b214a5b 100644 --- a/ARLFrame.lua +++ b/ARLFrame.lua @@ -2308,7 +2308,7 @@ function addon.setFlyawayState() (armordb.mail == true) and (armordb.plate == true) and (armordb.cloak == true) and (armordb.necklace == true) and (armordb.ring == true) and (armordb.trinket == true) and - (armoddb.shield == true)) then + (armordb.shield == true)) then ARL_ArmorAllCB:SetChecked(true) else ARL_ArmorAllCB:SetChecked(false) diff --git a/AckisRecipeList.lua b/AckisRecipeList.lua index a96379b..c075388 100644 --- a/AckisRecipeList.lua +++ b/AckisRecipeList.lua @@ -1637,41 +1637,68 @@ end ]]-- --- Description: Sorts the recipe Database depending on the settings defined in the database. --- Expected result: A sorted array indexing values in the RecipeDB is returned. --- Input: The Recipe Database --- Output: A pointer to an array containing sorted values +do + + -- Sorting functions + + local sortFuncs = {} -function addon:SortMissingRecipes(RecipeDB) + sortfunc[L['Skill']] = function(a, b) - -- Create a new array for the sorted index - local SortedRecipeIndex = {} + return RecipeDB[a]["Level"] < RecipeDB[b]["Level"] - -- Find out how he want to sort - local sorttype = addon.db.profile.sorting + end - -- Get all the indexes of the RecipeListing - for n, v in pairs(RecipeDB) do + sortfunc[L['Name']] = function(a, b) - tinsert(SortedRecipeIndex, n) + return RecipeDB[a]["Name"] < RecipeDB[b]["Name"] end - if (sorttype == L["Skill"]) then + sortfunc[L['Acquisition']] = function (a, b) - tsort(SortedRecipeIndex, function(a,b) return RecipeDB[a]["Level"] < RecipeDB[b]["Level"] end) + local reca = RecipeDB[a]["Acquire"][1] + local recb = RecipeDB[b]["Acquire"][1] - elseif (sorttype == L["Name"]) then + if (reca) and (recb) then - tsort(SortedRecipeIndex, function(a,b) return RecipeDB[a]["Name"] < RecipeDB[b]["Name"] end) + return reca["Type"] < recb["Type"] - elseif (sorttype == L["Acquisition"]) then + else - tsort(SortedRecipeIndex, function(a,b) return RecipeDB[a]["Acquire"][1]["Type"] < RecipeDB[b]["Acquire"][1]["Type"] end) + return not not reca + + end end - return SortedRecipeIndex + sortfunc[L["Location"]] = function (a, b) + + end + + + -- Description: Sorts the recipe Database depending on the settings defined in the database. + -- Expected result: A sorted array indexing values in the RecipeDB is returned. + -- Input: The Recipe Database + -- Output: A pointer to an array containing sorted values + + function addon:SortMissingRecipes(RecipeDB) + + -- Create a new array for the sorted index + local SortedRecipeIndex = {} + + -- Get all the indexes of the RecipeListing + for n, v in pairs(RecipeDB) do + + tinsert(SortedRecipeIndex, n) + + end + + tsort(SortedRecipeIndex, sortFuncs[addon.db.profile.sorting]) + + return SortedRecipeIndex + + end end -- 1.7.9.5