Add the ability to automate items and attributes using a Macro

This commit is contained in:
Oliver 2026-04-27 00:51:31 -06:00
parent 47892d116b
commit 8f67bff2ec
8 changed files with 45 additions and 2 deletions

View file

@ -68,7 +68,8 @@
"weight": "Weight", "weight": "Weight",
"quantity": "Quantity", "quantity": "Quantity",
"equipped": "Equipped", "equipped": "Equipped",
"group": "Group" "group": "Group",
"trigger": "Macro to Execute"
}, },
"attribute": { "attribute": {
"key": { "key": {

View file

@ -18,7 +18,7 @@ export class GenericItemSheet extends
], ],
position: { position: {
width: 400, width: 400,
height: 450, height: 550,
}, },
window: { window: {
resizable: true, resizable: true,

View file

@ -23,6 +23,11 @@ export class AttributeItemData extends foundry.abstract.TypeDataModel {
aboveTheFold: new fields.BooleanField({ aboveTheFold: new fields.BooleanField({
initial: false, initial: false,
}), }),
trigger: new fields.DocumentUUIDField({
embedded: false,
relative: false,
type: foundry.documents.Macro.documentName,
}),
/* The attributes current value */ /* The attributes current value */
value: new fields.NumberField({ value: new fields.NumberField({

View file

@ -22,6 +22,11 @@ export class GenericItemData extends foundry.abstract.TypeDataModel {
equipped: new fields.BooleanField({ equipped: new fields.BooleanField({
initial: true, initial: true,
}), }),
trigger: new fields.DocumentUUIDField({
embedded: false,
relative: false,
type: foundry.documents.Macro.documentName,
}),
description: new fields.HTMLField({ description: new fields.HTMLField({
blank: true, blank: true,
trim: true, trim: true,

View file

@ -30,6 +30,10 @@
gap: 2px 8px; gap: 2px 8px;
margin: 0 8px 8px; margin: 0 8px 8px;
&.wide-input {
grid-template-columns: 1fr 1fr;
}
.hint { .hint {
grid-column: 1 / -1; grid-column: 1 / -1;
margin: 0; margin: 0;

View file

@ -33,6 +33,10 @@
justify-items: left; justify-items: left;
gap: 8px; gap: 8px;
&.wide-input {
grid-template-columns: 1fr 1fr;
}
taf-toggle { taf-toggle {
justify-self: end; justify-self: end;
} }

View file

@ -36,4 +36,16 @@
> >
</div> </div>
{{/if}} {{/if}}
<div class="property wide-input">
<label for="{{meta.idp}}-trigger">
{{ localize "taf.misc.item.trigger" }}
</label>
<document-tags
id="{{meta.idp}}-trigger"
single
type="Macro"
name="system.trigger"
value="{{system.trigger}}"
></document-tags>
</div>
</div> </div>

View file

@ -33,6 +33,18 @@
{{checked system.equipped}} {{checked system.equipped}}
></taf-toggle> ></taf-toggle>
</div> </div>
<div class="property wide-input">
<label for="{{meta.idp}}-trigger">
{{ localize "taf.misc.item.trigger" }}
</label>
<document-tags
id="{{meta.idp}}-trigger"
single
type="Macro"
name="system.trigger"
value="{{system.trigger}}"
></document-tags>
</div>
<div class="bordered description"> <div class="bordered description">
{{#if meta.editable}} {{#if meta.editable}}
<prose-mirror <prose-mirror