Skip to content

Class "ItemPool"⚓︎

Modified Functions⚓︎

GetCollectible ()⚓︎

CollectibleType GetCollectible ( ItemPoolType PoolType, boolean Decrease = false, int Seed = Random(), CollectibleType DefaultItem = CollectibleType.COLLECTIBLE_NULL, GetCollectibleFlag Flags = 0 )⚓︎

Now gives access to the Flags parameter.

Setting both Ban Flags

Setting both the BAN_ACTIVE and the BAN_PASSIVE flag will cause the function to always return either the DefaultItem or CollectibleType.COLLECTIBLE_BREAKFAST


Functions⚓︎

AddBibleUpgrade ()⚓︎

void AddBibleUpgrade ( int Add, ItemPoolType PoolType )⚓︎


CanSpawnCollectible ()⚓︎

boolean CanSpawnCollectible ( CollectibleType Collectible, boolean ignoreLocked )⚓︎

IgnoreLocked

If IgnoreLocked is set to true, this function will return true for items that could appear but are locked behind achievements.

It will still return false if the item was removed from the item pool or if it can't appear because other effects (Tainted Lost offensive items mechanic or NO! trinket effect).


GetBibleUpgrades ()⚓︎

int GetBibleUpgrades ( ItemPoolType PoolType )⚓︎

Returns number of Bible collectibles added to a pool.


GetCardEx ()⚓︎

Card GetCardEx ( int Seed, int SpecialChance, int RuneChance, int SuitChance, boolean AllowNonCards )⚓︎

More sophisticated version of ItemPool:GetCard() that allows to define individual chances.


GetCollectibleFromList ()⚓︎

CollectibleType GetCollectibleFromList ( CollectibleType[] ItemList, int Seed = Random(), CollectibleType DefaultItem = CollectibleType.COLLECTIBLE_BREAKFAST, boolean AddToBlacklist = true, boolean ExcludeLockedItems = false )⚓︎


GetCollectiblesFromPool ()⚓︎

table GetCollectiblesFromPool ( ItemPoolType PoolType )⚓︎

Returns a table of collectibles registered in the specified pool. The table contains the following fields

Field Type Comment
itemID CollectibleType
initialWeight float
weight float
decreaseBy float
removeOn float
isUnlocked boolean

GetNumAvailableTrinkets ()⚓︎

int GetNumAvailableTrinkets ( )⚓︎

Returns the amount of trinkets available in the item pool.


GetNumItemPools ()⚓︎

int GetNumItemPools ( )⚓︎

Retrieves the total number of item pools in the game, including custom item pools.


GetPillColor ()⚓︎

PillColor GetPillColor ( PillEffect ID )⚓︎

Returns a PillColor matching the specificed PillEffect, returns -1 if the Effect is not in the rotation.

Currently not applied by pill modifications, such as PHD/False PHD.


GetRandomPool ()⚓︎

ItemPoolType GetRandomPool ( RNG RNG, boolean AdvancedSearch = false, ItemPoolType[] Filter = {}, boolean IsWhitelist = false)⚓︎

Picks a random pool in an identical manner to Chaos, where pools with more items have a higher probability of being chosen compared to those with fewer items.

Normally this function is tied to the same rules as Chaos, meaning that you can only get the pools for the current mode, but by setting Advanced Search to true you can bypass these restrictions.

Advanced Search

Setting Advanced Search to true allows you to make use of the Filter parameter.

Normally the Filter acts as a blacklist of unwanted itemPools, however setting IsWhitelist to true turns it into a list from which to choose from.

Pick Pool From List

This code picks a random pool from any of the "Beggar" pools

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
local PoolList = {
    ItemPoolType.POOL_BEGGAR,
    ItemPoolType.POOL_DEMON_BEGGAR,
    ItemPoolType.POOL_KEY_MASTER,
    ItemPoolType.POOL_BATTERY_BUM,
    ItemPoolType.POOL_BOMB_BUM,
    ItemPoolType.POOL_ROTTEN_BEGGAR
}

local rng = RNG() -- replace this with your own rng
local randomPool = Game():GetItemPool():GetRandomPool(rng, true, PoolList, true)
Pick Pool From Vanilla

This code picks a random pool from any of the vanilla

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
local itemPool = Game():GetItemPool()

local CustomPools = {}

-- Put all custom pools within the Filter
for i = 31, itemPool:GetNumItemPools() - 1 do
    table.insert(CustomPools, i)
end

local rng = RNG(Random()) -- replace this with your own rng
local randomPool = Game():GetItemPool():GetRandomPool(rng, true, CustomPools, false)

GetRemovedCollectibles ()⚓︎

table GetRemovedCollectibles ( )⚓︎

Returns a table of collectibles removed from all pools.

Example Code

This code checks if the sad onion has been removed.

1
2
3
4
5
local removedCollectibles = itemPool:GetRemovedCollectibles()

if removedCollectibles[CollectibleType.COLLECTIBLE_SAD_ONION] then
  print("Sad onion removed!")
end

GetRoomBlacklistedCollectibles ()⚓︎

table GetRoomBlacklistedCollectibles ( )⚓︎

Returns a table of collectibles blacklisted in the current room.

Example Code

This code checks if the sad onion has been removed.

1
2
3
4
5
local blacklistedCollectibles = itemPool:GetRoomBlacklistedCollectibles()

if blacklistedCollectibles[CollectibleType.COLLECTIBLE_SAD_ONION] then
  print("Sad onion blacklisted!")
end

HasCollectible ()⚓︎

boolean HasCollectible ( CollectibleType Collectible )⚓︎

Returns true if collectible is available in item pools, false otherwise.


HasTrinket ()⚓︎

boolean HasTrinket ( TrinketType Trinket )⚓︎

Returns true if trinket is currently available in trinket pool, false otherwise.


PickCollectible ()⚓︎

table PickCollectible ( ItemPoolType PoolType, boolean Decrease = false, RNG RNG = RNG(), GetCollectibleFlag Flags = 0 )⚓︎

Returns the raw result of GetCollectible(), without any of the filtering applied by the original function. If the pool has completely ran out of repicks then this function will return nil.

If RNG is not set, its initialized with RNG(Random(), 4)

The table contains the following fields:

Field Type Comment
itemID CollectibleType
initialWeight float
weight float
decreaseBy float
removeOn float
isUnlocked boolean
Differences with GetCollectible

For reference GetCollectible() Gives Up after either this function has failed to pick an Unlocked collectible 20 times in a row or has failed to produce any result at all (nil).

  • Does not generate a Glitched Item when having the CollectibleType.COLLECTIBLE_TMTRAINER effect.

  • Does not randomize the pool when having the CollectibleType.COLLECTIBLE_CHAOS effect.

  • Does not attempt to get a collectible from ItemPoolType.POOL_TREASURE if Giving up.

  • Does not morph the collectible into CollectibleType.COLLECTIBLE_BREAKFAST if Giving up.

  • Does not attempt to morph the collectible into CollectibleType.COLLECTIBLE_BIBLE, CollectibleType.COLLECTIBLE_MAGIC_SKIN or CollectibleType.COLLECTIBLE_ROSARY

  • Does not trigger the MC_PRE_GET_COLLECTIBLE and MC_POST_GET_COLLECTIBLE callback.


ResetCollectible ()⚓︎

void ResetCollectible ( CollectibleType Collectible )⚓︎

Makes the available once again, allowing it to naturally spawned even if previously remove. Also restores all instances of the collectible to it's initialWeight in every item pool.


SetLastPool ()⚓︎

void SetLastPool ( ItemPoolType )⚓︎


UnidentifyPill ()⚓︎

void UnidentifyPill ( PillColor Pill )⚓︎

Will reset a pill back to unidentified (???) state.