Increase reuse of gold and inventory styling

This commit is contained in:
Carlos Fernandez 2026-04-15 03:33:59 -04:00
parent c6335980ba
commit 98810c6909
10 changed files with 84 additions and 146 deletions

View file

@ -3,7 +3,7 @@ import ForeignDocumentUUIDField from '../fields/foreignDocumentUUIDField.mjs';
import DhLevelData from '../levelData.mjs';
import { commonActorRules } from './base.mjs';
import DhCreature from './creature.mjs';
import { attributeField, stressDamageReductionRule, bonusField } from '../fields/actorField.mjs';
import { attributeField, stressDamageReductionRule, bonusField, GoldField } from '../fields/actorField.mjs';
import { ActionField } from '../fields/actionField.mjs';
import DHCharacterSettings from '../../applications/sheets-configs/character-settings.mjs';
import { getArmorSources } from '../../helpers/utils.mjs';
@ -62,12 +62,7 @@ export default class DhCharacter extends DhCreature {
core: new fields.BooleanField({ initial: false })
})
),
gold: new fields.SchemaField({
coins: new fields.NumberField({ initial: 0, integer: true }),
handfuls: new fields.NumberField({ initial: 1, integer: true }),
bags: new fields.NumberField({ initial: 0, integer: true }),
chests: new fields.NumberField({ initial: 0, integer: true })
}),
gold: new GoldField(),
scars: new fields.NumberField({ initial: 0, integer: true, label: 'DAGGERHEART.GENERAL.scars' }),
biography: new fields.SchemaField({
background: new fields.HTMLField(),

View file

@ -2,6 +2,7 @@ import BaseDataActor from './base.mjs';
import ForeignDocumentUUIDArrayField from '../fields/foreignDocumentUUIDArrayField.mjs';
import TagTeamData from '../tagTeamData.mjs';
import GroupRollData from '../groupRollData.mjs';
import { GoldField } from '../fields/actorField.mjs';
export default class DhParty extends BaseDataActor {
/**@inheritdoc */
@ -11,12 +12,7 @@ export default class DhParty extends BaseDataActor {
...super.defineSchema(),
partyMembers: new ForeignDocumentUUIDArrayField({ type: 'Actor' }, { prune: true }),
notes: new fields.HTMLField(),
gold: new fields.SchemaField({
coins: new fields.NumberField({ initial: 0, integer: true }),
handfuls: new fields.NumberField({ initial: 1, integer: true }),
bags: new fields.NumberField({ initial: 0, integer: true }),
chests: new fields.NumberField({ initial: 0, integer: true })
}),
gold: new GoldField(),
tagTeam: new fields.EmbeddedDataField(TagTeamData),
groupRoll: new fields.EmbeddedDataField(GroupRollData)
};

View file

@ -103,4 +103,15 @@ class ResourcesField extends fields.TypedObjectField {
}
}
export { attributeField, ResourcesField, stressDamageReductionRule, bonusField };
class GoldField extends fields.SchemaField {
constructor() {
super({
coins: new fields.NumberField({ initial: 0, integer: true }),
handfuls: new fields.NumberField({ initial: 1, integer: true }),
bags: new fields.NumberField({ initial: 0, integer: true }),
chests: new fields.NumberField({ initial: 0, integer: true })
});
}
}
export { attributeField, ResourcesField, GoldField, stressDamageReductionRule, bonusField };

View file

@ -10,6 +10,7 @@ export const preloadHandlebarsTemplates = async function () {
'templates/generic/tab-navigation.hbs',
'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs',
'systems/daggerheart/templates/sheets/global/partials/action-item.hbs',
'systems/daggerheart/templates/sheets/global/partials/gold.hbs',
'systems/daggerheart/templates/sheets/global/partials/domain-card-item.hbs',
'systems/daggerheart/templates/sheets/global/partials/item-resource.hbs',
'systems/daggerheart/templates/sheets/global/partials/resource-section/resource-section.hbs',

View file

@ -37,6 +37,59 @@
color: light-dark(@chat-blue-bg, @beige-50);
}
.tab.inventory {
.search-section {
display: flex;
gap: 10px;
align-items: center;
}
.search-bar {
position: relative;
color: light-dark(@dark-blue-50, @beige-50);
width: 100%;
padding-top: 5px;
input {
border-radius: 50px;
background: light-dark(@dark-blue-10, @golden-10);
border: none;
outline: 2px solid transparent;
transition: all 0.3s ease;
padding: 0 20px;
&:hover {
outline: 2px solid light-dark(@dark, @golden);
}
&::-webkit-search-cancel-button {
-webkit-appearance: none;
display: none;
}
}
.icon {
align-content: center;
height: 32px;
position: absolute;
right: 20px;
font-size: 16px;
z-index: 1;
color: light-dark(@dark-blue-50, @beige-50);
}
}
.gold-section {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
gap: 10px;
padding: 10px 10px 0;
.input {
color: light-dark(@dark, @beige);
}
}
}
&.limited {
&.character,
&.adversary,

View file

@ -3,47 +3,6 @@
.application.sheet.daggerheart.actor.dh-style.character {
.tab.inventory {
.search-section {
display: flex;
gap: 10px;
align-items: center;
.search-bar {
position: relative;
color: light-dark(@dark-blue-50, @beige-50);
width: 100%;
padding-top: 5px;
input {
border-radius: 50px;
background: light-dark(@dark-blue-10, @golden-10);
border: none;
outline: 2px solid transparent;
transition: all 0.3s ease;
padding: 0 20px;
&:hover {
outline: 2px solid light-dark(@dark, @golden);
}
&::-webkit-search-cancel-button {
-webkit-appearance: none;
display: none;
}
}
.icon {
align-content: center;
height: 32px;
position: absolute;
right: 20px;
font-size: var(--font-size-16);
z-index: 1;
color: light-dark(@dark-blue-50, @beige-50);
}
}
}
.items-section {
display: flex;
flex-direction: column;
@ -55,16 +14,5 @@
scrollbar-width: thin;
scrollbar-color: light-dark(@dark-blue, @golden) transparent;
}
.currency-section {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
gap: 10px;
padding: 10px 10px 0;
.input {
color: light-dark(@dark, @beige);
}
}
}
}

View file

@ -3,51 +3,6 @@
.application.sheet.daggerheart.actor.dh-style.party {
.tab.inventory {
.search-section {
display: flex;
gap: 10px;
align-items: center;
.search-bar {
position: relative;
color: light-dark(@dark-blue-50, @beige-50);
width: 100%;
padding-top: 5px;
input {
border-radius: 50px;
background: light-dark(@dark-blue-10, @golden-10);
border: none;
outline: 2px solid transparent;
transition: all 0.3s ease;
padding: 0 20px;
&:hover {
outline: 2px solid light-dark(@dark, @golden);
}
&:placeholder {
color: light-dark(@dark-blue-50, @beige-50);
}
&::-webkit-search-cancel-button {
-webkit-appearance: none;
display: none;
}
}
.icon {
align-content: center;
height: 32px;
position: absolute;
right: 20px;
font-size: 16px;
z-index: 1;
color: light-dark(@dark-blue-50, @beige-50);
}
}
}
.items-section {
display: flex;
flex-direction: column;
@ -59,16 +14,5 @@
scrollbar-width: thin;
scrollbar-color: light-dark(@dark-blue, @golden) transparent;
}
.currency-section {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
gap: 10px;
padding: 10px 10px 0;
.input {
color: light-dark(@dark, @beige);
}
}
}
}

View file

@ -13,18 +13,7 @@
</div>
{{#if this.inventory.hasCurrency}}
<div class="currency-section">
{{#each this.inventory.currencies as |currency key|}}
{{#if currency.enabled}}
<div class="input currency" data-currency="{{key}}">
<span class="drag-handle">
<i class="{{currency.icon}}" inert></i> {{localize currency.label}}
</span>
<input type="text" name="{{currency.field.fieldPath}}" data-allow-delta value="{{currency.value}}" data-dtype="Number" min="0" step="1" />
</div>
{{/if}}
{{/each}}
</div>
{{> "systems/daggerheart/templates/sheets/global/partials/gold.hbs" currencies=inventory.currencies}}
{{/if}}
<div class="items-section">

View file

@ -16,18 +16,7 @@
</div>
{{#if inventory.hasCurrency}}
<div class="currency-section">
{{#each this.inventory.currencies as |currency key|}}
{{#if currency.enabled}}
<div class="input currency" data-currency="{{key}}">
<span class="drag-handle">
<i class="{{currency.icon}}" inert></i> {{localize currency.label}}
</span>
<input type="text" name="{{currency.field.fieldPath}}" data-allow-delta value="{{currency.value}}" data-dtype="Number" min="0" step="1" />
</div>
{{/if}}
{{/each}}
</div>
{{> "systems/daggerheart/templates/sheets/global/partials/gold.hbs" currencies=inventory.currencies}}
{{/if}}
<div class="items-section">

View file

@ -0,0 +1,12 @@
<div class="gold-section">
{{#each currencies as |currency key|}}
{{#if currency.enabled}}
<div class="input currency" data-currency="{{key}}">
<span class="drag-handle">
<i class="{{currency.icon}}" inert></i> {{localize currency.label}}
</span>
<input type="text" name="{{currency.field.fieldPath}}" data-allow-delta value="{{currency.value}}" data-dtype="Number" min="0" step="1" />
</div>
{{/if}}
{{/each}}
</div>