Some adjustments

Wobin [05-31-14 - 06:03]
Some adjustments
Filename
Libs/LibSort/LibSort-1.0.lua
Libs/LibSort/README.md
MrPlow.lua
diff --git a/Libs/LibSort/LibSort-1.0.lua b/Libs/LibSort/LibSort-1.0.lua
index 8fdf028..098b3c4 100644
--- a/Libs/LibSort/LibSort-1.0.lua
+++ b/Libs/LibSort/LibSort-1.0.lua
@@ -163,6 +163,13 @@ EVENT_MANAGER:RegisterForEvent("LibSortLoaded", EVENT_ADD_ON_LOADED, function(..
 --------- API ---------

 function LibSort:Unregister(addonName, name)
+	if not name then
+		self.RegisteredCallbacks[addonName] = nil
+		self.DefaultOrdersHigh[addonName] = nil
+		self.DefaultOrdersLow[addonName] = nil
+		return
+	end
+
 	if self.RegisteredCallbacks[addonName] then
 		self.RegisteredCallbacks[addonName][name] = nil
 	end
diff --git a/Libs/LibSort/README.md b/Libs/LibSort/README.md
index 06d8d3d..f1fb4ef 100644
--- a/Libs/LibSort/README.md
+++ b/Libs/LibSort/README.md
@@ -104,20 +104,29 @@ This will unregister a sortKey registration
     + Example: "ISWeaponSort"

 ###RegisterDefaultOrder
-Your addon may have multiple registrations, and this function will allow you to indicate what order you want them in as a block. There are two tables you can pass in, for low level and high level keys. Low level keys are values that are unique to certain types of items, like weaponType, and armourType. High level keys are those linked to values that are common across larger swathes of items, like item level, or name. If you separate your keys in the two tables, LibSort will first chain all the low level keys before all high level keys, so that multiple addons can apply sort orders without getting cut off. (It's highly recommended that you split keys if you use high level definitions)
+Your addon may have multiple registrations, and this function will allow you to indicate what order you want them in as a block. Call this function *after* you have completed your registrations

-Default behaviour, by not using this API call will be order of registration at a high level to avoid breaking other registrations
+There are two tables you can pass in, for *low level* and *high level* keys.
+
+- Low level keys are values that are unique to certain types of items, like weaponType, and armourType.
+- High level keys are those linked to values that are common across larger swathes of items, like item level, or name.
+
+
+If you separate your keys in the two tables, LibSort will first chain all the low level keys before all high level keys, so that multiple addons can apply sort orders without getting cut off. (It's highly recommended that you split keys if you use high level definitions)
+
+Default behaviour, by not using this API call will be order of registration at a high level to avoid breaking other registrations, and thus may not work as you expect, so make sure you set it.

     LibSort:RegisterDefaultOrder(addonName, keyTableLow, keyTableHigh)

 - *addonName* -The name of the registering addon
     + Example: "Item Sort"
 - *keyTableLow* - A table indicating the order of low level sortKeys for this addon
-    + Example: {"weaponType", "armorEquipType", "armorType", "subjectiveItemLevel"}
+    + Example: {"weaponType", "armorEquipType", "armorType"}
 - *keyTableHigh* - **Optional** A table indicating of the order of high level sortKeys for this addon
+    + Example: {"subjectiveItemLevel"}

 ###SetDebugging
-Set the debug flag for the library
+Set the debug flag for the library. Not actually used atm, but for future stuff.

     LibSort:SetDebugging(flag)

diff --git a/MrPlow.lua b/MrPlow.lua
index 3934636..be919d6 100644
--- a/MrPlow.lua
+++ b/MrPlow.lua
@@ -46,38 +46,41 @@ local ARMOUR_ORDER = {
 	[EQUIP_TYPE_COSTUME] = 14,
 }
 local ITEM_TYPE_ORDER = {
-	[ITEMTYPE_FOOD] = 						1,
-	[ITEMTYPE_DRINK] = 						2,
-	[ITEMTYPE_RECIPE] =  					3,
-	[ITEMTYPE_POTION] =  					4,
-	[ITEMTYPE_POISON] =   					5,
-	[ITEMTYPE_SCROLL] = 		  			6,
-	[ITEMTYPE_CONTAINER] = 		  			7,
-	[ITEMTYPE_AVA_REPAIR] =   				8,
-	[ITEMTYPE_BLACKSMITHING_BOOSTER] = 		9,
-	[ITEMTYPE_BLACKSMITHING_RAW_MATERIAL] = 10,
-	[ITEMTYPE_BLACKSMITHING_MATERIAL] = 	11,
-	[ITEMTYPE_CLOTHIER_BOOSTER] = 			12,
-	[ITEMTYPE_CLOTHIER_RAW_MATERIAL] = 		13,
-	[ITEMTYPE_CLOTHIER_MATERIAL] = 			14,
-	[ITEMTYPE_WOODWORKING_BOOSTER] = 		15,
-	[ITEMTYPE_WOODWORKING_RAW_MATERIAL] = 	16,
-	[ITEMTYPE_WOODWORKING_MATERIAL] = 		17,
-	[ITEMTYPE_ALCHEMY_BASE] = 				18,
-	[ITEMTYPE_REAGENT] = 					19,
-	[ITEMTYPE_ENCHANTING_RUNE] =   			20,
-	[ITEMTYPE_INGREDIENT] =   				21,
-	[ITEMTYPE_STYLE_MATERIAL] =   			22,
-	[ITEMTYPE_GLYPH_WEAPON] =   			23,
-	[ITEMTYPE_GLYPH_ARMOR] =   				24,
-	[ITEMTYPE_GLYPH_JEWELRY] =   			25,
-	[ITEMTYPE_SOUL_GEM] =   				26,
-	[ITEMTYPE_SIEGE] =   					27,
-	[ITEMTYPE_LURE] = 		  				28,
-	[ITEMTYPE_TRASH] = 	  					29,
-	[ITEMTYPE_TROPHY] =   					30,
-	[ITEMTYPE_ARMOR_TRAIT] =   				31,
-	[ITEMTYPE_WEAPON_TRAIT] =   			32,
+	[ITEMTYPE_WEAPON] = 					1,
+	[ITEMTYPE_ARMOR] = 						2,
+	[ITEMTYPE_FOOD] = 						3,
+	[ITEMTYPE_DRINK] = 						4,
+	[ITEMTYPE_RECIPE] =  					5,
+	[ITEMTYPE_POTION] =  					6,
+	[ITEMTYPE_POISON] =   					7,
+	[ITEMTYPE_SCROLL] = 		  			8,
+	[ITEMTYPE_CONTAINER] = 		  			9,
+	[ITEMTYPE_AVA_REPAIR] =   				10,
+	[ITEMTYPE_BLACKSMITHING_BOOSTER] = 		11,
+	[ITEMTYPE_BLACKSMITHING_RAW_MATERIAL] = 12,
+	[ITEMTYPE_BLACKSMITHING_MATERIAL] = 	13,
+	[ITEMTYPE_CLOTHIER_BOOSTER] = 			14,
+	[ITEMTYPE_CLOTHIER_RAW_MATERIAL] = 		15,
+	[ITEMTYPE_CLOTHIER_MATERIAL] = 			16,
+	[ITEMTYPE_WOODWORKING_BOOSTER] = 		17,
+	[ITEMTYPE_WOODWORKING_RAW_MATERIAL] = 	18,
+	[ITEMTYPE_WOODWORKING_MATERIAL] = 		19,
+	[ITEMTYPE_ALCHEMY_BASE] = 				20,
+	[ITEMTYPE_REAGENT] = 					21,
+	[ITEMTYPE_ENCHANTING_RUNE] =   			22,
+	[ITEMTYPE_INGREDIENT] =   				23,
+	[ITEMTYPE_STYLE_MATERIAL] =   			24,
+	[ITEMTYPE_GLYPH_WEAPON] =   			25,
+	[ITEMTYPE_GLYPH_ARMOR] =   				26,
+	[ITEMTYPE_GLYPH_JEWELRY] =   			27,
+	[ITEMTYPE_SOUL_GEM] =   				28,
+	[ITEMTYPE_SIEGE] =   					29,
+	[ITEMTYPE_LURE] = 		  				30,
+	[ITEMTYPE_TRASH] = 	  					31,
+	[ITEMTYPE_TROPHY] =   					32,
+	[ITEMTYPE_LOCKPICK] =					33,
+	[ITEMTYPE_ARMOR_TRAIT] =   				34,
+	[ITEMTYPE_WEAPON_TRAIT] =   			35,
 }

 function MrPlow:Loaded(...)
@@ -96,7 +99,7 @@ end

 function MrPlow:ItemType(slotType, bag, index)
 	if watchedSlots[slotType] then
-		return ITEM_TYPE_ORDER[GetItemType(bag, index)]
+		return ITEM_TYPE_ORDER[GetItemType(bag, index)] or 100
 	end
 end