changeset 75:2127ab01ed4a

Overriding toggle boxes should no longer give errors. Adding / removing items from config groups works again. Fixed full support for the Cauldron crafting addon. No longer trying to queue crafting items when no tradeskill window is open. This would cause errors.
author Zerotorescue
date Sat, 25 Dec 2010 15:33:40 +0100
parents 8d11fc88ecab
children 958aba5f3297
files Config.lua CraftingAddons/Cauldron.lua Queue.lua
diffstat 3 files changed, 29 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/Config.lua	Fri Dec 24 21:55:11 2010 +0100
+++ b/Config.lua	Sat Dec 25 15:33:40 2010 +0100
@@ -24,7 +24,7 @@
 			
 			local inheritedValue = addon:GetOptionByKey(groupName, info.arg);
 			
-			addon.db.profile.groups[groupName][info.arg] = (type(inheritedValue) ~= "table" and inheritedValue) or CopyTable(inheritedValue); -- copying defaults by reference would let one (unintendedly) change the defaults
+			addon.db.profile.groups[groupName][info.arg] = (type(inheritedValue) == "table" and CopyTable(inheritedValue)) or inheritedValue; -- copying defaults by reference would let one (unintendedly) change the defaults
 		end
 	end
 	
@@ -95,14 +95,14 @@
 	get = function(info)
 		return tostring(info[#info]); -- Ace is going to be anal about this if it's a numeric value, so we transmute it into a string here then back to a number on the other side
 	end,
-	set = function(groupId, itemId)
+	set = function(groupId, itemData)
     	-- This is NOT a real "set", we pass the widget reference to this function which contains similar, but not the same, info.
     	
-    	if itemId then
+    	if itemData and itemData.id then
 	    	local groupName = groupIdToName[groupId];
 	    	
-	    	if not mod:AddItemToGroup(groupName, itemId) then
-	    		print("|cffff0000Couldn't add the item with itemId (" .. itemId .. ") because it is already in a group.|r");
+	    	if not mod:AddItemToGroup(groupName, itemData.id) then
+	    		print("|cffff0000Couldn't add the item with itemId (" .. itemData.id .. ") because it is already in a group.|r");
 	    	end
     	end
 	end,
@@ -120,13 +120,13 @@
 	get = function(info)
 		return tostring(info[#info]); -- Ace is going to be anal about this if it's a numeric value, so we transmute it into a string here then back to a number on the other side
 	end,
-	set = function(groupId, itemId)
+	set = function(groupId, itemData)
     	-- This is NOT a real "set", we pass the widget reference to this function which contains similar, but not the same, info.
     	
-    	if itemId then
+    	if itemData and itemData.id then
 	    	local groupName = groupIdToName[groupId];
 	    	
-	    	mod:RemoveItemFromGroup(groupName, itemId);
+	    	mod:RemoveItemFromGroup(groupName, itemData.id);
 			
 			-- Now rebuild the list
 			AceConfigRegistry:NotifyChange("InventoriumOptions");
--- a/CraftingAddons/Cauldron.lua	Fri Dec 24 21:55:11 2010 +0100
+++ b/CraftingAddons/Cauldron.lua	Sat Dec 25 15:33:40 2010 +0100
@@ -1,6 +1,17 @@
 do
 	
 	local function Queue(tradeSkillIndex, amount)
+		local tradeskillName, currentLevel, maxLevel = GetTradeSkillLine();
+		
+		local link = GetTradeSkillItemLink(tradeSkillIndex);
+		local itemName = link and link:match("%[([^%[%]]*)%]");
+		
+		if not itemName then
+			return;
+		end
+		
+		local skillInfo = Cauldron:GetSkillInfo(tradeskillName, itemName);
+	
 		CauldronQueue:AddItem(Cauldron.db.realm.userdata[Cauldron.vars.playername].queue, skillInfo, amount);
 			
 		Cauldron:UpdateQueue();
@@ -8,6 +19,8 @@
 		-- update the shopping list
 		Cauldron:UpdateShoppingListFromQueue();
 		
+		Cauldron:UpdateButtons();
+		
 		return;
 	end
 	
--- a/Queue.lua	Fri Dec 24 21:55:11 2010 +0100
+++ b/Queue.lua	Sat Dec 25 15:33:40 2010 +0100
@@ -43,10 +43,14 @@
 	
 	local temp = {};
 	
-	-- Go through all trade skills for the profession
-	for i = 1, GetNumTradeSkills() do
-		-- Process every single tradeskill
-		self:ProcessTradeSkill(i, groupName, temp);
+	local tradeskillName, currentLevel, maxLevel = GetTradeSkillLine();
+	
+	if tradeskillName ~= "UNKNOWN" then
+		-- Go through all trade skills for the profession
+		for i = 1, GetNumTradeSkills() do
+			-- Process every single tradeskill
+			self:ProcessTradeSkill(i, groupName, temp);
+		end
 	end
 	
 	if addon.db.profile.groups[groupName].items then