diff --git a/src/main.mjs b/src/main.mjs index e4f238d..d4f4987 100644 --- a/src/main.mjs +++ b/src/main.mjs @@ -5,7 +5,9 @@ const { loadTemplates, renderTemplate } = foundry.applicat const { ActorSheetV2, ItemSheetV2 } = foundry.applications.sheets; const { Notifications } = foundry.applications.ui; const { SchemaField, NumberField, StringField, BooleanField } = foundry.data.fields; +const { Roll } = foundry.dice; const { OperatorTerm, NumericTerm } = foundry.dice.terms; +const { ChatMessage } = foundry.documents; Hooks.once("i18nInit", async function() { const lang = game.i18n.lang; @@ -151,8 +153,8 @@ class DSA41_ChatMessage extends ChatMessage { const sender = html.querySelector(".message-sender"); sender?.replaceChildren(header); - if (this.flags.type === "trefferpunkte" && this.flags.targets.length != 0) { - const targets = this.flags.targets.map(x => fromUuidSync(x, { strict: false })).filter(x => x !== null); + if (this.flags.dsa41.type === "trefferpunkte" && this.flags.dsa41.targets.length != 0) { + const targets = this.flags.dsa41.targets.map(x => fromUuidSync(x, { strict: false })).filter(x => x !== null); const targets_list = await instantiateTemplate("TrefferpunkteTargets", targets); html.querySelector(".message-content")?.appendChild(targets_list); @@ -891,8 +893,10 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) { speaker: ChatMessage.getSpeaker({ actor: this.document }), flavor: flavor, flags: { - type: roll_type, - targets: get_targeted_actors(), + dsa41: { + type: roll_type, + targets: get_targeted_actors(), + } }, }); @@ -968,8 +972,10 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) { speaker: ChatMessage.getSpeaker({ actor: this.document }), flavor: flavor, flags: { - type: roll_type, - targets: get_targeted_actors(), + dsa41: { + type: roll_type, + targets: get_targeted_actors(), + } }, }); @@ -995,8 +1001,10 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) { speaker: ChatMessage.getSpeaker({ actor: this.document }), flavor: flavor, flags: { - type: roll_type, - targets: get_targeted_actors(), + dsa41: { + type: roll_type, + targets: get_targeted_actors(), + } }, }); @@ -1017,8 +1025,10 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) { speaker: ChatMessage.getSpeaker({ actor: this.document }), flavor: flavor, flags: { - type: roll_type, - targets: get_targeted_actors(), + dsa41: { + type: roll_type, + targets: get_targeted_actors(), + } }, }); @@ -1039,8 +1049,10 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) { speaker: ChatMessage.getSpeaker({ actor: this.document }), flavor: game.i18n.localize("DSA41.roll_types." + roll_type), flags: { - type: roll_type, - targets: get_targeted_actors(), + dsa41: { + type: roll_type, + targets: get_targeted_actors(), + } }, }); @@ -1061,8 +1073,10 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) { speaker: ChatMessage.getSpeaker({ actor: this.document }), flavor: game.i18n.localize("DSA41.roll_types." + roll_type), flags: { - type: roll_type, - targets: get_targeted_actors(), + dsa41: { + type: roll_type, + targets: get_targeted_actors(), + } }, }); @@ -1074,8 +1088,10 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) { speaker: ChatMessage.getSpeaker({ actor: this.document }), flavor: flavor, flags: { - type: roll_type, - targets: get_targeted_actors(), + dsa41: { + type: roll_type, + targets: get_targeted_actors(), + } }, }); },