Merge branch 'main' into feature/death-moves

This commit is contained in:
Chris Ryan 2025-11-27 20:34:34 +10:00
commit 916675fa43
6 changed files with 60 additions and 0 deletions

View file

@ -65,6 +65,7 @@ CONFIG.ui.combat = applications.ui.DhCombatTracker;
CONFIG.ui.chat = applications.ui.DhChatLog; CONFIG.ui.chat = applications.ui.DhChatLog;
CONFIG.ui.hotbar = applications.ui.DhHotbar; CONFIG.ui.hotbar = applications.ui.DhHotbar;
CONFIG.ui.sidebar = applications.sidebar.DhSidebar; CONFIG.ui.sidebar = applications.sidebar.DhSidebar;
CONFIG.ui.actors = applications.sidebar.DhActorDirectory;
CONFIG.ui.daggerheartMenu = applications.sidebar.DaggerheartMenu; CONFIG.ui.daggerheartMenu = applications.sidebar.DaggerheartMenu;
CONFIG.ui.resources = applications.ui.DhFearTracker; CONFIG.ui.resources = applications.ui.DhFearTracker;
CONFIG.ui.countdowns = applications.ui.DhCountdowns; CONFIG.ui.countdowns = applications.ui.DhCountdowns;

View file

@ -2702,6 +2702,12 @@
"documentIsMissing": "The {documentType} is missing from the world." "documentIsMissing": "The {documentType} is missing from the world."
}, },
"Sidebar": { "Sidebar": {
"actorDirectory": {
"tier": "Tier {tier} {type}",
"character": "Level {level} Character",
"companion": "Level {level} - {partner}",
"companionNoPartner": "No Partner"
},
"daggerheartMenu": { "daggerheartMenu": {
"title": "Daggerheart Menu", "title": "Daggerheart Menu",
"startSession": "Start Session", "startSession": "Start Session",

View file

@ -1,2 +1,3 @@
export { default as DaggerheartMenu } from './tabs/daggerheartMenu.mjs'; export { default as DaggerheartMenu } from './tabs/daggerheartMenu.mjs';
export { default as DhActorDirectory } from './tabs/actorDirectory.mjs';
export { default as DhSidebar } from './sidebar.mjs'; export { default as DhSidebar } from './sidebar.mjs';

View file

@ -0,0 +1,20 @@
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;
};
}
}

View file

@ -13,3 +13,16 @@
} }
} }
} }
.actors-sidebar {
.directory-item.actor .entry-name:has(.entry-subtitle) {
display: flex;
flex-direction: column;
line-height: 1rem;
padding-top: 0.125rem;
.entry-subtitle {
color: var(--color-text-subtle);
font-size: var(--font-size-12);
}
}
}

View file

@ -0,0 +1,19 @@
<li class="directory-item entry document {{@root.documentCls}} flexrow" data-entry-id="{{id}}">
{{#if thumbnail}}
<img class="thumbnail" src="{{thumbnail}}" alt="{{name}}" loading="lazy">
{{/if}}
<a class="entry-name ellipsis" data-action="activateEntry">
<span>{{name}}</span>
{{#if (or (eq type "adversary") (eq type "environment"))}}
<span class="entry-subtitle">{{localize "DAGGERHEART.UI.Sidebar.actorDirectory.tier" tier=system.tier type=(@root.getTypeLabel this)}}</span>
{{else if (eq type "character")}}
<span class="entry-subtitle">{{localize "DAGGERHEART.UI.Sidebar.actorDirectory.character" level=system.levelData.level.current}}</span>
{{else if (eq type "companion")}}
{{#if system.partner}}
<span class="entry-subtitle">{{localize "DAGGERHEART.UI.Sidebar.actorDirectory.companion" level=system.levelData.level.current partner=system.partner.name}}</span>
{{else}}
<span class="entry-subtitle">{{localize "DAGGERHEART.UI.Sidebar.actorDirectory.companionNoPartner"}}</span>
{{/if}}
{{/if}}
</a>
</li>