Add support for collectible's item pool (#561)

* getlastpool test

* update icons and config

* Don't show pool for quest items

* Fix modded recipes breaking game's last pool

* fix icon misalign

* Added text for Last Item Pool indicator
This commit is contained in:
wakaba (aka. 미카) authored and GitHub committed 2023-05-07 16:58:43 +02:00
1 parent 51d0ef2e1b
commit da9338ef54
10 files changed
+161 -3

No files matched your search

+6 -1
View File
@@ -530,6 +530,9 @@ local function GameStartCrafting()
-- Check for modded items past the known max item ID on game start (can also support game updates)
-- Only works if the new items are at Weight 1.0 in their item pools, but better than nothing
if EID.Config["BagOfCraftingModdedRecipes"] and EID.itemConfig:GetCollectible(EID.XMLMaxItemID+1) ~= nil and not moddedCrafting then
-- Save last pool
local itemPool = game:GetItemPool()
local lastPool = itemPool:GetLastPool()
-- Items past max ID detected
CraftingMaxItemID = EID.XMLMaxItemID -- XMLMaxItemID is never modified
-- Add new item qualities
@@ -540,7 +543,6 @@ local function GameStartCrafting()
CraftingItemAllowed[coll.ID] = true
coll = EID.itemConfig:GetCollectible(CraftingMaxItemID+1)
end
local itemPool = game:GetItemPool()
-- Add new items to the crafting item pools, assuming Weight 1.0
for poolNum,_ in pairs(poolToIcon) do
for i=1,EID.XMLMaxItemID do itemPool:AddRoomBlacklist(i) end
@@ -553,6 +555,9 @@ local function GameStartCrafting()
itemPool:AddRoomBlacklist(collID)
collID = itemPool:GetCollectible(poolNum, false, 1, 25)
end
-- Do getCollectible again to revert last pool
itemPool:GetCollectible(lastPool, false, 1, 25)
itemPool:ResetRoomBlacklist()
end