[Fix] Levelup Fixes (#787)

* Fixed crash on experience selection. Fixed subclass error on multiclassing

* Fixed so multiclasses do not gain the hope feature for the class

* Fixed so Class/Subclass features are properly deleted on delevel

* Removed automatic deletion of features on delevel when not using levelup auto

* Fixed so custom domains can be selected in levelup when multiclassing
This commit is contained in:
WBHarry 2025-08-10 20:19:37 +02:00 committed by GitHub
parent f81d0d250f
commit b470a1dc51
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 102 additions and 88 deletions

View file

@ -351,6 +351,17 @@ export default class DhCharacter extends BaseDataActor {
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() {
const domainCards = this.parent.items.filter(x => x.type === 'domainCard');
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() {
return this.features.filter(x => x.type === CONFIG.DH.ITEM.featureSubTypes.hope).map(x => x.item);
}

View file

@ -21,7 +21,7 @@ export default class DHSubclass extends BaseDataItem {
integer: false,
nullable: true,
initial: null,
label: "DAGGERHEART.ITEMS.Subclass.spellcastingTrait"
label: 'DAGGERHEART.ITEMS.Subclass.spellcastingTrait'
}),
features: new ItemLinkFields(),
featureState: new fields.NumberField({ required: true, initial: 1, min: 1 }),
@ -50,7 +50,8 @@ export default class DHSubclass extends BaseDataItem {
async _preCreate(data, options, user) {
if (this.actor?.type === 'character') {
const dataUuid = data.uuid ?? data._stats?.compendiumSource ?? `Item.${data._id}`;
const dataUuid =
(data.uuid ?? data.folder) ? `Compendium.daggerheart.subclasses.Item.${data._id}` : `Item.${data._id}`;
if (this.actor.system.class.subclass) {
if (this.actor.system.multiclass.subclass) {
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.subclassesAlreadyPresent'));