Attached CharacterCreate and Levelup functionality to the sheet

This commit is contained in:
WBHarry 2025-06-25 15:45:18 +02:00
parent 7f898bb983
commit 4f6c87a524
10 changed files with 208 additions and 57 deletions

View file

@ -5,7 +5,7 @@ import AncestrySelectionDialog from '../ancestrySelectionDialog.mjs';
import DaggerheartSheet from './daggerheart-sheet.mjs';
import { abilities } from '../../config/actorConfig.mjs';
import DhlevelUp from '../levelup.mjs';
import DHDualityRoll from '../../data/chat-message/dualityRoll.mjs';
import DhCharacterCreation from '../characterCreation.mjs';
const { ActorSheetV2 } = foundry.applications.sheets;
const { TextEditor } = foundry.applications.ux;
@ -47,6 +47,7 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
useAdvancementCard: this.useAdvancementCard,
useAdvancementAbility: this.useAdvancementAbility,
toggleEquipItem: this.toggleEquipItem,
characterSetup: this.characterSetup,
levelup: this.openLevelUp,
editImage: this._onEditImage
},
@ -217,7 +218,7 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
_attachPartListeners(partId, htmlElement, options) {
super._attachPartListeners(partId, htmlElement, options);
// htmlElement.querySelector('.level-value').addEventListener('change', this.onLevelChange.bind(this));
htmlElement.querySelector('.level-value')?.addEventListener('change', this.onLevelChange.bind(this));
// To Remove when ContextMenu Handler is made
htmlElement
.querySelectorAll('[data-item-id]')
@ -457,6 +458,10 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
}
}
static characterSetup() {
new DhCharacterCreation(this.document).render(true);
}
static openLevelUp() {
if (!this.document.system.class.value || !this.document.system.class.subclass) {
ui.notifications.error(game.i18n.localize('DAGGERHEART.Sheets.PC.Errors.missingClassOrSubclass'));