daggerheart/module/applications/sheets/actors/companion.mjs
WBHarry 3489c9c2e8
[Feature] 648 - Mark Defeated Actors (#914)
* Improved death marking styling

* Added automation for defeated status

* Fixed so the tracker recognises and sets the correct defeated statuses depending on type

* Fixed so missing statuses doesn't cause crashes

* Increased companion sheet width by 40 pixels

* Added missing inheritDoc

* Removed fas
2025-08-13 19:39:19 +02:00

52 lines
1.7 KiB
JavaScript

import DhCompanionLevelUp from '../../levelup/companionLevelup.mjs';
import DHBaseActorSheet from '../api/base-actor.mjs';
/**@typedef {import('@client/applications/_types.mjs').ApplicationClickAction} ApplicationClickAction */
export default class DhCompanionSheet extends DHBaseActorSheet {
static DEFAULT_OPTIONS = {
classes: ['actor', 'companion'],
position: { width: 340 },
actions: {
levelManagement: DhCompanionSheet.#levelManagement
}
};
static PARTS = {
header: { template: 'systems/daggerheart/templates/sheets/actors/companion/header.hbs' },
details: { template: 'systems/daggerheart/templates/sheets/actors/companion/details.hbs' },
effects: { template: 'systems/daggerheart/templates/sheets/actors/companion/effects.hbs' }
};
/* -------------------------------------------- */
/** @inheritdoc */
static TABS = {
primary: {
tabs: [{ id: 'details' }, { id: 'effects' }],
initial: 'details',
labelPrefix: 'DAGGERHEART.GENERAL.Tabs'
}
};
/** @inheritDoc */
async _onRender(context, options) {
await super._onRender(context, options);
this.element
.querySelector('.level-value')
?.addEventListener('change', event => this.document.updateLevel(Number(event.currentTarget.value)));
}
/* -------------------------------------------- */
/* Application Clicks Actions */
/* -------------------------------------------- */
/**
* Opens the companions level management window.
* @type {ApplicationClickAction}
*/
static #levelManagement() {
new DhCompanionLevelUp(this.document).render({ force: true });
}
}