Added level advancement selection data

This commit is contained in:
WBHarry 2025-05-29 17:14:40 +02:00
parent d7ebeb3b2a
commit b131f2831d
6 changed files with 41 additions and 28 deletions

View file

@ -748,6 +748,8 @@
"TakeLevelUp": "Finish Level Up", "TakeLevelUp": "Finish Level Up",
"notifications": { "notifications": {
"info": { "info": {
"tierAdvancementInfo": "Advancements from a higher tier can always be used to select advancements in a lower tier.",
"remainingAdvancementInfo": "Remaining Choices: {choices}",
"insufficentAdvancements": "You don't have enough advancements left.", "insufficentAdvancements": "You don't have enough advancements left.",
"insufficientTierAdvancements": "You have no available advancements for this tier." "insufficientTierAdvancements": "You have no available advancements for this tier."
} }

View file

@ -45,6 +45,7 @@ export class DhLevelup extends foundry.abstract.DataModel {
acc.total += tier.selections.total; acc.total += tier.selections.total;
for (var key in tier.selections.available) { for (var key in tier.selections.available) {
const availableSelections = tier.selections.available[key]; const availableSelections = tier.selections.available[key];
acc.totalAvailable += availableSelections;
if (acc.available[key]) acc.available[key] += availableSelections; if (acc.available[key]) acc.available[key] += availableSelections;
else acc.available[key] = availableSelections; else acc.available[key] = availableSelections;
@ -52,7 +53,7 @@ export class DhLevelup extends foundry.abstract.DataModel {
return acc; return acc;
}, },
{ total: 0, available: {} } { total: 0, available: {}, totalAvailable: 0 }
); );
} }
@ -128,16 +129,20 @@ class DhLevelupTier extends foundry.abstract.DataModel {
const allSelections = Object.keys(this.levels).reduce( const allSelections = Object.keys(this.levels).reduce(
(acc, key) => { (acc, key) => {
const { selections, available } = this.levels[key].nrSelections; const { selections, available } = this.levels[key].nrSelections;
if (acc.available[key]) acc.available[key] += available; if (acc.available[key]) acc.available[key] += available;
else acc.available[key] = available; else acc.available[key] = available;
acc.totalAvailable += available;
acc.total += selections; acc.total += selections;
return acc; return acc;
}, },
{ available: {}, total: 0 } { available: {}, totalAvailable: 0, total: 0 }
); );
return { return {
available: allSelections.available, available: allSelections.available,
totalAvailable: allSelections.totalAvailable,
total: allSelections.total total: allSelections.total
}; };
} }

View file

@ -1,4 +1,4 @@
import { diceSoNicePresets, getDiceSoNicePresets } from '../config/generalConfig.mjs'; import { getDiceSoNicePresets } from '../config/generalConfig.mjs';
export const loadCompendiumOptions = async compendiums => { export const loadCompendiumOptions = async compendiums => {
const compendiumValues = []; const compendiumValues = [];

View file

@ -2786,7 +2786,7 @@ div.daggerheart.views.multiclass {
.theme-light { .theme-light {
/* Add specifics*/ /* Add specifics*/
} }
.daggerheart.levelup div[data-application-part="form"] { .daggerheart.levelup div[data-application-part='form'] {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 8px; gap: 8px;
@ -3269,6 +3269,7 @@ div.daggerheart.views.multiclass {
width: 100%; width: 100%;
object-fit: cover; object-fit: cover;
mask-image: linear-gradient(0deg, transparent 0%, black 10%); mask-image: linear-gradient(0deg, transparent 0%, black 10%);
cursor: pointer;
} }
.application.sheet.daggerheart.dh-style .item-card-header .item-icons-list { .application.sheet.daggerheart.dh-style .item-card-header .item-icons-list {
position: absolute; position: absolute;
@ -3398,12 +3399,6 @@ div.daggerheart.views.multiclass {
/* Flex */ /* Flex */
/****/ /****/
} }
.daggerheart .vertical-separator {
border-left: 2px solid black;
height: 56px;
flex: 0;
align-self: center;
}
.daggerheart .flex-centered { .daggerheart .flex-centered {
display: flex; display: flex;
align-items: center; align-items: center;

View file

@ -75,5 +75,26 @@
.levelup-footer { .levelup-footer {
display: flex; display: flex;
.advancement-information-container {
display: flex;
gap: 8px;
border: 1px solid;
border-radius: 4px;
margin-left: 8px;
align-items: center;
padding: 0 8px;
border-color: rgb(159, 132, 117);
.advancement-tier-stats {
border: 1px solid;
padding: 0 2px;
border-radius: 6px;
}
.advancement-tier-info {
font-size: 14px;
}
}
} }
} }

View file

@ -30,23 +30,13 @@
</div> </div>
<footer class="levelup-footer"> <footer class="levelup-footer">
<button data-action="save">{{localize "Finish Levelup"}}</button> <button data-action="save">{{localize "Finish Levelup"}}</button>
</footer> <div class="advancement-information-container">
</div> {{localize "DAGGERHEART.Application.LevelUp.notifications.info.remainingAdvancementInfo" choices=this.levelup.levelSelections.totalAvailable}}
{{!-- <div class="flex-col"> {{#each this.levelup.tiers as |tier key|}}
<div class="levelup-title-container">Level {{activeLevel}}</div> <div class="advancement-tier-stats">Tier {{tier.tier}}: {{tier.selections.totalAvailable}}</div>
<div class="levelup-section"> {{/each}}
{{#each data}} <i class="advancement-tier-info fa-solid fa-circle-question" data-tooltip="{{localize "DAGGERHEART.Application.LevelUp.notifications.info.tierAdvancementInfo"}}"></i>
{{> "systems/daggerheart/templates/views/parts/level.hbs" data=this }} </div>
{{/each}}
</div>
<footer>
{{#if (eq activeLevel changedLevel )}}
<button data-action="finishLevelup" {{#if (not completedSelection)}}disabled{{/if}}>{{localize "DAGGERHEART.Application.LevelUp.TakeLevelUp"}}</button>
{{else}}
<button data-action="advanceLevel" {{#if (not completedSelection)}}disabled{{/if}}>{{localize "DAGGERHEART.Application.LevelUp.AdvanceLevel" level=(add activeLevel 1)}}</button>
{{/if}}
<button data-action="close">{{localize "DAGGERHEART.Application.Cancel"}}</button>
</footer> </footer>
</div> --}} </div>