From e12b582963982e6eae638ea63b700ece4d6935ec Mon Sep 17 00:00:00 2001 From: Zhell Date: Mon, 2 Dec 2024 00:03:06 +0100 Subject: [PATCH] Fix table label. --- dnd5e_utils/random-spell.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/dnd5e_utils/random-spell.js b/dnd5e_utils/random-spell.js index 1ead0d9..e348c63 100644 --- a/dnd5e_utils/random-spell.js +++ b/dnd5e_utils/random-spell.js @@ -4,36 +4,35 @@ */ // The spell levels. Use 0 for cantrips. -const levels = [0, 1, 2, 3, 4]; +const levels = new Set([0, 1, 2, 3, 4]); /* ----------------------------------------------------- */ -const name = `Random Spell (${CONFIG.DND5E.spellLevels[level]})`; const spells = await dnd5e.applications.CompendiumBrowser.fetch(Item, { - types: new Set(["spell"]), filters: [{k: "system.level", o: "in", v: levels}], index: false, - sort: true + sort: true, + types: new Set(["spell"]), }); const resultData = []; for (const [i, spell] of spells.entries()) { resultData.push({ - range: [i + 1, i + 1], - weight: 1, - documentId: spell.id, documentCollection: spell.pack, + documentId: spell.id, drawn: false, img: spell.img, + range: [i + 1, i + 1], text: spell.name, type: CONST.TABLE_RESULT_TYPES.COMPENDIUM, + weight: 1, }); } const table = new RollTable.implementation({ - name: name, + formula: `1d${resultData.length}`, + name: "Random Spell", results: resultData, - formula: `1d${resultData.length}` }); table.draw();