This commit is contained in:
WBHarry 2025-08-07 23:26:42 +02:00 committed by GitHub
parent 5045801475
commit 22283cb506
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 98 additions and 34 deletions

View file

@ -20,8 +20,8 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
class: this.character.system.class?.value ?? {},
subclass: this.character.system.class?.subclass ?? {},
experiences: {
[foundry.utils.randomID()]: { name: '', value: 2 },
[foundry.utils.randomID()]: { name: '', value: 2 }
[foundry.utils.randomID()]: { name: '', value: 2, core: true },
[foundry.utils.randomID()]: { name: '', value: 2, core: true }
},
domainCards: {
[foundry.utils.randomID()]: {},
@ -588,12 +588,21 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
this.setup.class.system.inventory.take.filter(x => x)
);
await this.character.update({
system: {
traits: this.setup.traits,
experiences: this.setup.experiences
}
});
await this.character.update(
{
system: {
traits: this.setup.traits,
experiences: {
...this.setup.experiences,
...Object.keys(this.character.system.experiences).reduce((acc, key) => {
acc[`-=${key}`] = null;
return acc;
}, {})
}
}
},
{ overwrite: true }
);
this.close();
}

View file

@ -289,7 +289,7 @@ export default class DhCharacterLevelUp extends LevelUpBase {
const experience = Object.keys(this.actor.system.experiences).find(
x => x === data
);
return this.actor.system.experiences[experience]?.description ?? '';
return this.actor.system.experiences[experience]?.name ?? '';
});
advancement[choiceKey].push({ data: data, value: checkbox.value });
break;

View file

@ -178,6 +178,13 @@ export default class CharacterSheet extends DHBaseActorSheet {
async _preparePartContext(partId, context, options) {
context = await super._preparePartContext(partId, context, options);
switch (partId) {
case 'header':
const { playerCanEditSheet, levelupAuto } = game.settings.get(
CONFIG.DH.id,
CONFIG.DH.SETTINGS.gameSettings.Automation
);
context.showSettings = game.user.isGM || !levelupAuto || (levelupAuto && playerCanEditSheet);
break;
case 'loadout':
await this._prepareLoadoutContext(context, options);
break;
@ -188,6 +195,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
await this._prepareBiographyContext(context, options);
break;
}
return context;
}

View file

@ -175,7 +175,6 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) {
const newValue = (action.uses.value ?? 0) + (increase ? 1 : -1);
await action.update({ 'uses.value': Math.min(Math.max(newValue, 0), action.uses.max ?? 0) });
this.render();
}
/* -------------------------------------------- */