From 5aff39cf75ff929b5547df7ae693b5d88468e42b Mon Sep 17 00:00:00 2001 From: Tim Evans Date: Tue, 14 Jul 2026 16:14:30 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20d66=20crit=20tables=20failed=20rolltable?= =?UTF-8?q?=20provisioning=20=E2=80=94=20handle=20key-shaped=20results=20w?= =?UTF-8?q?ith=201d6*10+1d6=20formula?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- slazero2.mjs | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/slazero2.mjs b/slazero2.mjs index 96a0a34..ca8e7c5 100644 --- a/slazero2.mjs +++ b/slazero2.mjs @@ -10805,18 +10805,36 @@ Hooks.once("ready", async () => { for (const key of Object.keys(data)) { const t = data[key]; if (!t?.name || game.tables.getName(t.name)) continue; - await RollTable.create({ - name: t.name, - description: t.description || "", - formula: (t.formula || "1d6").replace("@stress", "0"), - replacement: true, - displayRoll: true, - results: (t.results || []).map(r => ({ + const isD66 = (t.results || []).some(r => typeof r.key === "string"); + const results = (t.results || []).map(r => { + if (typeof r.key === "string") { + // d66 shape: key "t.o" → numeric to*1 range; compose display text + const [tens, ones] = r.key.split(".").map(Number); + const val = tens * 10 + ones; + const tail = [r.effects, r.healing ? `Healing: ${r.healing}` : "", + r.recovery ? `Recovery: ${r.recovery}` : "", + r.timeLimit ? `⏱ ${r.timeLimit}` : ""].filter(Boolean).join(" — "); + return { + type: CONST.TABLE_RESULT_TYPES?.TEXT ?? 0, + text: `${r.name}${r.lethal ? " ☠" : ""}: ${tail}`, + range: [val, val], + weight: 1 + }; + } + return { type: CONST.TABLE_RESULT_TYPES?.TEXT ?? 0, text: r.text, range: r.range, weight: 1 - })) + }; + }); + await RollTable.create({ + name: t.name, + description: t.description || "", + formula: isD66 ? "1d6 * 10 + 1d6" : (t.formula || "1d6").replace("@stress", "0"), + replacement: true, + displayRoll: true, + results }); created++; }