diff --git a/package.json b/package.json index b9b4a48f..7e0296ed 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "@commitlint/cli": "16.1.0", "@commitlint/config-conventional": "16.0.0", "@guanghechen/rollup-plugin-copy": "1.8.6", - "@league-of-foundry-developers/foundry-vtt-types": "9.238.1", + "@league-of-foundry-developers/foundry-vtt-types": "9.242.0", "@seald-io/nedb": "2.2.1", "@types/fs-extra": "9.0.13", "@types/jest": "27.4.0", diff --git a/src/module/active-effect.ts b/src/module/active-effect.ts index 08925178..81689bfb 100644 --- a/src/module/active-effect.ts +++ b/src/module/active-effect.ts @@ -80,7 +80,7 @@ export class DS4ActiveEffect extends ActiveEffect { } /** - * Gets the source document for this effect. Uses the cached {@link DS4ActiveEffect#origin} if it has already been + * Gets the source document for this effect. Uses the cached {@link DS4ActiveEffect#source} if it has already been * set. */ protected async getSource(): ReturnType { diff --git a/src/module/rolls/roll.ts b/src/module/rolls/roll.ts index 082c7ebf..70b0fba0 100644 --- a/src/module/rolls/roll.ts +++ b/src/module/rolls/roll.ts @@ -9,41 +9,29 @@ export class DS4Roll = Record static CHAT_TEMPLATE = "systems/ds4/templates/dice/roll.hbs"; /** - * This only differs from {@link Roll.render} in that it provides `isCoup` and `isFumble` properties to the roll - * template if the first dice term is a ds4 check. * @override + * @remarks + * This only differs from {@link Roll#render} in that it provides `isCoup` and `isFumble` properties to the roll + * template if the first dice term is a ds4 check. */ - async render(chatOptions: Parameters[0] = {}): Promise { - chatOptions = foundry.utils.mergeObject( - { - user: getGame().user?.id, - flavor: null, - template: DS4Roll.CHAT_TEMPLATE, - blind: false, - }, - chatOptions, - ); - const isPrivate = chatOptions.isPrivate; - - // Execute the roll, if needed - if (!this._evaluated) this.evaluate(); - - // Define chat data + async render({ + flavor, + template = (this.constructor as typeof DS4Roll).CHAT_TEMPLATE, + isPrivate = false, + }: Parameters[0] = {}): Promise { + if (!this._evaluated) await this.evaluate({ async: true }); const firstDiceTerm = this.dice[0]; const isCoup = firstDiceTerm instanceof DS4Check && firstDiceTerm.coup; const isFumble = firstDiceTerm instanceof DS4Check && firstDiceTerm.fumble; - const chatData = { formula: isPrivate ? "???" : this._formula, - flavor: isPrivate ? null : chatOptions.flavor, - user: chatOptions.user, + flavor: isPrivate ? null : flavor, + user: getGame().user?.id, tooltip: isPrivate ? "" : await this.getTooltip(), total: isPrivate ? "?" : Math.round((this.total ?? 0) * 100) / 100, isCoup: isPrivate ? null : isCoup, isFumble: isPrivate ? null : isFumble, }; - - // Render the roll display template - return renderTemplate(chatOptions.template ?? "", chatData); + return renderTemplate(template, chatData); } } diff --git a/yarn.lock b/yarn.lock index 2b0fa2fa..1b313e57 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1151,9 +1151,9 @@ __metadata: languageName: node linkType: hard -"@league-of-foundry-developers/foundry-vtt-types@npm:9.238.1": - version: 9.238.1 - resolution: "@league-of-foundry-developers/foundry-vtt-types@npm:9.238.1" +"@league-of-foundry-developers/foundry-vtt-types@npm:9.242.0": + version: 9.242.0 + resolution: "@league-of-foundry-developers/foundry-vtt-types@npm:9.242.0" dependencies: "@types/jquery": ~3.5.9 "@types/simple-peer": ~9.11.1 @@ -1162,7 +1162,7 @@ __metadata: pixi.js: 5.3.11 socket.io-client: 4.3.2 tinymce: 5.10.1 - checksum: 8d266dd7f3f44ffa354e3c5a15541ac335bc58a551388b8d336ee2c0fb4147920da34ff8042b0128fb2df2074b3bdbab8f4af5bd918f9dd11606b8b42422ddf9 + checksum: f749fd271ca4a2c4cb6a53284329fe242ae8b36043ae1a2abf3ed3d89d4ff19b3d8f798dcd9615472a06c7937d6eff5ee7fa80aa0225c0c151a9a0539f10858d languageName: node linkType: hard @@ -3699,7 +3699,7 @@ __metadata: "@commitlint/cli": 16.1.0 "@commitlint/config-conventional": 16.0.0 "@guanghechen/rollup-plugin-copy": 1.8.6 - "@league-of-foundry-developers/foundry-vtt-types": 9.238.1 + "@league-of-foundry-developers/foundry-vtt-types": 9.242.0 "@seald-io/nedb": 2.2.1 "@types/fs-extra": 9.0.13 "@types/jest": 27.4.0