Quantcast

Ackis Recipe List:

Ackis [10-27-08 - 19:24]
Ackis Recipe List:
- Fix typo in ARLFrame (fix ticket 148)
- Start location sorting stuff
- Dry-coded (Compiles with luac -p)
Filename
ARLDataminer.rb
ARLFrame.lua
AckisRecipeList.lua
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