Character creation fix and levelup style fixes

This commit is contained in:
WBHarry 2025-08-06 21:58:11 +02:00
parent bcedc74bf3
commit a57de1c9c3
8 changed files with 44 additions and 21 deletions

View file

@ -1,6 +1,6 @@
import { abilities } from '../../config/actorConfig.mjs'; import { abilities } from '../../config/actorConfig.mjs';
import { burden } from '../../config/generalConfig.mjs'; import { burden } from '../../config/generalConfig.mjs';
import { createEmbeddedItemWithEffects } from '../../helpers/utils.mjs'; import { createEmbeddedItemsWithEffects, createEmbeddedItemWithEffects } from '../../helpers/utils.mjs';
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api; const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
@ -555,13 +555,7 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
await createEmbeddedItemWithEffects(this.character, this.setup.community); await createEmbeddedItemWithEffects(this.character, this.setup.community);
await createEmbeddedItemWithEffects(this.character, this.setup.class); await createEmbeddedItemWithEffects(this.character, this.setup.class);
await createEmbeddedItemWithEffects(this.character, this.setup.subclass); await createEmbeddedItemWithEffects(this.character, this.setup.subclass);
await this.character.createEmbeddedDocuments( await createEmbeddedItemsWithEffects(this.character, Object.values(this.setup.domainCards));
'Item',
Object.values(this.setup.domainCards).map(x => ({
...x,
effects: x.effects?.map(effect => effect.toObject())
}))
);
if (this.equipment.armor.uuid) if (this.equipment.armor.uuid)
await createEmbeddedItemWithEffects(this.character, this.equipment.armor, { await createEmbeddedItemWithEffects(this.character, this.equipment.armor, {
@ -583,14 +577,9 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
if (this.equipment.inventory.choiceB.uuid) if (this.equipment.inventory.choiceB.uuid)
await createEmbeddedItemWithEffects(this.character, this.equipment.inventory.choiceB); await createEmbeddedItemWithEffects(this.character, this.equipment.inventory.choiceB);
await this.character.createEmbeddedDocuments( await createEmbeddedItemsWithEffects(
'Item', this.character,
this.setup.class.system.inventory.take this.setup.class.system.inventory.take.filter(x => x)
.filter(x => x)
.map(x => ({
...x,
effects: x.effects?.map(effect => effect.toObject())
}))
); );
await this.character.update({ await this.character.update({

View file

@ -44,10 +44,12 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
static PARTS = { static PARTS = {
tabs: { template: 'systems/daggerheart/templates/levelup/tabs/tab-navigation.hbs' }, tabs: { template: 'systems/daggerheart/templates/levelup/tabs/tab-navigation.hbs' },
advancements: { template: 'systems/daggerheart/templates/levelup/tabs/advancements.hbs' }, advancements: {
template: 'systems/daggerheart/templates/levelup/tabs/advancements.hbs'
},
selections: { selections: {
template: 'systems/daggerheart/templates/levelup/tabs/selections.hbs', template: 'systems/daggerheart/templates/levelup/tabs/selections.hbs',
scrollable: ['.selections'] scrollable: ['.levelup-selections-container']
}, },
summary: { template: 'systems/daggerheart/templates/levelup/tabs/summary.hbs' }, summary: { template: 'systems/daggerheart/templates/levelup/tabs/summary.hbs' },
footer: { template: 'systems/daggerheart/templates/levelup/tabs/footer.hbs' } footer: { template: 'systems/daggerheart/templates/levelup/tabs/footer.hbs' }

View file

@ -371,6 +371,21 @@ export async function createEmbeddedItemWithEffects(actor, baseData, update) {
return doc; return doc;
} }
export async function createEmbeddedItemsWithEffects(actor, baseData) {
const effectData = [];
for (let d of baseData) {
const data = d.uuid.startsWith('Compendium') ? await foundry.utils.fromUuid(d.uuid) : d;
effectData.push({
...data,
id: data.id,
uuid: data.uuid,
effects: data.effects?.map(effect => effect.toObject())
});
}
await actor.createEmbeddedDocuments('Item', effectData);
}
export const slugify = name => { export const slugify = name => {
return name.toLowerCase().replaceAll(' ', '-').replaceAll('.', ''); return name.toLowerCase().replaceAll(' ', '-').replaceAll('.', '');
}; };

View file

@ -112,6 +112,10 @@
flex-direction: column; flex-direction: column;
text-align: center; text-align: center;
.card-preview-container {
flex: 1;
}
.card-preview-container { .card-preview-container {
border-color: light-dark(@dark-blue, @golden); border-color: light-dark(@dark-blue, @golden);
} }
@ -157,7 +161,10 @@
.selections-outer-container { .selections-outer-container {
display: flex; display: flex;
justify-content: space-evenly; justify-content: space-evenly;
height: 210px;
&.enlarged {
height: 240px;
}
} }
.section-container { .section-container {

View file

@ -83,10 +83,15 @@
background: grey; background: grey;
padding: 0 12px; padding: 0 12px;
border-radius: 6px; border-radius: 6px;
z-index: 2;
} }
img { img {
height: 124px; height: 124px;
&.svg {
filter: @beige-filter;
}
} }
.levelup-domain-selected { .levelup-domain-selected {
@ -138,6 +143,10 @@
padding: 0 12px; padding: 0 12px;
} }
.levelup-trait-increases {
width: 100%;
}
.levelup-radio-choices { .levelup-radio-choices {
display: flex; display: flex;
gap: 8px; gap: 8px;

View file

@ -27,6 +27,7 @@
} }
.checkbox-group-container { .checkbox-group-container {
width: 100%;
display: grid; display: grid;
grid-template-columns: 1fr 3fr; grid-template-columns: 1fr 3fr;
gap: 4px; gap: 4px;

View file

@ -19,7 +19,7 @@
<input type="range" id="volume" class="mixed-ancestry-slider" value="{{mixedAncestry}}" min="0" max="1" /> <input type="range" id="volume" class="mixed-ancestry-slider" value="{{mixedAncestry}}" min="0" max="1" />
</div> </div>
<div class="selections-outer-container"> <div class="selections-outer-container enlarged">
<div class="selections-container primary-ancestry-card"> <div class="selections-container primary-ancestry-card">
{{#> "systems/daggerheart/templates/components/card-preview.hbs" primaryAncestry altPartialBlock=true secondaryDisabled=secondaryAncestry.uuid mixedAncestry=mixedAncestry }} {{#> "systems/daggerheart/templates/components/card-preview.hbs" primaryAncestry altPartialBlock=true secondaryDisabled=secondaryAncestry.uuid mixedAncestry=mixedAncestry }}
{{#if uuid}} {{#if uuid}}

View file

@ -99,7 +99,7 @@
{{#each this.multiclass.domains}} {{#each this.multiclass.domains}}
<div class="levelup-domain-selection-container {{#if this.disabled}}disabled{{/if}}" {{#if (not this.disabled)}}data-action="selectDomain" data-uuid="{{../multiclass.uuid}}" data-domain="{{this.id}}" data-path="{{../multiclass.path}}" {{/if}}> <div class="levelup-domain-selection-container {{#if this.disabled}}disabled{{/if}}" {{#if (not this.disabled)}}data-action="selectDomain" data-uuid="{{../multiclass.uuid}}" data-domain="{{this.id}}" data-path="{{../multiclass.path}}" {{/if}}>
<div class="levelup-domain-label">{{localize this.label}}</div> <div class="levelup-domain-label">{{localize this.label}}</div>
<img src="{{this.src}}" /> <img class="svg" src="{{this.src}}" />
{{#if this.selected}} {{#if this.selected}}
<div class="levelup-domain-selected"> <div class="levelup-domain-selected">
<i class="fa-solid fa-check"></i> <i class="fa-solid fa-check"></i>