From 27fad7d0c2d923d3e35b8521d6e2ef75a8da2361 Mon Sep 17 00:00:00 2001 From: Buurazu Date: Mon, 21 Mar 2022 21:24:52 -0400 Subject: [PATCH] Rep patch: Locked recipes no longer ignore unlock status --- eid_bagofcrafting.lua | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/eid_bagofcrafting.lua b/eid_bagofcrafting.lua index b8743fad..a1128516 100644 --- a/eid_bagofcrafting.lua +++ b/eid_bagofcrafting.lua @@ -358,10 +358,15 @@ function EID:calculateBagOfCrafting(componentsTable) table.sort(components) local componentsAsString = table.concat(components, ",") - -- Check the fixed recipes. Currently, the fixed recipes ignore item unlock status + -- Check the fixed recipes + local fixedRecipeResult = nil local cacheResult = CraftingFixedRecipes[componentsAsString] if cacheResult ~= nil then - return cacheResult, cacheResult + if EID:isCollectibleUnlockedAnyPool(cacheResult) then + return cacheResult, cacheResult + else + fixedRecipeResult = cacheResult + end end -- Check the recipes already calculated for this seed cacheResult = calculatedRecipes[componentsAsString] @@ -453,9 +458,9 @@ function EID:calculateBagOfCrafting(componentsTable) end --When the first crafting result is an achievement locked item, this process gets repeated a second time to choose a new result --That 2nd pick could also be achievement locked but we're ignoring that... - local firstOption = nil + local firstOption = fixedRecipeResult while true do - local t = nextFloat() -- number between 0 and 1 + local t = nextFloat() -- random number between 0 and 1 local target = t * totalWeight -- number between 0 and total weight of possible results for k,v in ipairs(itemWeights) do target = target - v