Module necro.game.item.ItemGeneration
Functions
choice (args) | args is a table with fields:
* player (entity): do not generate items that this player can’t pick up (defaults to a random initial player)
* banMask (itemBan.Flag): ban flag to check on the player for item generation, defaults to GENERATEITEMPOOL
* slot (string): if non-nil, only generate items matching that slot
* requiredComponents (list of strings): only generate items that have all of those components
* excludedComponents (list of strings): only generate items that have none of those components
* itemPool (string): component name used to determine item weights (the component needs a weights field)
* chanceType (string): compatibility alias for itemPool (only works for built-in item pools)
* levelBonus (int): generate items from higher tiers
* chanceFunction (function entity => int): sets item weights (when set, chanceType and levelBonus are ignored)
* seenItems (table): acts as a counter for tracking item generation to prevent duplicates, defaults to global counter
* depletionLimit (int): items seen that many time will not be generated, defaults to 8
* transmutedItem (entity): the item being transmuted, if any
* default (string): if no items match the requirements, this is returned instead |
getSeenCount (item) | |
markSeen (item, count, seenItems) | |
randomPlayer (channel) | |
unweightedChoice (channel, slot, ...) | Deprecated |
weightedChoice (channel, chanceType, levelBonus, slot, ...) | Deprecated |
Tables
MarkSeenOnPickup | |
Pool |
Functions
- choice (args)
-
args is a table with fields:
* player (entity): do not generate items that this player can’t pick up (defaults to a random initial player)
* banMask (itemBan.Flag): ban flag to check on the player for item generation, defaults to GENERATEITEMPOOL
* slot (string): if non-nil, only generate items matching that slot
* requiredComponents (list of strings): only generate items that have all of those components
* excludedComponents (list of strings): only generate items that have none of those components
* itemPool (string): component name used to determine item weights (the component needs a
weights
field) * chanceType (string): compatibility alias for itemPool (only works for built-in item pools) * levelBonus (int): generate items from higher tiers * chanceFunction (function entity => int): sets item weights (when set, chanceType and levelBonus are ignored) * seenItems (table): acts as a counter for tracking item generation to prevent duplicates, defaults to global counter * depletionLimit (int): items seen that many time will not be generated, defaults to 8 * transmutedItem (entity): the item being transmuted, if any * default (string): if no items match the requirements, this is returned insteadParameters:
- args
- getSeenCount (item)
-
Parameters:
- item
- markSeen (item, count, seenItems)
-
Parameters:
- item
- count
- seenItems
- randomPlayer (channel)
-
Parameters:
- channel
- unweightedChoice (channel, slot, ...)
-
Deprecated
Parameters:
- channel
- slot
- ...
- weightedChoice (channel, chanceType, levelBonus, slot, ...)
-
Deprecated
Parameters:
- channel
- chanceType
- levelBonus
- slot
- ...
Tables
- MarkSeenOnPickup
-
Fields:
- ALWAYS
1
- NEVER
2
- ALWAYS
- Pool
-
Fields:
- CHEST
"itemPoolChest"
- RED_CHEST
"itemPoolRedChest"
- PURPLE_CHEST
"itemPoolPurpleChest"
- BLACK_CHEST
"itemPoolBlackChest"
- LOCKED_CHEST
"itemPoolLockedChest"
- SHOP
"itemPoolShop"
- LOCKED_SHOP
"itemPoolLockedShop"
- URN
"itemPoolUrn"
- SECRET
"itemPoolSecret"
- FOOD
"itemPoolFood"
- HEARTS
"itemPoolHearts"
- CRATE
"itemPoolCrate"
- WAR
"itemPoolWar"
- UNCERTAINTY
"itemPoolUncertainty"
- ENCHANT
"itemPoolEnchant"
- NEED
"itemPoolNeed"
- CHEST