LOOT_D
Daemon responsible for handling the loot system, including item drops, coin drops, and automatic valuation. Called by the death sequence when an NPC is killed.
# public loot_drop
Drops loot from the source’s loot table into the source NPC, whose inventory the death sequence then empties into the corpse. Iterates each entry, rolls against its chance, and creates the item on success.
# public coin_drop
Drops coins from the source’s coin table into the source. Each coin entry is rolled independently.
# public determine_value_by_level
Calculates a coin value based on level, applying a configured variance
for randomization. Uses COIN_VALUE_PER_LEVEL and COIN_VARIANCE
from the MUD configuration.
# private drop_items
Processes and drops a single loot item into the source. Resolves the
item via process_loot_item, creates the object, auto-values it if
applicable, and moves it into the source NPC.
# private process_loot_item
Recursively resolves a loot item. Handles functions (called and
re-resolved), arrays (random pick), weighted mappings
(element_of_weighted), and plain string paths.
({ path, args }) pair, or 0 on failure # private autovalue_loot_item
Sets the value of a loot item based on the source NPC’s level, if
the item has the autovalue loot property enabled.
# private drop_coins
Creates a coin object of the given type and amount, and moves it into the source.
({ currency_type, amount }) pair