Make attributes rollable using Foundry macros

This commit is contained in:
Oliver 2026-04-28 18:01:58 -06:00
parent 8f67bff2ec
commit 0cd8af77b2
6 changed files with 85 additions and 21 deletions

View file

@ -37,6 +37,7 @@ export class PlayerSheet extends
createEmbeddedItem: this.#createEmbeddedItem,
configureSheet: this.#configureSheet,
toggleExpand: this.#toggleExpand,
executeTrigger: this.#executeTrigger,
},
};
@ -462,5 +463,16 @@ export class PlayerSheet extends
const item = await Item.create(data, { parent: this.actor });
item?.sheet?.render({ force: true });
};
/**
* Executes an embedded item's triggering Macro if it has one attached to it.
*
* @this {PlayerSheet}
*/
static async #executeTrigger(event, target) {
const { itemUuid } = target.closest(`[data-item-uuid]`)?.dataset ?? {};
const item = await fromUuid(itemUuid);
await item?.system.execute?.();
};
// #endregion Actions
};