Fixed so custom domains can be selected in levelup when multiclassing

This commit is contained in:
WBHarry 2025-08-10 18:21:54 +02:00
parent 6c258c6853
commit e64a6593dc
5 changed files with 19 additions and 20 deletions

View file

@ -351,6 +351,17 @@ export default class DhCharacter extends BaseDataActor {
return [...classDomains, ...multiclassDomains]; return [...classDomains, ...multiclassDomains];
} }
get domainData() {
const allDomainData = CONFIG.DH.DOMAIN.allDomains();
return this.domains.map(key => {
const domain = allDomainData[key];
return {
...domain,
label: game.i18n.localize(domain.label)
};
});
}
get domainCards() { get domainCards() {
const domainCards = this.parent.items.filter(x => x.type === 'domainCard'); const domainCards = this.parent.items.filter(x => x.type === 'domainCard');
const loadout = domainCards.filter(x => !x.system.inVault); const loadout = domainCards.filter(x => !x.system.inVault);

View file

@ -60,17 +60,6 @@ export default class DHClass extends BaseDataItem {
/* -------------------------------------------- */ /* -------------------------------------------- */
get domainData() {
const allDomainData = CONFIG.DH.DOMAIN.allDomains();
return this.domains.map(key => {
const domain = allDomainData[key];
return {
...domain,
label: game.i18n.localize(domain.label)
};
});
}
get hopeFeatures() { get hopeFeatures() {
return this.features.filter(x => x.type === CONFIG.DH.ITEM.featureSubTypes.hope).map(x => x.item); return this.features.filter(x => x.type === CONFIG.DH.ITEM.featureSubTypes.hope).map(x => x.item);
} }

View file

@ -51,7 +51,7 @@ export default class DHSubclass extends BaseDataItem {
async _preCreate(data, options, user) { async _preCreate(data, options, user) {
if (this.actor?.type === 'character') { if (this.actor?.type === 'character') {
const dataUuid = const dataUuid =
data.uuid ?? data._stats?.compendiumSource ?? `Compendium.daggerheart.subclasses.Item.${data._id}`; (data.uuid ?? data.folder) ? `Compendium.daggerheart.subclasses.Item.${data._id}` : `Item.${data._id}`;
if (this.actor.system.class.subclass) { if (this.actor.system.class.subclass) {
if (this.actor.system.multiclass.subclass) { if (this.actor.system.multiclass.subclass) {
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.subclassesAlreadyPresent')); ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.subclassesAlreadyPresent'));

View file

@ -85,13 +85,12 @@ export const chunkify = (array, chunkSize, mappingFunc) => {
export const tagifyElement = (element, baseOptions, onChange, tagifyOptions = {}) => { export const tagifyElement = (element, baseOptions, onChange, tagifyOptions = {}) => {
const { maxTags } = tagifyOptions; const { maxTags } = tagifyOptions;
const options = const options = Array.isArray(baseOptions)
typeof baseOptions === 'object' ? baseOptions
? Object.keys(baseOptions).map(optionKey => ({ : Object.keys(baseOptions).map(optionKey => ({
...baseOptions[optionKey], ...baseOptions[optionKey],
id: optionKey id: optionKey
})) }));
: baseOptions;
const tagifyElement = new Tagify(element, { const tagifyElement = new Tagify(element, {
tagTextProp: 'name', tagTextProp: 'name',

View file

@ -87,7 +87,7 @@
</div> </div>
{{#if document.system.class.value}} {{#if document.system.class.value}}
<div class="domains-section"> <div class="domains-section">
{{#each document.system.class.value.system.domainData as |data|}} {{#each document.system.domainData as |data|}}
<div class="domain"> <div class="domain">
<img src="{{data.src}}" alt="" data-tooltip="{{data.label}}" /> <img src="{{data.src}}" alt="" data-tooltip="{{data.label}}" />
</div> </div>