[Feature] Manual Character Editing (#490)

* Initial

* Added Character-Settings

* Finalized Character-Settings

* Hide CharacterSetup if any part is done manually

* Fixed class/subclass drag-drop

* Fixed relinking of Features from items created on Character

* Adding features on CharacterItems now adds them on the Character and relinks

* Made suggested items inactive in the Class sheet if rendered from inside a Character

* Added hope to CharacterSetting

* add style to textarea element, add spellcasting and domain class into char sheet and move rest buttons to another place

* Fixed characterCreation experience description

---------

Co-authored-by: moliloo <dev.murilobrito@gmail.com>
This commit is contained in:
WBHarry 2025-08-01 17:16:35 +02:00 committed by GitHub
parent 263dfa69ae
commit e1d8f8784a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
49 changed files with 1205 additions and 386 deletions

View file

@ -5,6 +5,7 @@ export { default as DamageReductionDialog } from './damageReductionDialog.mjs';
export { default as DamageSelectionDialog } from './damageSelectionDialog.mjs';
export { default as DeathMove } from './deathMove.mjs';
export { default as Downtime } from './downtime.mjs';
export { default as MulticlassChoiceDialog } from './multiclassChoiceDialog.mjs';
export { default as OwnershipSelection } from './ownershipSelection.mjs';
export { default as ResourceDiceDialog } from './resourceDiceDialog.mjs';
export { default as ActionSelectionDialog } from './actionSelectionDialog.mjs';

View file

@ -0,0 +1,73 @@
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
export default class MulticlassChoiceDialog extends HandlebarsApplicationMixin(ApplicationV2) {
constructor(actor, multiclass, options) {
super(options);
this.actor = actor;
this.multiclass = multiclass;
this.selectedDomain = null;
}
get title() {
return game.i18n.format('DAGGERHEART.APPLICATIONS.MulticlassChoice.title', { actor: this.actor.name });
}
static DEFAULT_OPTIONS = {
classes: ['daggerheart', 'dh-style', 'dialog', 'views', 'multiclass-choice'],
position: { width: 'auto', height: 'auto' },
window: { icon: 'fa-solid fa-person-rays' },
actions: {
save: MulticlassChoiceDialog.#save,
selectDomain: MulticlassChoiceDialog.#selectDomain
}
};
static PARTS = {
application: {
id: 'multiclass-choice',
template: 'systems/daggerheart/templates/dialogs/multiclassChoice.hbs'
}
};
async _prepareContext(_options) {
const context = await super._prepareContext(_options);
context.multiclass = this.multiclass;
context.domainChoices = this.multiclass.domains.map(value => {
const domain = CONFIG.DH.DOMAIN.domains[value];
return {
value: value,
label: game.i18n.localize(domain.label),
description: game.i18n.localize(domain.description),
src: domain.src,
selected: value === this.selectedDomain,
disabled: this.actor.system.domains.includes(value)
};
});
context.multiclassDisabled = !this.selectedDomain;
return context;
}
/** @override */
_onClose(options = {}) {
if (!options.submitted) this.move = null;
}
static async configure(actor, multiclass, options = {}) {
return new Promise(resolve => {
const app = new this(actor, multiclass, options);
app.addEventListener('close', () => resolve(app.selectedDomain), { once: true });
app.render({ force: true });
});
}
static #save() {
this.close({ submitted: true });
}
static #selectDomain(_event, button) {
this.selectedDomain = this.selectedDomain === button.dataset.domain ? null : button.dataset.domain;
this.render();
}
}