Small random fixes

This commit is contained in:
WBHarry 2025-07-23 22:27:53 +02:00
parent 6301e575e3
commit 8cdad5172e
3 changed files with 24 additions and 6 deletions

View file

@ -205,7 +205,11 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
_getSetupTabs(tabs) { _getSetupTabs(tabs) {
for (const v of Object.values(tabs)) { for (const v of Object.values(tabs)) {
v.active = this.tabGroups[v.group] ? this.tabGroups[v.group] === v.id : v.active; v.active = this.tabGroups[v.group]
? this.tabGroups[v.group] === v.id
: this.tabGroups.primary !== 'equipment'
? v.active
: false;
v.cssClass = v.active ? 'active' : ''; v.cssClass = v.active ? 'active' : '';
switch (v.id) { switch (v.id) {
@ -242,6 +246,16 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
marker.classList.remove('active'); marker.classList.remove('active');
} }
} }
if (tab === 'equipment') {
this.tabGroups.setup = null;
this.element.querySelector('section[data-group="setup"].active')?.classList?.remove?.('active');
} else {
this.tabGroups.setup = 'domainCards';
this.element
.querySelector('section[data-group="setup"][data-tab="domainCards"]')
?.classList?.add?.('active');
}
} }
} }
@ -256,6 +270,11 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
}); });
} }
async _preFirstRender(_context, _options) {
this.tabGroups.primary = 'setup';
this.tabGroups.setup = 'ancestry';
}
async _prepareContext(_options) { async _prepareContext(_options) {
const context = await super._prepareContext(_options); const context = await super._prepareContext(_options);
context.tabs = this._getTabs(this.constructor.TABS); context.tabs = this._getTabs(this.constructor.TABS);
@ -266,7 +285,7 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
async _preparePartContext(partId, context) { async _preparePartContext(partId, context) {
switch (partId) { switch (partId) {
case 'footer': case 'footer':
context.isLastTab = this.tabGroups.setup === 'domainCards'; context.isLastTab = this.tabGroups.setup === 'domainCards' || this.tabGroups.primary !== 'setup';
switch (this.tabGroups.setup) { switch (this.tabGroups.setup) {
case null: case null:
case 'ancestry': case 'ancestry':

View file

@ -1,7 +1,7 @@
import LevelUpBase from './levelup.mjs'; import LevelUpBase from './levelup.mjs';
import { DhLevelup } from '../../data/levelup.mjs'; import { DhLevelup } from '../../data/levelup.mjs';
import { domains } from '../../config/domainConfig.mjs'; import { domains } from '../../config/domainConfig.mjs';
import { abilities } from '../../config/actorConfig.mjs'; import { abilities, subclassFeatureLabels } from '../../config/actorConfig.mjs';
export default class DhCharacterLevelUp extends LevelUpBase { export default class DhCharacterLevelUp extends LevelUpBase {
constructor(actor) { constructor(actor) {
@ -349,8 +349,8 @@ export default class DhCharacterLevelUp extends LevelUpBase {
if (!acc) acc = {}; if (!acc) acc = {};
acc[traitKey] = { acc[traitKey] = {
label: game.i18n.localize(abilities[traitKey].label), label: game.i18n.localize(abilities[traitKey].label),
old: this.actor.system.traits[traitKey].max, old: this.actor.system.traits[traitKey].value,
new: this.actor.system.traits[traitKey].max + advancement.trait[traitKey] new: this.actor.system.traits[traitKey].value + advancement.trait[traitKey]
}; };
} }
return acc; return acc;

View file

@ -45,7 +45,6 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
flex: 1;
position: relative; position: relative;
cursor: pointer; cursor: pointer;