changeset 126:e8d3c299542c

Changed the Have Mats column to show the number of items you could create with the materials you have instead of just a y/n. The have mats filter simply checks that you can make at least 1.
author Asa Ayers <Asa.Ayers@Gmail.com>
date Thu, 02 Sep 2010 22:34:22 -0700
parents bb78b6c9892d
children 4f26dc55455d
files CHANGELOG.txt Modules/Crafting.lua
diffstat 2 files changed, 7 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG.txt	Thu Sep 02 22:25:03 2010 -0700
+++ b/CHANGELOG.txt	Thu Sep 02 22:34:22 2010 -0700
@@ -3,9 +3,9 @@
 - Updated the ArkInventory rule and tooltip to work in QA is compatible instead of if its enabled in ItemAuditor.
 - Moved the check for QAManager so it doesn't interfere with the tooltip or ArkInventory rule.
 - Update GetItemCost to return the total invested even if you have none of that item left. If you sell all of an item but are waiting for the mail to arrive, you can still see how much you have invested even though you don't actually own any more of that item.
-- Fixed the Have Mats column to consider the number queued. Previously it was only telling if you had materials to make one of the item.
 - Changed Total Profit to Profit Each to match the rest of the interface. Cost and Estimated Sale are both Each.
 - When using the process button for Enchanting, ItemAuditor will check which vellum is used and will use the vellum from your inventory. If the correct vellum is not found, it will upgrade to the next level (use vellum II instead of vellum I). This also means that you have to press process for each scroll to be created.
+- Changed the Have Mats column to show the number of items you could create with the materials you have instead of just a y/n. The have mats filter simply checks that you can make at least 1.
 
 2010-09-01  Asa Ayers  <Asa.Ayers@Gmail.com>
 
--- a/Modules/Crafting.lua	Thu Sep 02 22:25:03 2010 -0700
+++ b/Modules/Crafting.lua	Thu Sep 02 22:34:22 2010 -0700
@@ -157,7 +157,7 @@
 	end
 
 	-- column 5 is how many should be crafted
-	if Crafting.filter_have_mats and row[6] == 'n' then
+	if Crafting.filter_have_mats and row[6] == 0 then
 		return false
 	end
 	if strfind(row[4], 'VETO: .*') or row[5] == 0 then
@@ -537,23 +537,25 @@
 	local numOwned = {}
 
 	for key, data in pairs(realData) do
-		data.haveMaterials = true
+		data.haveMaterials = data.queue
 		for id, reagent in pairs(data.reagents) do
+			local needEach = reagent.count
 			reagent.count = reagent.count * data.queue
 
 			if not numOwned[reagent.link] then
 				numOwned[reagent.link] = ItemAuditor:GetItemCount(ItemAuditor:GetIDFromLink(reagent.link))
 			end
+			data.haveMaterials = min(data.haveMaterials, floor(numOwned[reagent.link] / needEach))
 			numOwned[reagent.link] = numOwned[reagent.link] - reagent.count
 
 			-- Vellums count in cost, but not against whether or not you have the mats.
 			-- I chose to do it this way because you can use a higher level of vellum
 			-- and I'm not sure the best way to determine cost and materials in that situation.
 			if numOwned[reagent.link] < 0 and not vellumLevelMap[reagent.itemID] then
-				data.haveMaterials = false
 				reagent.need = min(reagent.count, abs(numOwned[reagent.link]))
 			end
 		end
+		data.haveMaterials = max(0, data.haveMaterials)
 	end
 
 	if craftingTable then
@@ -563,19 +565,14 @@
 end
 
 function ItemAuditor:RefreshCraftingTable()
-	local displayMaterials
 	for key, data in pairs(realData) do
-		displayMaterials = 'n'
-		if data.haveMaterials then
-			displayMaterials = 'y'
-		end
 		tableData[key] = {
 			data.name,
 			data.cost,
 			data.price,
 			data.winner,
 			abs(data.queue),
-			displayMaterials,
+			data.haveMaterials,
 			data.profit,
 		}
 	end