From ec43f1451a6dbbc9f14abc992c8c98da1d2dfa98 Mon Sep 17 00:00:00 2001 From: Chris Schmalz Date: Mon, 12 Aug 2024 19:14:43 -0700 Subject: [PATCH] accomodate for changes to roll type in v12 --- module/actor/actor.js | 10 ++++++++++ templates/chat/rollTable.html | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/module/actor/actor.js b/module/actor/actor.js index 83ef8f8..07ea9f1 100644 --- a/module/actor/actor.js +++ b/module/actor/actor.js @@ -1419,6 +1419,7 @@ export class MothershipActor extends Actor { let msgDesc = ``; let flavorText = ``; let woundText = ``; + let tableResultType = ``; let tableResultEdited = ``; let tableResultFooter = ``; let chatId = (game.release.generation >= 12 ? foundry.utils.randomID(): randomID()) @@ -1701,11 +1702,20 @@ export class MothershipActor extends Actor { if (specialRoll === 'maintenanceCheck' && useCalm && parsedRollResult.success && parsedRollResult.critical) { flavorText = flavorText + ` Gain 1d10 Calm.

@UUID[Compendium.mosh.macros_triggered_1e.k2TtLFOG9mGaWVx3]{+1d10 Calm}`; } + //set table result type (using first value) + if (tableResult[0].type === 0 || tableResult[0].type === 'text') { + tableResultType = `text`; + } else if (tableResult[0].type === 1 || tableResult[0].type === 'document') { + tableResultType = `document`; + } else { + tableResultType = `unknown`; + } //generate chat message //prepare data let messageData = { actor: this, tableResult: tableResult, + tableResultType: tableResultType, tableResultEdited: tableResultEdited, tableResultFooter: tableResultFooter, parsedRollResult: parsedRollResult, diff --git a/templates/chat/rollTable.html b/templates/chat/rollTable.html index c364cae..e674087 100644 --- a/templates/chat/rollTable.html +++ b/templates/chat/rollTable.html @@ -27,7 +27,7 @@ {{#if woundText}} {{{woundText}}}

{{/if}} - {{#if (compare 'int' tableResult.[0].type '===' 1)}} + {{#if (compare 'str' tableResultType '===' 'document')}}
    {{#each tableResult}}
  1. @@ -37,7 +37,7 @@ {{/each}}
{{/if}} - {{#if (compare 'int' tableResult.[0].type '===' 0)}} + {{#if (compare 'str' tableResultType '===' 'text')}} {{#if tableResultEdited}}
{{{tableResultEdited}}}{{{tableResultFooter}}}
{{else}}