Skip to content

Commit d94b1fa

Browse files
committed
hotfix
1 parent 62a0cc5 commit d94b1fa

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

Classes/RecipeData.lua

+14-9
Original file line numberDiff line numberDiff line change
@@ -507,16 +507,21 @@ function CraftSim.RecipeData:SetNonQualityReagentsMax()
507507
self.reagentData.requiredSelectableReagentSlot.possibleReagents or {}, function(optionalReagent)
508508
return not GUTIL:isItemSoulbound(optionalReagent.item:GetItemID())
509509
end)
510-
for _, optionalReagent in ipairs(possibleReagents) do
511-
local reagentPrice = CraftSim.PRICE_SOURCE:GetMinBuyoutByItemID(optionalReagent.item:GetItemID(),
512-
true, false, true)
513-
if not cheapestReagent then
514-
cheapestReagent = optionalReagent
515-
cheapestPrice = reagentPrice
516-
else
517-
if reagentPrice < cheapestPrice then
518-
cheapestPrice = reagentPrice
510+
-- if every possible reagent is soulbound, enforce first one
511+
if #possibleReagents == 0 then
512+
cheapestReagent = self.reagentData.requiredSelectableReagentSlot.possibleReagents[1]
513+
else -- else search for cheapest
514+
for _, optionalReagent in ipairs(possibleReagents) do
515+
local reagentPrice = CraftSim.PRICE_SOURCE:GetMinBuyoutByItemID(optionalReagent.item:GetItemID(),
516+
true, false, true)
517+
if not cheapestReagent then
519518
cheapestReagent = optionalReagent
519+
cheapestPrice = reagentPrice
520+
else
521+
if reagentPrice < cheapestPrice then
522+
cheapestPrice = reagentPrice
523+
cheapestReagent = optionalReagent
524+
end
520525
end
521526
end
522527
end

0 commit comments

Comments
 (0)