feat: update base sheet and item sheet classes

This commit is contained in:
Alexander Minges 2025-07-13 15:00:37 +02:00
parent 251cfa100b
commit 6e1b043e4f
Signed by: Athemis
GPG key ID: 31FBDEF92DDB162B
4 changed files with 9 additions and 5 deletions

View file

@ -7,7 +7,7 @@
/** /**
* The base sheet class for DS4 Actor Sheets * The base sheet class for DS4 Actor Sheets
*/ */
export class DS4ActorSheet extends foundry.applications.api.DocumentSheetV2 { export class DS4ActorSheet extends foundry.applications.api.HandlebarsApplicationMixin(foundry.applications.sheets.ActorSheetV2) {
static DEFAULT_OPTIONS = { static DEFAULT_OPTIONS = {
classes: ["sheet", "ds4-actor-sheet", "themed"], classes: ["sheet", "ds4-actor-sheet", "themed"],
tag: "form", tag: "form",
@ -68,6 +68,7 @@ export class DS4ActorSheet extends foundry.applications.api.DocumentSheetV2 {
return templatePath; return templatePath;
} }
/** @override */ /** @override */
async _renderHTML(context) { async _renderHTML(context) {
return await foundry.applications.handlebars.renderTemplate(this.template, context); return await foundry.applications.handlebars.renderTemplate(this.template, context);
@ -78,6 +79,8 @@ export class DS4ActorSheet extends foundry.applications.api.DocumentSheetV2 {
content.innerHTML = result; content.innerHTML = result;
} }
/** @override */ /** @override */
async _prepareContext(options) { async _prepareContext(options) {
const context = await super._prepareContext(options); const context = await super._prepareContext(options);
@ -612,7 +615,8 @@ export class DS4ActorSheet extends foundry.applications.api.DocumentSheetV2 {
* @param {Event} event - The triggering event * @param {Event} event - The triggering event
* @param {HTMLElement} target - The target element * @param {HTMLElement} target - The target element
*/ */
async _onEditImage(event, target) {
async _onEditImage(_event, _target) {
const attr = "img"; const attr = "img";
const current = this.document.img; const current = this.document.img;

View file

@ -7,7 +7,7 @@
/** /**
* The Sheet class for DS4 Items * The Sheet class for DS4 Items
*/ */
export class DS4ItemSheet extends foundry.applications.sheets.ItemSheetV2 { export class DS4ItemSheet extends foundry.applications.api.HandlebarsApplicationMixin(foundry.applications.sheets.ItemSheetV2) {
static DEFAULT_OPTIONS = { static DEFAULT_OPTIONS = {
classes: ["sheet", "ds4-item-sheet", "themed"], classes: ["sheet", "ds4-item-sheet", "themed"],
tag: "form", tag: "form",

View file

@ -491,7 +491,7 @@ export class DS4Actor extends Actor {
}), }),
ok: { ok: {
label: getGame().i18n.localize("DS4.GenericOkButton"), label: getGame().i18n.localize("DS4.GenericOkButton"),
callback: (event, button, dialog) => { callback: (_event, button, _dialog) => {
const selectedAttribute = button.form.elements[attributeIdentifier].value; const selectedAttribute = button.form.elements[attributeIdentifier].value;
if (!isAttribute(selectedAttribute)) { if (!isAttribute(selectedAttribute)) {
throw new Error( throw new Error(

View file

@ -96,7 +96,7 @@ export class DS4Weapon extends DS4Item {
}), }),
ok: { ok: {
label: getGame().i18n.localize("DS4.GenericOkButton"), label: getGame().i18n.localize("DS4.GenericOkButton"),
callback: (event, button, dialog) => { callback: (_event, button, _dialog) => {
const selectedAttackType = button.form.elements[identifier].value; const selectedAttackType = button.form.elements[identifier].value;
if (selectedAttackType !== "melee" && selectedAttackType !== "ranged") { if (selectedAttackType !== "melee" && selectedAttackType !== "ranged") {
throw new Error( throw new Error(