mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 11:41:08 +01:00
* 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
20 lines
996 B
JavaScript
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;
|
|
};
|
|
}
|
|
}
|