mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 11:41:08 +01:00
16 lines
557 B
JavaScript
16 lines
557 B
JavaScript
import DHBaseAction from './baseAction.mjs';
|
|
|
|
export default class DHMacroAction extends DHBaseAction {
|
|
static extraSchemas = [...super.extraSchemas, 'macro'];
|
|
|
|
async trigger(event, ...args) {
|
|
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);
|
|
}
|
|
}
|
|
}
|