daggerheart/module/applications/sidebar/tabs/actorDirectory.mjs
Carlos Fernandez 630ba5ab7d
[Feature] Actor Directory subtitles (#1332)
* Show subtitles for various actor types in actor directory

* Show adversary and environment type

* Update companion subtitles

* Fallback adversay and environment label to item type label
2025-11-27 00:38:11 -03:00

20 lines
996 B
JavaScript

export default class DhActorDirectory extends foundry.applications.sidebar.tabs.ActorDirectory {
static DEFAULT_OPTIONS = {
renderUpdateKeys: ['system.levelData.level.current', 'system.partner', 'system.tier']
};
static _entryPartial = 'systems/daggerheart/templates/ui/sidebar/actor-document-partial.hbs';
async _prepareDirectoryContext(context, options) {
await super._prepareDirectoryContext(context, options);
const adversaryTypes = CONFIG.DH.ACTOR.allAdversaryTypes();
const environmentTypes = CONFIG.DH.ACTOR.environmentTypes;
context.getTypeLabel = document => {
return document.type === 'adversary'
? game.i18n.localize(adversaryTypes[document.system.type]?.label ?? 'TYPES.Actor.adversary')
: document.type === 'environment'
? game.i18n.localize(environmentTypes[document.system.type]?.label ?? 'TYPES.Actor.environment')
: null;
};
}
}