Action Worflow #1

This commit is contained in:
Dapoolp 2025-08-16 01:22:23 +02:00
parent b3c0344b91
commit 180c4d2a53
6 changed files with 164 additions and 34 deletions

View file

@ -1,7 +1,20 @@
const fields = foundry.data.fields;
export default class MacroField extends fields.DocumentUUIDField {
static order = 100;
constructor(context = {}) {
super({ type: "Macro" }, context);
}
static async execute(config) {
const fixUUID = !this.macro.includes('Macro.') ? `Macro.${this.macro}` : this.macro,
macro = await fromUuid(fixUUID);
try {
if (!macro) throw new Error(`No macro found for the UUID: ${this.macro}.`);
macro.execute();
} catch (error) {
ui.notifications.error(error);
}
}
}