item_enchantment_template Table¶
Defines random enchantments for items (e.g., from random_property fields).
Schema Summary¶
| Field | Type | Key | Null | Default | Extra |
|---|---|---|---|---|---|
entry |
mediumint(8) unsigned | PRI | NO | 0 | |
ench |
mediumint(8) unsigned | PRI | NO | 0 | |
chance |
float unsigned | NO | 0 | ||
patch_min |
tinyint(3) unsigned | PRI | NO | 0 | |
patch_max |
tinyint(3) unsigned | PRI | NO | 10 |
Field Breakdown¶
entry- Primary Key. Random-property group id referenced fromitem_templateRandomProperty. All rows sharing an entry form one weighted pool.ench- Primary Key. Enchantment/property id; rolled ids must exist inItemRandomProperties.dbc.chance- Relative weight (0-100). The roller normalises by the pool total:roll = rand(0..total), then walks rows cumulatively, so weights need not sum to 100.patch_min/patch_max- Client patch range.
Rolling Mechanic¶
GetItemEnchantMod() (src/game/ItemEnchantmentMgr.cpp) picks one row per crafted/rolled item:
- Sum all
chancevalues of the pool. - Roll uniformly in
[0, total). - Return the first
enchwhose cumulative weight reaches the roll.
Missing pools log "Item RandomProperty id #%u used in item_template
but it doesn't have records...". Rows with chance outside (0,100] are skipped at load.
The chosen id lands in item_instance.random_property_id.