changeset 135:a529a4a4ccbe

I removed the persistent queue (Ticket 33) It caused to many bugs and was blocking me from getting other things done. I think its something that will get implemented again once I figure out the best way to do it.
author Asa Ayers <Asa.Ayers@Gmail.com>
date Sat, 02 Oct 2010 11:38:22 -0700
parents 5eefa40e2a29 (current diff) 7f81764aa03a (diff)
children d3d5e82043d8
files CHANGELOG.txt Core.lua Modules/Crafting.lua
diffstat 4 files changed, 11 insertions(+), 149 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG.txt	Wed Sep 15 21:34:57 2010 -0700
+++ b/CHANGELOG.txt	Sat Oct 02 11:38:22 2010 -0700
@@ -1,3 +1,7 @@
+2010-10-02  Asa Ayers  <Asa.Ayers@Gmail.com>
+
+- I removed the persistent queue (Ticket 33) It caused to many bugs and was blocking me from getting other things done. I think its something that will get implemented again once I figure out the best way to do it.
+
 2010-09-15  Asa Ayers  <Asa.Ayers@Gmail.com>
 
 - Ticket 41 - Fixed a bug that occured if you created items without ever opening /ia crafting.
--- a/Core.lua	Wed Sep 15 21:34:57 2010 -0700
+++ b/Core.lua	Sat Oct 02 11:38:22 2010 -0700
@@ -68,7 +68,6 @@
 		items = {},
 		outbound_cod = {},
 		mailbox = {},
-		queue = {},
 		enabled_guilds = {},
 	},
 }
--- a/Modules/Crafting.lua	Wed Sep 15 21:34:57 2010 -0700
+++ b/Modules/Crafting.lua	Sat Oct 02 11:38:22 2010 -0700
@@ -11,7 +11,6 @@
 
 local realData = {}
 local nameMap = nil
-local shoppingList = nil
 
 local vellumLevelMap = {
 	[38682] = 37602, -- Armor Vellum => Armor Vellum II
@@ -21,12 +20,6 @@
 }
 
 function Crafting:OnInitialize()
-	local allQueues = ItemAuditor.db.factionrealm.queue
-	if not allQueues[UnitName("player")] then
-		allQueues[UnitName("player")] = {}
-	end
-	realData = allQueues[UnitName("player")]
-
 	self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
 end
 
@@ -234,31 +227,11 @@
 		craftingTable:RegisterEvents({
 			["OnEnter"] = function (rowFrame, cellFrame, data, cols, row, realrow, column, scrollingTable, ...)
 				if realrow then
-					if column == 1 then
-						local data = realData[realrow]
-
-						GameTooltip:SetOwner(rowFrame, "ANCHOR_CURSOR")
-						GameTooltip:SetHyperlink(data.link)
-						GameTooltip:Show()
-					elseif column == 2 then
-						local data = realData[realrow]
-						GameTooltip:SetOwner(rowFrame, "ANCHOR_CURSOR")
-						GameTooltip:SetText(format('Create %sx%s', data.link, data.queue))
-						for i, reagent in pairs(data.reagents) do
-							GameTooltip:AddDoubleLine("\124cffffffff"..reagent.link, format("\124cffffffff%s/%s", reagent.count-reagent.need, reagent.count))
---[[
-							reagents[reagentId] = {
-								link = reagentLink,
-								itemID = vellumID,
-								name = reagentName,
-								count = 1,
-								price = self:GetReagentCost(reagentLink, 1),
-								need = 0, -- This will get populated after the decisions have been made. it can't
-								-- be done before that because highest profit items get priority on materials.
-							}]]
-						end
-						GameTooltip:Show()
-					end
+					local data = realData[realrow]
+					
+					GameTooltip:SetOwner(rowFrame, "ANCHOR_CURSOR")
+					GameTooltip:SetHyperlink(data.link)
+					GameTooltip:Show()
 				end
 			end,
 			["OnLeave"] = function (rowFrame, cellFrame, data, cols, row, realrow, column, scrollingTable, ...)
@@ -487,17 +460,7 @@
 
 Crafting.RegisterCraftingDecider('Is Profitable', isProfitable, isProfitableOptions)
 
-function Crafting.ClearProfession(tradeskillName)
-	-- This will initialize nameMap if it isn't already.
-	getQueueLocation('')
 
-	for key = #(realData), 1, -1 do
-		if realData[key].tradeskillName == tradeskillName then
-			nameMap[realData[key].tradeskillName] = nil
-			tremove(realData, key)
-		end
-	end
-end
 
 local tableData = {}
 function ItemAuditor:UpdateCraftingTable()
@@ -512,27 +475,24 @@
 		return
 	end
 	local tradeskillName = GetTradeSkillLine()
-	Crafting.ClearProfession(tradeskillName)
-	shoppingList = nil
 
 	wipe(tableData)
 
 	local profitableItems = {}
 	local profitableIndex = 1
 	local numChecked = 0
-	local row = #(realData)+1
 	local numTradeSkills = GetNumTradeSkills()
 	if tradeskillName == 'UNKNOWN' then
 		numTradeSkills  = 0
 	end
 
+	local row = 1
+	
 	for i = 1, numTradeSkills do
 		local itemLink = GetTradeSkillItemLink(i)
 		local itemId = Utils.GetItemID(itemLink)
 		local vellumID = nil
 
-		local spellName = itemName
-
 		--Figure out if its an enchant or not
 		_, _, _, _, altVerb = GetTradeSkillInfo(i)
 		if LSW.scrollData[itemId] ~= nil and altVerb == 'Enchant' then
@@ -655,73 +615,6 @@
 	end
 end
 
-
-local numOwned = {}
-
-local function BuildShoppingList(character, queue)
-	for key, data in pairs(queue) do
-		if data.queue > 0 then
-			for id, reagent in pairs(data.reagents) do
-				if not numOwned[reagent.link] then
-					numOwned[reagent.link] = ItemAuditor:GetItemCount(Utils.GetItemID(reagent.link))
-				end
-				numOwned[reagent.link] = numOwned[reagent.link] - reagent.count
-
-				shoppingList[reagent.itemID] = shoppingList[reagent.itemID] or {
-					total = 0,
-					need = 0,
-					characters = {}
-				}
-				local slItem = shoppingList[reagent.itemID]
-
-
-				if numOwned[reagent.link] < 0 and not vellumLevelMap[reagent.itemID] then
-					reagent.need = min(reagent.count, abs(numOwned[reagent.link]))
-				elseif numOwned[reagent.link] >= 0 then
-					reagent.need = 0
-				end
-				shoppingList[reagent.itemID].total = shoppingList[reagent.itemID].total + reagent.count
-				shoppingList[reagent.itemID].need = shoppingList[reagent.itemID].need + reagent.need
-
-				slItem.characters[UnitName("player")] = slItem.characters[UnitName("player")] or {}
-				slItem.characters[UnitName("player")][data.recipeLink] = {
-					count = reagent.count,
-					need = reagent.need,
-				}
-			end
-		end
-	end
-end
-
-function Crafting.GetShoppingList(itemID)
-	if not shoppingList then
-		shoppingList = {}
-		wipe(numOwned)
-
-		-- This is done here instead of in the loop to make sure the current
-		-- character gets the first pick of materials.
-		local me = UnitName("player")
-		BuildShoppingList(me, realData)
-
-		for alt, queue in pairs(ItemAuditor.db.factionrealm.queue) do
-			if alt ~= me then
-				BuildShoppingList(alt, queue)
-			end
-		end
-	elseif shoppingList[itemID] then
-		local data = shoppingList[itemID]
-		if data.need ~= max(0, data.total - ItemAuditor:GetItemCount(itemID)) then
-			shoppingList = nil
-			-- I'm rebuilding the list instead of just the item because
-			-- it will be eaiser than tracking down the queued recipes that
-			-- need to change. If this becomes a problem, I may change it.
-			return Crafting.GetShoppingList(itemID)
-		end
-	end
-
-	return shoppingList[itemID]
-end
-
 function ItemAuditor:RefreshCraftingTable()
 	-- If the crafting table hasn't been created/displayed, there is no
 	-- reason to try to update it.
--- a/Modules/Tooltip.lua	Wed Sep 15 21:34:57 2010 -0700
+++ b/Modules/Tooltip.lua	Sat Oct 02 11:38:22 2010 -0700
@@ -1,16 +1,10 @@
 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?")
@@ -47,34 +41,6 @@
 			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()