Skip to content

Commit

Permalink
Add optional parameter to SetCheapestQualityReagentsMax for non-alloc…
Browse files Browse the repository at this point in the history
…ated reagents
  • Loading branch information
derfloh205 committed Jan 13, 2025
1 parent ea49208 commit 6266a8a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Classes/CraftQueue.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function CraftSim.CraftQueue:AddRecipe(options)

-- make sure all required reagents are maxed out
recipeData:SetNonQualityReagentsMax()
recipeData:SetCheapestQualityReagentsMax()
recipeData:SetCheapestQualityReagentsMax(true)

local craftQueueItem = self:FindRecipe(recipeData)

Expand Down
5 changes: 4 additions & 1 deletion Classes/RecipeData.lua
Original file line number Diff line number Diff line change
Expand Up @@ -540,12 +540,15 @@ function CraftSim.RecipeData:HasRequiredSelectableReagent()
end

--- Consideres Order Reagents
function CraftSim.RecipeData:SetCheapestQualityReagentsMax()
---@param nonAllocatedOnly boolean?
function CraftSim.RecipeData:SetCheapestQualityReagentsMax(nonAllocatedOnly)
for _, reagent in ipairs(self.reagentData.requiredReagents) do
local isOrderReagent = reagent:IsOrderReagentIn(self)
if reagent.hasQuality then
if not isOrderReagent then
if not nonAllocatedOnly and reagent:GetTotalQuantity() < reagent.requiredQuantity then
reagent:SetCheapestQualityMax(self.subRecipeCostsEnabled)
end
elseif isOrderReagent then
for _, reagentItem in ipairs(reagent.items) do
if reagentItem:IsOrderReagentIn(self) then
Expand Down

0 comments on commit 6266a8a

Please sign in to comment.