refactor: resturcture files so that lincensing info can be bundled properly
This commit is contained in:
parent
699ba74840
commit
1aa284311f
484 changed files with 119 additions and 179 deletions
|
@ -1,37 +0,0 @@
|
|||
// SPDX-FileCopyrightText: 2021 Johannes Loher
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import { getGame } from "../helpers";
|
||||
import { DS4Check } from "./check";
|
||||
|
||||
export class DS4Roll<D extends Record<string, unknown> = Record<string, unknown>> extends Roll<D> {
|
||||
static CHAT_TEMPLATE = "systems/ds4/templates/dice/roll.hbs";
|
||||
|
||||
/**
|
||||
* @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({
|
||||
flavor,
|
||||
template = (this.constructor as typeof DS4Roll).CHAT_TEMPLATE,
|
||||
isPrivate = false,
|
||||
}: Parameters<Roll["render"]>[0] = {}): Promise<string> {
|
||||
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 : 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,
|
||||
};
|
||||
return renderTemplate(template, chatData);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue