developing experience setting page

This commit is contained in:
moliloo 2025-06-30 21:22:15 -03:00
parent 0c9c37470a
commit ca297b97b1
9 changed files with 55 additions and 15 deletions

View file

@ -29,12 +29,13 @@ export default class AdversarySheet extends DaggerheartSheet(ActorSheetV2) {
sidebar: { template: 'systems/daggerheart/templates/sheets/actors/adversary/sidebar.hbs' },
header: { template: 'systems/daggerheart/templates/sheets/actors/adversary/header.hbs' },
features: { template: 'systems/daggerheart/templates/sheets/actors/adversary/features.hbs' },
notes: { template: 'systems/daggerheart/templates/sheets/actors/adversary/notes.hbs' },
effects: { template: 'systems/daggerheart/templates/sheets/actors/adversary/effects.hbs' }
};
static TABS = {
features: {
active: false,
active: true,
cssClass: '',
group: 'primary',
id: 'features',

View file

@ -23,7 +23,10 @@ export default class DHAdversarySettings extends HandlebarsApplicationMixin(Appl
resizable: false
},
position: { width: 455, height: 'auto' },
actions: {},
actions: {
addExperience: this.addExperience,
removeExperience: this.removeExperience
},
form: {
handler: this.updateForm,
submitOnChange: true,
@ -111,6 +114,22 @@ export default class DHAdversarySettings extends HandlebarsApplicationMixin(Appl
return tabs;
}
static async addExperience() {
const newExperience = {
name: 'Experience',
modifier: 0
};
await this.actor.update({ [`system.experiences.${foundry.utils.randomID()}`]: newExperience });
}
static async removeExperience() {
const newExperience = {
name: 'Experience',
modifier: 0
};
await this.actor.update({ [`system.experiences.${foundry.utils.randomID()}`]: newExperience });
}
static async updateForm(event, _, formData) {
await this.actor.update(formData.object);
this.render();