Implement the ability to create AE's (closes #177)

This commit is contained in:
Oliver-Akins 2024-04-23 23:17:36 -06:00
parent ec6378092f
commit dbeb511bdc
3 changed files with 12 additions and 1 deletions

View file

@ -115,6 +115,9 @@
"legendaryItem": "Legendary Item", "legendaryItem": "Legendary Item",
"spell": "Spell", "spell": "Spell",
"untyped": "Custom" "untyped": "Custom"
},
"ActiveEffect": {
"base": "Effect"
} }
} }
} }

View file

@ -58,6 +58,14 @@ export class UntypedItemSheet extends GenericItemSheet {
if (!this.isEditable) return; if (!this.isEditable) return;
console.debug(`.dungeon | Adding event listeners for Untyped Item: ${this.item.id}`); console.debug(`.dungeon | Adding event listeners for Untyped Item: ${this.item.id}`);
html.find(`.create-ae`).on(`click`, async () => {
await this.item.createEmbeddedDocuments(
`ActiveEffect`,
[{name: localizer(`dotdungeon.default.name`, { document: `ActiveEffect`, type: `base` })}],
{ renderSheet: true }
);
});
new GenericContextMenu(html, `.effect.panel`, [ new GenericContextMenu(html, `.effect.panel`, [
{ {
name: localizer(`dotdungeon.common.edit`), name: localizer(`dotdungeon.common.edit`),

View file

@ -27,7 +27,7 @@
--}} --}}
</div> </div>
{{/each}} {{/each}}
<button> <button type="button" class="create-ae">
<dd-icon name="ui/plus" var:fill="currentColor"></dd-icon> <dd-icon name="ui/plus" var:fill="currentColor"></dd-icon>
Create Effect Create Effect
</button> </button>