Quantcast

Ackis Recipe List:

Ackis [10-29-08 - 20:36]
Ackis Recipe List:
- Implement a basic sort by location function, this is to get that type of sorting out there and it's on the feature list to implement a tree view for locations.
- Will on sort from the first location (same as acquisition sorting based off of the first acquisition method), and locations are first sorted by name
- Dry-coded (Compiles with luac -p)
Filename
ARLConfig.lua
AckisRecipeList.lua
diff --git a/ARLConfig.lua b/ARLConfig.lua
index 2f6af71..117153d 100644
--- a/ARLConfig.lua
+++ b/ARLConfig.lua
@@ -1084,9 +1084,8 @@ local function fullOptions()
 							name	= L["Sorting"],
 							desc	= L["SORTING_DESC"],
 							get		= function() return addon.db.profile.sorting end,
-							-- This will probably cause people in multiple locals to have issues
 							set		= function(info,name) addon.db.profile.sorting = name end,
-							values	= function() return {Name = L["Name"], Skill = L["Skill"], Acquisition = L["Acquisition"]} end,
+							values	= function() return {Name = L["Name"], Skill = L["Skill"], Acquisition = L["Acquisition"], Location = L["Location"]} end,
 						},
 					},
 				},
diff --git a/AckisRecipeList.lua b/AckisRecipeList.lua
index 0327e30..afffbf7 100644
--- a/AckisRecipeList.lua
+++ b/AckisRecipeList.lua
@@ -1444,6 +1444,10 @@ do

 			end

+			-- Sort the list by the name
+			tsort(locationlist, function(a, b) return a < b end)
+
+			-- Return the list as a string
 			return tconcat(locationlist,",")

 		else
@@ -1810,6 +1814,8 @@ do

 			sortFuncs[L["Location"]] = function (a, b)

+				return (string.match(RecipeDB[a]["Locations"],"(%w+),") < string.match(RecipeDB[b]["Locations"],"(%w+),"))
+
 			end

 		end