System setting and toggle option for roll dialog
This commit is contained in:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user