Loot Table Builder
v1.0.0Loot table design tool — weighted entries, rarity tiers, drop chance preview.
Loot Table JSON
{
"name": "dungeon-chest",
"rolls": "2-4",
"items": [
{
"name": "Gold Coin",
"weight": 50,
"probability": "50.0%",
"quantity": {
"min": 5,
"max": 20
}
},
{
"name": "Health Potion",
"weight": 30,
"probability": "30.0%",
"quantity": {
"min": 1,
"max": 3
}
},
{
"name": "Iron Sword",
"weight": 15,
"probability": "15.0%",
"quantity": {
"min": 1,
"max": 1
}
},
{
"name": "Rare Gem",
"weight": 4,
"probability": "4.0%",
"quantity": {
"min": 1,
"max": 1
}
},
{
"name": "Legendary Amulet",
"weight": 1,
"probability": "1.0%",
"quantity": {
"min": 1,
"max": 1
}
}
]
}
// TypeScript drop function:
function rollLoot(table: typeof lootTable): string[] {
const results: string[] = [];
const rolls = rollRange(table.rolls); // e.g. "2-4" → random int 2-4
for (let i = 0; i < rolls; i++) {
let r = Math.random() * 100;
for (const item of table.items) {
r -= item.weight;
if (r <= 0) { results.push(item.name); break; }
}
}
return results;
}