System setting and toggle option for roll dialog

This commit is contained in:
Ender
2024-05-04 12:24:21 +02:00
parent a57aea1228
commit 258f9d5b45
4 changed files with 48 additions and 17 deletions
+11 -2
View File
@@ -142,18 +142,27 @@ export class M5Roll {
return renderTemplate(M5Roll.TEMPLATE_PATH, this.data);
}
async toMessage() {
async toMessage(toggleAutomatedRoll = false) {
let automatedRoll = (game as Game).settings.get("midgard5", "automatedRoll");
automatedRoll = toggleAutomatedRoll ? !automatedRoll : automatedRoll;
const rMode = (game as Game).settings.get("core", "rollMode");
if (!automatedRoll) {
let checkOptions = await this.popUp({ isPW: this.data.rolls[0].label === (game as Game).i18n.localize("midgard5.pw") });
if (checkOptions["cancelled"]) {
return;
} else {
const rMode = checkOptions["rollMode"];
this.data.b = checkOptions;
}
} else {
this.data.b = { difficulty: 20, modifier: 0 };
}
if (!this._evaluated) await this.evaluate();
const faces = this.pool.dice.map((x) => x.faces);
const rMode = checkOptions["rollMode"] || (game as Game).settings.get("core", "rollMode");
const chatData = {
type: CONST.CHAT_MESSAGE_TYPES.ROLL,
content: await this.render(),