diff Modules/Tooltip.lua @ 128:451d8a19edea

Ticket 33 - Implemented a persistent queue. This allows the crafting queue to be seen even if your tradeskills aren't open and allows you to mix all of your tradeskills into a single queue.
author Asa Ayers <Asa.Ayers@Gmail.com>
date Thu, 02 Sep 2010 23:59:09 -0700
parents 79dc87430cb3
children 7f81764aa03a
line wrap: on
line diff
--- a/Modules/Tooltip.lua	Thu Sep 02 23:29:17 2010 -0700
+++ b/Modules/Tooltip.lua	Thu Sep 02 23:59:09 2010 -0700
@@ -1,10 +1,16 @@
 local ItemAuditor = select(2, ...)
 local Tooltip = ItemAuditor:NewModule("Tooltip")
 
+local Crafting
+local Utils = ItemAuditor:GetModule("Utils")
+
 local function ShowTipWithPricing(tip, link, num)
 	if (link == nil) then
 		return;
 	end
+	if not Crafting then
+		Crafting = ItemAuditor:GetModule("Crafting")
+	end
 
 	-- local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, _, _, _, _, itemVendorPrice = GetItemInfo (link);
 	-- local _, _, Color, Ltype, Id, Enchant, Gem1, Gem2, Gem3, Gem4, Suffix, Unique, LinkLvl, Name = string.find(link, "|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?")
@@ -41,6 +47,34 @@
 			show = true
 		end
 	end
+
+	
+	shoppingList = Crafting.GetShoppingList(Utils.GetItemID(link))
+	if shoppingList then
+		tip:AddDoubleLine("\124cffffffffIA Queue", "\124cffffffffhave/total")
+		for character, recipes in pairs(shoppingList.characters) do
+			local count = 0
+			local need = 0
+			local color = '\124cff00ff00' -- green
+			for link, data in pairs(recipes) do
+				need = need + data.need
+				count = count + data.count
+			end
+			if need > 0 then
+				color = '\124cffff0000' -- red
+			end
+			tip:AddDoubleLine("\124cffffffff"..character, format("%s%s/%s", color, count-need, count))
+			if true then -- show details
+				for link, data in pairs(recipes) do
+					if data.need > 0 then
+						tip:AddDoubleLine("\124cffffffff"..link, format("\124cffffffff%s/%s", data.count-data.need, data.count))
+					end
+				end
+			end
+
+		end
+		show = true
+	end
 	
 	if show then 
 		tip:Show()