Loot, affixes, uniques, runewords and a pile only you can see
D2-style treasure classes, rarity rolls and diminishing magic find, instanced per-player piles, runes and the Gloam Anvil, and a live item database, with measured drop rates.

Contents
- What's in the tables
- Treasure classes
- Rarity first, then the body
- Magic find with diminishing returns
- A pile only you can see
- Sockets, runes and runewords
- The Gloam Anvil
- The item database
- Where the counts come from
- Validation at save and at boot
- Versioned sync
- The admin editor
- Why flat treasure classes
- Related posts
Diablo II's loot model (treasure classes, a rarity roll, ilvl-gated affixes, uniques, sets, sockets, runewords) with one co-op change: every player gets their own pile. Drop rates below come from running the real roller a few hundred thousand times.

ItemTooltip component on the landing page, fed items rolled from the same tables the server uses.What's in the tables
All TypeScript under shared/data/items/ and shared/endgame/:
| Table | Count |
|---|---|
| Equipment bases (weapons, armor, jewelry) | 118 |
| Affixes (prefixes and suffixes) | 161 |
| Uniques | 83 |
| Sets / set pieces | 5 / 15 |
| Runes | 20 |
| Gems (7 types, 5 grades) | 35 |
| Runewords | 16 |
Bases have D2 footprints (1×1 rings to 2×4 polearms) and a qlvl. Affixes have a level requirement and a group, so no double "+life" prefixes. Uniques and set pieces list mod ranges, rolled once per copy.
Treasure classes
Normal, champion and unique elite each have a class; each of the 18 bosses has its own:
{ id: 'normal', picks: 1, weights: { none: 100, gold: 32, potion: 22, item: 18, scroll: 3 }, qualityMult: 1, goldMult: 1 },
{ id: 'champion', picks: 2, weights: { none: 40, gold: 30, potion: 20, item: 32, scroll: 3 }, qualityMult: 1.5, goldMult: 1.5 },
{
id: 'boss_bone_king', picks: 7, weights: { none: 0, gold: 30, potion: 20, item: 50, scroll: 5 }, qualityMult: 4, goldMult: 7,
guaranteed: [{ minRarity: 'unique', count: 1 }, { minRarity: 'rare', count: 2 }, { minRarity: 'magic', count: 2 }],
},none: 100of 175 makes over half of trash kills empty, on purpose: empty kills make drops feel like drops.qualityMultscales magic/rare/unique chances; the Bone King is 4× plus a guaranteed unique, two rares and two magics.- At ilvl ≤ 12, potion weight ×1.5 (
EARLY_POTION_MULT), part of the early-game tuning.
Rarity first, then the body
export function rollRarity(rng: Rng, magicFind: number, qualityMult: number): RolledRarity {
const c = rarityChances(magicFind, qualityMult)
if (rng.chance(c.unique)) return 'unique'
if (rng.chance(c.set)) return 'set'
if (rng.chance(c.rare)) return 'rare'
if (rng.chance(c.magic)) return 'magic'
return 'normal'
}- Base chances: 1% unique, 1% set, 7% rare, 30% magic.
- A unique must have base
qlvl≤ ilvl, else it becomes a rare. Hollowmere's Last Light (level-5 sword) comes from ~1 in 10 Bone King kills, ~1 in 20 from later bosses with bigger pools. - Bases within 15
qlvlof ilvl weigh ×3; jewelry ×0.5; white rings and amulets promote to magic. - Magic: 75% prefix, 75% suffix, at least one. Rare: 3–6 affixes weighted 40/30/20/10, max three per kind, two-word name by base type.
Magic find with diminishing returns
D2's curve: magic gets full MF, rare MF·500/(MF+500), unique and set MF·250/(MF+250):
export function effectiveMagicFind(mf: number): { magic: number; rare: number; unique: number } {
const m = Math.max(0, mf)
return { magic: m, rare: (m * 500) / (m + 500), unique: (m * 250) / (m + 250) }
}300% MF → 136% effective unique; 1200% → 207%. Clamps: unique and set 50%, rare 60%, magic 90%.
Real rollDrop, real tables, fixed seed, ilvl 30:
| Per 1,000 kills | White | Magic | Rare | Set | Unique |
|---|---|---|---|---|---|
| Normal monster, MF 0 | 65.0 | 29.3 | 6.6 | 1.1 | 1.0 |
| Normal monster, MF 100 | 34.9 | 53.0 | 12.6 | 1.8 | 1.8 |
| Normal monster, MF 300 | 7.6 | 70.8 | 19.9 | 2.4 | 2.3 |
| Champion, MF 0 | 241.6 | 202.3 | 51.7 | 7.4 | 7.7 |
| Champion, MF 300 | 33.3 | 301.3 | 143.3 | 17.5 | 17.8 |
| Unique elite, MF 0 | 542.6 | 1,608 | 458.4 | 67.7 | 68.7 |
| Unique elite, MF 300 | 75.4 | 1,134 | 1,224.8 | 152.6 | 163.6 |
- MF 0 normals also give 571 empty kills, 182 gold piles, 126 potions per 1,000.
- At 300% MF, magic hits its 90% clamp and whites nearly vanish, a real cost since whites are runeword bases.
- A trash unique is ~1 per 1,000 kills; one unique elite is worth ~70 trash kills in uniques. Go for the named monster.
- Average Bone King pile, one player: 2.52 white, 2.68 magic, 3.55 rare, 1.26 unique, 2.0 gold piles, plus potions and scrolls.
A pile only you can see
D2 parties shared one pile and the fastest clicker won. Duskbound rolls the whole pile once per eligible player, with that player's MF:
/** Damagers plus anyone alive within LOOT_RANGE (party members are naturally included). */
export function lootEligible(w: World, m: SimMonster): SimPlayer[] {
const out: SimPlayer[] = []
const r2 = LOOT_RANGE * LOOT_RANGE
for (const p of w.players.values()) {
if (p.bot) continue // companions: never get loot
const dx = p.x - m.x
const dy = p.y - m.y
if (m.damagers.has(p.id) || (!p.dead && dx * dx + dy * dy <= r2)) out.push(p)
}
return out
}- Eligible: anyone who hit it, or anyone alive within 25 tiles. Companions never.
- Each drop has an
ownerIdand is added only to its owner's ColyseusStateView; other players' items never reach your client. - Rares and up send the owner a
loot_beam. Alt shows labels. - Hand-dropped items get
ownerId '', which anyone can take: that's how you give an item to another player.

Sockets, runes and runewords
Sockets roll from a stream seeded by the item uid, so adding them didn't shift the shared RNG and break every seeded expectation:
export function rollItem(rng: Rng, opts: RollItemOptions): ItemInstance {
// endgame: sockets roll from the item's own uid, so the shared rng stream is untouched
const item = rollItemBody(rng, opts)
const sockets = rollSockets(new Rng(hash32('sockets', item.uid)), item)
return sockets > 0 ? { ...item, sockets, socketed: [] } : item
}| White | Magic | Rare | Unique | Set | |
|---|---|---|---|---|---|
| Socket chance | 35% | 18% | 8% | 3% | 0 |
| Rarity cap | 6 | 4 | 2 | 1 | 0 |
Max sockets is the lowest of the base cap, the ilvl cap (2 below 15, up to 6 at 55+) and the rarity cap. Fewer is always likelier.
Runes (Ash through Vex) roll on their own table: 0.4% rune and 1.2% gem per trash kill on Normal (0.8% / 1.4% in Nightmare and Hell), ×3 champions, ×6 unique elites, ×25 bosses. Each rune is 1.35× rarer than the last, so Vex is ~300× rarer than Ash; qlvl must be ≤ monster level.
A runeword is exact runes, in order, in a white item of the right type with exactly that many sockets:
{
id: 'kindle',
name: 'Kindle',
runes: rw('Ash', 'Ember'),
categories: WEAPON,
mods: m([['attackDmgPct', 30], ['fireMin', 10], ['fireMax', 20], ['firePct', 15], ['lightRadius', 2]]),
pitch: 'A first flame for any weapon: fire on every swing and spell',
},Runeword mods stack on the runes' own: Kindle's "Adds 15-30 Fire Damage" is Ember's 5–10 plus the runeword's 10–20. Runes and gems stack by qty, or they'd fill the 10×4 bag.
The Gloam Anvil
- Fuses three of a rune into the next, or three of a gem grade into the next
- Free up to Jarn (rune 10); then index² × 100 gold (Thal → Vex: 36,100)
- Unsockets everything for 1,000 gold per stone, returning a runeword's runes

One Vex from Ash is 3¹⁹ ≈ 1.16 billion Ash. The anvil is for the last step or two, like the Horadric Cube.
The item database
292 browsable entries at /items, with an editor at /admin/items.

One catalog. shared/data/items/catalog.ts is the only lookup, server and client. It layers admin overrides (ItemOverride rows) over the TypeScript tables.
- Lookups always resolve, even disabled items, so old saves never break
- Disabled items leave drop pools; existing copies still work
- Nothing is deleted. Revert drops the override; reverting a custom item disables it
Rolled values stay on the item. Built-in uniques store only uniqueRolls; lines come from the definition at read time. An edited definition would misalign old rolls, so copies rolled from edited definitions store the resolved fixedMods:
function rollFixed(rng: Rng, mods: readonly UniqueMod[], edited: boolean): Pick<ItemInstance, 'uniqueRolls' | 'fixedMods'> {
if (!edited) {
const rolls: number[] = []
for (const m of mods) if (m.max !== m.min) rolls.push(rng.int(m.min, m.max))
return { uniqueRolls: rolls }
}
const fixedMods = mods.map((m): Mod => {
const mod: Mod = { stat: m.stat, value: m.max !== m.min ? rng.int(m.min, m.max) : m.min }
if (m.param !== undefined) mod.param = m.param
if (m.level !== undefined) mod.level = m.level
return mod
})
return { uniqueRolls: [], fixedMods }
}Live counts without scanning saves.
ItemHolding(owner, item key, count) is rebuilt per owner on save, skipped if unchangedItemDaily(per item per UTC day, drops and crafts) feeds the 30-day sparklineItemFirstFind: first writer wins- The sim writes to memory; a timer folds it into Postgres every few seconds, so the tick never waits

Drop odds are closed-form: dropSources walks each boss class per difficulty (pick lands × rarity chance × this item's share of the pool, over every pick and guaranteed roll), assuming one hero and no MF. Nightmare drops the Last Light less because the ilvl is higher and the pool bigger.
Where the counts come from
Three one-line // items: hooks: spawnDrop, the inventory move handler, the Anvil. Runewords have no drop event, so the hook diffs before and after the move:
export function onRunewordsMade(w: World, p: SimPlayer, before: MoveState, after: MoveState): void {
const had = withRuneword(before)
for (const [uid, id] of withRuneword(after)) {
if (had.get(uid) === id) continue
const key = `runeword:${id}`
tallyItem({ itemKey: key, how: 'craft', characterId: p.id, name: p.name, zoneId: w.zoneId })
recordGameEvent({ kind: 'craft', characterId: p.id, name: p.name, zoneId: w.zoneId, detail: 'runeword', itemKey: key, data: { item: getRuneword(id)?.name ?? id } })
}
}withRuneword scans grid, equipment and open stash, so moving a runeword between them never double-counts. Runes from index 14 up are logged on drop for the rare-rune pages.
Validation at save and at boot
Overrides are untrusted JSON. catalogSchema.ts defines UniqueDefZ, SetItemDefZ, RunewordDefZ, base and affix patches and a discriminated OverrideInputZ. overrideProblems checks what a schema can't (base exists and is wearable, runes are real, some allowed category fits that many sockets, one range per affix line) and returns plain sentences; the editor runs it live. checkOverride runs on every save and on every row at boot:
for (const r of dbRows) {
const checked = checkOverride({ kind: r.kind, id: r.itemId, enabled: r.enabled, def: r.def }, r.custom)
if (checked.ok) {
good.push(checked.entry)
live.push({ kind: r.kind, id: r.itemId, version: r.version, enabled: r.enabled })
} else {
log.warn(`[items] override ${r.kind}:${r.itemId} rejected: ${checked.problems.join('; ')}`)
}
}
applyCatalog({ version: versionOf(live), entries: good })A row that references a base a later deploy renamed is skipped, logged and shown as invalid. If the whole load fails, the server runs on built-ins.
Versioned sync
versionOf hashes sorted kind:id:version:enabled to 16 hex chars (empty catalog = empty string). Each admin write bumps the row, reloads and broadcasts catalog {version}; clients refetch items.catalog only on mismatch and re-validate with CatalogOverridesZ. Edits reach every player within a round trip, no deploy.
The admin editor
- Every item badged built-in, edited, custom, disabled or invalid
- Uniques, set pieces, runewords edited as full definitions; bases and affixes as safe patches (damage yes, size no, since rolled copies occupy cells)
- Live preview is the real tooltip rendered from the draft
- Create, enable/disable, revert, give-to-self; every write audited with the admin's name

Two end-to-end checks:
- Last Light disabled: 20,000 simulated Bone King kills, 0 copies. Enabled: ~1 in 10.
- Emberbrand, a runeword made entirely in the editor (Ash + Cael in a two-socket sword, axe or mace), was socketed by a live character and showed up on its page as crafted once.


More in the admin console.
Why flat treasure classes
D2 nested classes. A flat array lets dropSources compute every item's odds with one Math.pow per pick, instead of a recursive walk over a class graph. "The Bone King gives a 1 in 10 shot at the Act 1 sword" is the number a designer wants to set, and here it's one function call from the data.