diff Queue.lua @ 61:d903b0a151d3

Command handler function is now private, no need to keep it global when you can use the global SlashCmdList["INVENTORIUM"](msg) instead. Added database updating mechanism. All database vars are now stored in profiles rather than global. Now refreshing options when a different profile is selected. Fixed an issue with minimum local and global stock values not being inherited from the defaults.
author Zerotorescue
date Wed, 22 Dec 2010 15:04:09 +0100
parents 58fb38f0b447
children fee06221176f
line wrap: on
line diff
--- a/Queue.lua	Tue Dec 21 14:29:52 2010 +0100
+++ b/Queue.lua	Wed Dec 22 15:04:09 2010 +0100
@@ -23,8 +23,8 @@
 	local playerName = UnitName("player");
 	
 	-- Go through all groups
-	for groupName, values in pairs(addon.db.global.groups) do
-		local trackAt = (values.trackAtCharacters or (values.trackAtCharacters == nil and addon.db.global.defaults.trackAtCharacters));
+	for groupName, values in pairs(addon.db.profile.groups) do
+		local trackAt = (values.trackAtCharacters or (values.trackAtCharacters == nil and addon.db.profile.defaults.trackAtCharacters));
 		
 		if trackAt[playerName] then
 			self:QueueGroup(groupName);
@@ -33,7 +33,7 @@
 end
 
 function mod:QueueGroup(groupName)
-	if not addon.db.global.groups[groupName] then
+	if not addon.db.profile.groups[groupName] then
 		print(("Tried to queue items from a group named \"%s\", but no such group exists."):format(groupName));
 		return;
 	end
@@ -46,8 +46,8 @@
 		self:ProcessTradeSkill(i, groupName, temp);
 	end
 	
-	if addon.db.global.groups[groupName].items then
-		for itemId, _ in pairs(addon.db.global.groups[groupName].items) do
+	if addon.db.profile.groups[groupName].items then
+		for itemId, _ in pairs(addon.db.profile.groups[groupName].items) do
 			if not temp[itemId] then
 				local itemLink = select(2, GetItemInfo(itemId));
 				
@@ -70,7 +70,7 @@
 			itemId = addon.scrollIds[itemId]; -- change enchantIds into scrollIds
 		end
 		
-		if addon.db.global.groups[groupName].items[itemId] then
+		if addon.db.profile.groups[groupName].items[itemId] then
 			-- This item is in this group, queue it!
 			
 			if temp then