Vereinfachter-NPC/Kreaturen-Bogen #107
|
|
@ -314,7 +314,7 @@ export class M5Item extends Item {
|
|||
return ret;
|
||||
}
|
||||
|
||||
async roll() {
|
||||
async roll(toggleAutomatedRoll = false) {
|
||||
const item = this as any;
|
||||
|
||||
// Initialize chat data.
|
||||
|
|
@ -348,7 +348,7 @@ export class M5Item extends Item {
|
|||
}
|
||||
|
||||
const roll = new M5Roll(rollData, this.actor, item.name, item.id);
|
||||
return roll.toMessage();
|
||||
return roll.toMessage(toggleAutomatedRoll);
|
||||
} else {
|
||||
ChatMessage.create({
|
||||
speaker: speaker,
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -85,7 +85,8 @@ export default class M5CharacterSheet extends ActorSheet {
|
|||
let attributeValue = target ? parseInt(target.dataset.value) : null;
|
||||
let attributeStr = target ? target.dataset.attribute : null;
|
||||
const roll = M5Roll.fromAttributeValue(this.actor, attributeStr, attributeValue);
|
||||
await roll.toMessage();
|
||||
let toggleAutomatedRoll = (event.shiftKey)
|
||||
await roll.toMessage(toggleAutomatedRoll);
|
||||
});
|
||||
|
||||
html.find(".edit-item").on("click", async (event) => {
|
||||
|
|
@ -145,7 +146,8 @@ export default class M5CharacterSheet extends ActorSheet {
|
|||
});
|
||||
}
|
||||
|
||||
await item.roll();
|
||||
let toggleAutomatedRoll = (event.shiftKey)
|
||||
await item.roll(toggleAutomatedRoll);
|
||||
this.render();
|
||||
});
|
||||
|
||||
|
|
@ -165,7 +167,8 @@ export default class M5CharacterSheet extends ActorSheet {
|
|||
|
||||
const actor = this.actor as any;
|
||||
const item = actor.items.get(skillId) as M5Item;
|
||||
await item.roll();
|
||||
let toggleAutomatedRoll = (event.shiftKey)
|
||||
await item.roll(toggleAutomatedRoll);
|
||||
});
|
||||
|
||||
html.find(".roll-general-button").on("click", async (event) => {
|
||||
|
|
@ -176,7 +179,8 @@ export default class M5CharacterSheet extends ActorSheet {
|
|||
const unlearnedSkill = data.skills.general[skillName] as M5SkillUnlearned;
|
||||
|
||||
const roll = M5Roll.fromUnlearnedSkill(this.actor, unlearnedSkill, skillName);
|
||||
await roll.toMessage();
|
||||
let toggleAutomatedRoll = (event.shiftKey)
|
||||
await roll.toMessage(toggleAutomatedRoll);
|
||||
});
|
||||
|
||||
html.find(".learn-button").on("click", async (event) => {
|
||||
|
|
@ -274,48 +278,57 @@ export default class M5CharacterSheet extends ActorSheet {
|
|||
|
||||
const context = this.actor as any;
|
||||
const item = context.items.get(itemId) as M5Item;
|
||||
await item.roll();
|
||||
let toggleAutomatedRoll = (event.shiftKey)
|
||||
await item.roll(toggleAutomatedRoll);
|
||||
this.render();
|
||||
});
|
||||
|
||||
html.find(".roll-brawl-button").on("click", async (event) => {
|
||||
const roll = M5Roll.brawl(this.actor);
|
||||
await roll.toMessage();
|
||||
let toggleAutomatedRoll = (event.shiftKey)
|
||||
await roll.toMessage(toggleAutomatedRoll);
|
||||
});
|
||||
|
||||
html.find(".roll-cleanSpell-button").on("click", async (event) => {
|
||||
const roll = M5Roll.cleanSpell(this.actor);
|
||||
await roll.toMessage();
|
||||
let toggleAutomatedRoll = (event.shiftKey)
|
||||
await roll.toMessage(toggleAutomatedRoll);
|
||||
});
|
||||
|
||||
html.find(".roll-deprivationCold-button").on("click", async (event) => {
|
||||
const roll = M5Roll.deprivationCold(this.actor);
|
||||
await roll.toMessage();
|
||||
let toggleAutomatedRoll = (event.shiftKey)
|
||||
await roll.toMessage(toggleAutomatedRoll);
|
||||
});
|
||||
|
||||
html.find(".roll-deprivationHeat-button").on("click", async (event) => {
|
||||
const roll = M5Roll.deprivationHeat(this.actor);
|
||||
await roll.toMessage();
|
||||
let toggleAutomatedRoll = (event.shiftKey)
|
||||
await roll.toMessage(toggleAutomatedRoll);
|
||||
});
|
||||
|
||||
html.find(".roll-deprivationFood-button").on("click", async (event) => {
|
||||
const roll = M5Roll.deprivationFood(this.actor);
|
||||
await roll.toMessage();
|
||||
let toggleAutomatedRoll = (event.shiftKey)
|
||||
await roll.toMessage(toggleAutomatedRoll);
|
||||
});
|
||||
|
||||
html.find(".roll-defense-button").on("click", async (event) => {
|
||||
const roll = M5Roll.defense(this.actor);
|
||||
await roll.toMessage();
|
||||
let toggleAutomatedRoll = (event.shiftKey)
|
||||
await roll.toMessage(toggleAutomatedRoll);
|
||||
});
|
||||
|
||||
html.find(".roll-resistanceMind-button").on("click", async (event) => {
|
||||
const roll = M5Roll.resistanceMind(this.actor);
|
||||
await roll.toMessage();
|
||||
let toggleAutomatedRoll = (event.shiftKey)
|
||||
await roll.toMessage(toggleAutomatedRoll);
|
||||
});
|
||||
|
||||
html.find(".roll-resistanceBody-button").on("click", async (event) => {
|
||||
const roll = M5Roll.resistanceBody(this.actor);
|
||||
await roll.toMessage();
|
||||
let toggleAutomatedRoll = (event.shiftKey)
|
||||
await roll.toMessage(toggleAutomatedRoll);
|
||||
});
|
||||
|
||||
html.find(".change-equipped").on("click", async (event) => {
|
||||
|
|
|
|||
|
|
@ -13,4 +13,13 @@ export const loadSettings = async function () {
|
|||
default: true,
|
||||
type: Boolean,
|
||||
});
|
||||
(game as Game).settings.register("midgard5", "automatedRoll", {
|
||||
name: "Automatische Würfelwürfe",
|
||||
hint: "Falls aktiv, wird bei Würfelwürfen kein Dialog gezeigt. Das Verhalten kann mit gleichzeitig gedrückter Shift Taste umgekehrt werden.",
|
||||
scope: "world",
|
||||
config: true,
|
||||
default: false,
|
||||
type: Boolean,
|
||||
});
|
||||
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue