Compare commits

...

2 commits

Author SHA1 Message Date
WBHarry
05167b697a Improved missing class visual for subclass 2026-05-03 20:29:03 +02:00
WBHarry
09a6b1480f Fixed the class name display in the subclass view 2026-05-03 19:13:48 +02:00
6 changed files with 27 additions and 13 deletions

View file

@ -44,9 +44,9 @@ export default class SubclassSheet extends DHBaseItemSheet {
async _prepareContext(options) {
const context = await super._prepareContext(options);
if (this.document.system.linkedClass) {
context.class = (await fromUuid(this.document.system.linkedClass)) ?? {
const classData = await fromUuid(this.document.system.linkedClass);
context.class = classData ?? {
name: _loc('DAGGERHEART.GENERAL.missingX', { x: _loc('TYPES.Item.class') }),
img: 'systems/daggerheart/assets/icons/documents/items/laurel-crown.svg',
missing: true
};
}

View file

@ -357,7 +357,7 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
async _createFieldFilter() {
const filters = ItemBrowser.getFolderConfig(this.selectedMenu.data, 'filters');
for(const f of filters) {
for (const f of filters) {
if (typeof f.field === 'string') f.field = foundry.utils.getProperty(game, f.field);
else if (typeof f.choices === 'function') {
f.choices = await f.choices(this.items);

View file

@ -383,7 +383,8 @@ export const typeConfig = {
{
key: 'system.linkedClass',
label: 'TYPES.Item.class',
format: linkedClass => linkedClass?.name ?? 'DAGGERHEART.UI.ItemBrowser.missing'
format: linkedClass =>
foundry.utils.fromUuidSync(linkedClass)?.name ?? 'DAGGERHEART.UI.ItemBrowser.missing'
},
{
key: 'system.spellcastingTrait',
@ -397,7 +398,7 @@ export const typeConfig = {
label: 'TYPES.Item.class',
choices: async items => {
const list = [];
for(const item of items.filter(item => item.system.linkedClass)) {
for (const item of items.filter(item => item.system.linkedClass)) {
const linkedClass = await foundry.utils.fromUuid(item.system.linkedClass);
list.push({
value: linkedClass.uuid,

View file

@ -35,6 +35,14 @@
border-radius: 6px;
border: none;
}
.image-icon {
font-size: 26px;
width: 40px;
height: 40px;
display: flex;
justify-content: center;
align-items: center;
}
.controls {
display: flex;
justify-content: center;

View file

@ -1,8 +1,10 @@
<div class="item-description-outer-container">
{{#if spellcastTrait}}
<div class="item-description-container">
<h4>{{localize "DAGGERHEART.ITEMS.Subclass.spellcastTrait"}}</h4>
<span>{{spellcastTrait}}</span>
</div>
{{/if}}
<div class="item-description-container">
<h4>{{localize "DAGGERHEART.ITEMS.Subclass.foundationFeatures"}}</h4>
{{#each foundationFeatures as | feature |}}

View file

@ -8,9 +8,12 @@
{{#if class}}
<div class="feature-list">
<li class="feature-line">
{{#if class.missing}}
<i class="fa-solid fa-link-slash hint image-icon" inert></i>
<span class="hint">{{class.name}}</span>
{{else}}
<img class="image" src="{{class.img}}" />
<span>{{class.name}} {{#if class.missing}}<i class="fa-solid fa-link-slash" inert></i>{{/if}}</span>
{{#unless class.missing}}
<span>{{class.name}}</span>
<div class='controls'>
<a
class='effect-control'
@ -21,7 +24,7 @@
<i class="fa-solid fa-globe" inert></i>
</a>
</div>
{{/unless}}
{{/if}}
</li>
</div>
{{else}}