[Fix] Improve Class-Subclass Linkage (#1846)
Some checks failed
Project CI / build (24.x) (push) Has been cancelled

* Initial thoughts

* .

* Fixed linting

* Continue work on updating identifier

* Change to uuid approach

* Localization and minor fix

* Fixed CompendiumBrowser Class filter for Subclass view

* Fixed the class name display in the subclass view

* Improved missing class visual for subclass

* Fixed character creation

* Rerender class sheets when subclass link is changed

* Use compendium source over actual uuid in search

---------

Co-authored-by: Carlos Fernandez <cfern1990@gmail.com>
This commit is contained in:
WBHarry 2026-05-05 22:15:21 +02:00 committed by GitHub
parent fb5e3672dc
commit b7bc452bf5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 167 additions and 84 deletions

View file

@ -439,10 +439,13 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
'system.domain': { key: 'system.domain', value: this.setup.class?.system.domains ?? null }
};
if (type === 'subclasses')
if (type === 'subclasses') {
const classItem = this.setup.class;
const uuid = classItem?._stats.compendiumSource ?? classItem?.uuid;
presets.filter = {
'system.linkedClass.uuid': { key: 'system.linkedClass.uuid', value: this.setup.class?.uuid }
'system.linkedClass': { key: 'system.linkedClass', value: uuid }
};
}
if (equipment.includes(type))
presets.filter = {
@ -610,7 +613,8 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
[foundry.utils.randomID()]: {}
};
} else if (item.type === 'subclass' && event.target.closest('.subclass-card')) {
if (this.setup.class.system.subclasses.every(subclass => subclass.uuid !== item.uuid)) {
const classSubclasses = await this.setup.class.system.fetchSubclasses();
if (classSubclasses.every(subclass => subclass.uuid !== item.uuid)) {
ui.notifications.error(game.i18n.localize('DAGGERHEART.UI.Notifications.subclassNotInClass'));
return;
}