@@ -507,16 +507,21 @@ function CraftSim.RecipeData:SetNonQualityReagentsMax()
507
507
self .reagentData .requiredSelectableReagentSlot .possibleReagents or {}, function (optionalReagent )
508
508
return not GUTIL :isItemSoulbound (optionalReagent .item :GetItemID ())
509
509
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
519
518
cheapestReagent = optionalReagent
519
+ cheapestPrice = reagentPrice
520
+ else
521
+ if reagentPrice < cheapestPrice then
522
+ cheapestPrice = reagentPrice
523
+ cheapestReagent = optionalReagent
524
+ end
520
525
end
521
526
end
522
527
end
0 commit comments