diff --git a/src/module/actor/sheets/actor-sheet.ts b/src/module/actor/sheets/actor-sheet.ts index 373f755f..fed07c40 100644 --- a/src/module/actor/sheets/actor-sheet.ts +++ b/src/module/actor/sheets/actor-sheet.ts @@ -131,6 +131,7 @@ export class DS4ActorSheet extends ActorSheet this.render(false)); } + protected onChangeEffect(event: JQuery.ChangeEvent): void { + event.preventDefault(); + const currentTarget = $(event.currentTarget); + const element: HTMLFormElement = currentTarget.get(0); + const id = currentTarget.parents(".effect").data("effectId"); + const property: string | undefined = currentTarget.data("property"); + const inverted = Boolean(currentTarget.data("inverted")); + + if (element.disabled || element.getAttribute("disabled")) return; + if (property === undefined) { + throw TypeError("HTML element does not provide 'data-property' attribute"); + } + const newValue = this.getValue(element, inverted); + this.actor.updateEmbeddedDocuments("ActiveEffect", [{ _id: id, [property]: newValue }]); + } + /** * Handle clickable item rolls. * @param event - The originating click event diff --git a/src/templates/sheets/actor/components/effect-list-entry.hbs b/src/templates/sheets/actor/components/effect-list-entry.hbs index e43b832a..4d7243eb 100644 --- a/src/templates/sheets/actor/components/effect-list-entry.hbs +++ b/src/templates/sheets/actor/components/effect-list-entry.hbs @@ -11,8 +11,8 @@ SPDX-License-Identifier: MIT --}}
  • {{!-- enabled --}} - {{!-- icon --}}