Files
DeltaGreen/module/applications/edit-stats.js
T
Aaron Lutomski b83543fcb0 Implemented Active Effects.
Used AE to implement exhaustion, stimulants, and rest.
2026-06-21 13:44:54 -07:00

47 lines
1.1 KiB
JavaScript

import DG, { BASE_TEMPLATE_PATH } from "../config.js";
export default class ActorEditStatForm extends foundry.applications.api.HandlebarsApplicationMixin(
foundry.applications.api.ApplicationV2,
) {
constructor(params) {
super();
this.actor = params.actor;
}
/** @override */
static DEFAULT_OPTIONS = {
tag: "form",
classes: [DG.ID, "edit-stat-form"],
window: { title: "Edit statistics form", resizable: true },
position: { width: 400, height: 200 },
actions: {},
form: {
handler: this.formHandler,
submitOnChange: true,
closeOnSubmit: false,
},
};
static PARTS = /** @type {const} */ ({
stats: {
template: `${BASE_TEMPLATE_PATH}/actor/edit-stats.html`,
},
});
/** @override */
async _prepareContext(options) {
return {
...(await super._prepareContext(options)),
actor: this.actor,
sourceStatistics:
this.actor._source?.system?.statistics ?? this.actor.system.statistics,
};
}
static async formHandler(event, form, formData) {
const data = formData.object;
await this.actor.update(data);
}
}