crafting order included mats value
Cr42yC4r1 opened this issue ยท 3 comments
in order to account for included mats in crafting orders I stuck this code snippet into Pricing/ProfitCalcualtion.lua function CraftSim.CALC:GetAverageProfit in my local version of the addon
if recipeData.orderData then
--DisplayTableInspectorWindow(recipeData.orderData)--need to load blizz debug tools first
--add in value of provided reagents
for i,reagentdata in ipairs(recipeData.orderData.reagents) do
local price=CraftSim.PRICEDATA:GetMinBuyoutByItemID(reagentdata.reagent.itemID, true, false)
comissionProfit = comissionProfit + (reagentdata.reagent.quantity * price)
end
end
it does what I want but there's probably a better place or maybe I'm using the price data call improperly.
like I'd prefer for this math to lower the cost instead of add to the commission (just on principle of it) but putting similar code in the pricedata object gave me goofy results and seemed to mess with the value of resourcefulness
I took a look at it independently and I would do it in the exact same way :)
Ill take your snippet, plug it in and test a bit!
recipeData might need an update somewhere in this call stack. it seems that optional reagents are not added to the crafting cost at first but this is adding them to the commission. I just did a crafting order that used an alchemical flavor pocket and it showed mega profit at first cause this added that included mat but opening price details fixed the profit to the expected numbers