view CraftingAddons/Cauldron.lua @ 76:958aba5f3297

Moved the group functions to the item data class. Added a new subgroup under the general config group called ?extra? which will provide features such as database character removal and perhaps guild selecting. Added a new custom .Print function to the addon object which takes two parameters: (string)text, (Color)color. The latter can be retrieved from the addon.Colors var (e.g. addon.Colors.Red). The ItemId parameter of the ItemData class constructor is now optional.
author Zerotorescue
date Sat, 25 Dec 2010 22:07:07 +0100
parents 2127ab01ed4a
children
line wrap: on
line source
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();
		
		-- update the shopping list
		Cauldron:UpdateShoppingListFromQueue();
		
		Cauldron:UpdateButtons();
		
		return;
	end
	
	local function IsEnabled()
		return (Cauldron and CauldronQueue and CauldronQueue.AddItem);
	end
	
	local function OnSelect()
		local addonName = "|r|cfffed000Cauldron|r|cffff6600";
		
		print("|cffff6600" .. addonName .. " has not yet been tested. Please report any of your experiences.|r");
	end
	
	IMRegisterCraftingAddon("Cauldron", Queue, IsEnabled, OnSelect);
	
end