This commit is contained in:
WBHarry 2026-01-12 20:52:50 +01:00
parent 23a497bab8
commit 2e4d3de379
5 changed files with 90 additions and 44 deletions

View file

@ -231,7 +231,8 @@
"viewParty": "View Party",
"InvalidOldCharacterImportTitle": "Old Character Import",
"InvalidOldCharacterImportText": "Character data exported prior to system version 1.1 will not generate a complete character. Do you wish to continue?",
"cancelBeastform": "Cancel Beastform"
"cancelBeastform": "Cancel Beastform",
"sidebarFavoritesHint": "Drag items, features and domain cards from the sheet to here"
},
"Companion": {
"FIELDS": {

View file

@ -266,23 +266,24 @@ export default class CharacterSheet extends DHBaseActorSheet {
async _prepareSidebarContext(context, _options) {
context.isDeath = this.document.system.deathMoveViable;
context.sidebarFavoritesEmpty = this.document.system.sidebarFavorites.length === 0;
context.showfavorites = !context.sidebarFavoritesEmpty || this.document.system.usedUnarmed;
const initialFavorites = this.document.system.usedUnarmed
? {
equipment: {
label: 'DAGGERHEART.GENERAL.equipment',
items: [{ type: 'attack', value: this.document.system.usedUnarmed }]
}
}
: {};
context.sidebarFavorites = this.document.system.sidebarFavorites.reduce((acc, item) => {
const type = item.type === 'domainCard' ? item.type : 'equipment';
const label = type === 'domainCard' ? 'DAGGERHEART.GENERAL.loadout' : 'DAGGERHEART.GENERAL.equipment';
if (!acc[type]) acc[type] = { label, items: [] };
acc[type].items.push({ type: item.type, value: item });
// const initialFavorites = this.document.system.usedUnarmed
// ? {
// equipment: {
// label: 'DAGGERHEART.GENERAL.equipment',
// items: [{ type: 'attack', value: this.document.system.usedUnarmed }]
// }
// }
// : {};
// context.sidebarFavorites = this.document.system.sidebarFavorites.reduce((acc, item) => {
// const type = item.type === 'domainCard' ? item.type : 'equipment';
// const label = type === 'domainCard' ? 'DAGGERHEART.GENERAL.loadout' : 'DAGGERHEART.GENERAL.equipment';
// if (!acc[type]) acc[type] = { label, items: [] };
// acc[type].items.push({ type: item.type, value: item });
return acc;
}, initialFavorites);
// return acc;
// }, initialFavorites);
}
/**

View file

@ -45,6 +45,26 @@ export default class DHDomainCard extends BaseDataItem {
/* -------------------------------------------- */
/**@inheritdoc */
async _preUpdate(data, options, user) {
const allowed = await super._preUpdate(data, options, user);
if (allowed === false) return;
if (this.parent.parent?.type === 'character') {
if (
data.system?.inVault &&
!this.inVault &&
this.parent.parent.system.sidebarFavorites.find(x => x?.id === this.parent.id)
) {
this.parent.parent.update({
'system.sidebarFavorites': this.parent.parent.system.sidebarFavorites.filter(
x => x.id !== this.parent.id
)
});
}
}
}
/**@inheritdoc */
async _preCreate(data, options, user) {
const allowed = await super._preCreate(data, options, user);

View file

@ -552,7 +552,6 @@
.shortcut-items-section {
overflow-y: hidden;
padding-top: 10px;
padding-bottom: 20px;
mask-image: linear-gradient(0deg, transparent 0%, black 5%);
scrollbar-gutter: stable;
scrollbar-width: thin;
@ -565,16 +564,17 @@
.empty-favorites {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
box-sizing: border-box;
height: 40px;
border: 1px dashed light-dark(@dark-blue-50, @beige-50);
border-radius: 3px;
color: light-dark(@dark-blue-50, @beige-50);
text-align: center;
margin-bottom: 10px;
margin-left: 4px;
padding: 4px 0;
span {
width: 250px;

View file

@ -96,10 +96,36 @@
</div>
<div class="shortcut-items-section">
{{#if sidebarFavoritesEmpty}}
<div class="empty-favorites"><span>{{localize "DAGGERHEART.GENERAL.favorite.plural"}}</span></div>
{{else}}
{{#each sidebarFavorites as |category|}}
<div class="equipment-section">
<div class="title">
<side-line-div class="invert"></side-line-div>
<h3>{{localize "DAGGERHEART.GENERAL.favorite.plural"}}</h3>
<side-line-div></side-line-div>
</div>
<ul class="items-sidebar-list">
{{#if this.document.system.usedUnarmed}}
{{> 'daggerheart.inventory-item-compact'
item=this.document.system.usedUnarmed
type="attack"
}}
{{/if}}
{{#each this.document.system.sidebarFavorites as |item|}}
{{> 'daggerheart.inventory-item-compact'
item=item
type=item.type
}}
{{/each}}
</ul>
{{#if sidebarFavoritesEmpty}}
<div class="empty-favorites">
<span>{{localize "DAGGERHEART.ACTORS.Character.sidebarFavoritesHint"}}</span>
</div>
{{/if}}
</div>
</div>
{{!-- {{#each sidebarFavorites as |category|}}
<div class="equipment-section">
<div class="title">
<side-line-div class="invert"></side-line-div>
@ -115,29 +141,27 @@
{{/each}}
</ul>
</div>
{{/each}}
{{/if}}
<div class="experience-section">
<div class="title">
<side-line-div class="invert"></side-line-div>
<h3>{{localize "DAGGERHEART.GENERAL.experience.single"}}</h3>
<side-line-div></side-line-div>
</div>
<div class="experience-list">
{{#each document.system.experiences as |experience id|}}
<div class="experience-row" data-tooltip-text="{{experience.description}}">
<span class="experience-value">
+{{experience.value}}
</span>
<span class="experience-name">{{experience.name}}</span>
<div class="controls">
<a data-action="sendExpToChat" data-type="experience" data-id="{{id}}">
<i class="fa-regular fa-message"></i>
</a>
</div>
{{/each}} --}}
<div class="experience-section">
<div class="title">
<side-line-div class="invert"></side-line-div>
<h3>{{localize "DAGGERHEART.GENERAL.experience.single"}}</h3>
<side-line-div></side-line-div>
</div>
<div class="experience-list">
{{#each document.system.experiences as |experience id|}}
<div class="experience-row" data-tooltip-text="{{experience.description}}">
<span class="experience-value">
+{{experience.value}}
</span>
<span class="experience-name">{{experience.name}}</span>
<div class="controls">
<a data-action="sendExpToChat" data-type="experience" data-id="{{id}}">
<i class="fa-regular fa-message"></i>
</a>
</div>
{{/each}}
</div>
</div>
{{/each}}
</div>
</div>
</aside>