diff Modules/QuickAuctions.lua @ 59:4ec321eb0dfe

Adding a crafing tab to the ItemAuditor window.
author Asa Ayers <Asa.Ayers@Gmail.com>
date Sun, 25 Jul 2010 15:51:13 -0700
parents 5273038322d7
children 70dc84df13b3
line wrap: on
line diff
--- a/Modules/QuickAuctions.lua	Sun Jul 25 15:51:00 2010 -0700
+++ b/Modules/QuickAuctions.lua	Sun Jul 25 15:51:13 2010 -0700
@@ -70,6 +70,32 @@
 	end
 end
 
+local function isProfitable(data)
+	if addon.IsQAEnabled() then
+		local QAGroup = QAAPI:GetItemGroup(data.link)
+		if QAGroup ~= nil then
+			local currentInvested, _, currentCount = addon:GetItemCost(data.link)
+			
+			local stackSize = QAAPI:GetGroupPostCap(QAGroup) * QAAPI:GetGroupPerAuction(QAGroup)
+			stackSize = stackSize / GetTradeSkillNumMade(data.tradeSkillIndex)
+			
+			-- bonus
+			stackSize = ceil(stackSize *1.25)
+			
+			local newThreshold = ((data.cost*stackSize) + currentInvested) / (currentCount + stackSize)
+			newThreshold = calculateQAThreshold(newThreshold)
+			
+			if  newThreshold < data.price then
+				return stackSize
+			end
+			
+			return -1
+		end
+	end
+	return 0
+end
+ItemAuditor:RegisterCraftingDecider('IA QuickAuctions', isProfitable)
+
 --[[
 	This is based on KTQ
 ]]