[Fix] Allow disabling coins (#1381)

* Add ability to disable coins

* Omit currency section if all are disabled
This commit is contained in:
Carlos Fernandez 2025-12-07 17:29:07 -08:00 committed by GitHub
parent f680ade1da
commit ccdd413933
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 25 additions and 41 deletions

View file

@ -89,6 +89,7 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) {
value: context.source.system.gold[key]
};
}
context.inventory.hasCurrency = Object.values(context.inventory.currencies).some((c) => c.enabled);
}
return context;

View file

@ -34,7 +34,7 @@
</div>
<div class="toggleable-row">
{{formGroup settingFields.schema.fields.currency.fields.coins.fields.label value=settingFields._source.currency.coins.label localize=true}}
<input type="checkbox" {{checked settingFields._source.currency.coins.enabled}} disabled />
<input type="checkbox" name="currency.coins.enabled" {{checked settingFields._source.currency.coins.enabled}} />
</div>
<div class="toggleable-row">
{{formGroup settingFields.schema.fields.currency.fields.handfuls.fields.label value=settingFields._source.currency.handfuls.label localize=true}}

View file

@ -12,16 +12,18 @@
</a>
</div>
<div class="currency-section">
{{#each this.inventory.currencies as | currency |}}
{{#if currency.enabled}}
<div class="input">
<span>{{localize currency.label}}</span>
{{formInput currency.field value=currency.value enriched=currency.value toggled=true}}
</div>
{{/if}}
{{/each}}
</div>
{{#if this.inventory.hasCurrency}}
<div class="currency-section">
{{#each this.inventory.currencies as | currency |}}
{{#if currency.enabled}}
<div class="input">
<span>{{localize currency.label}}</span>
{{formInput currency.field value=currency.value enriched=currency.value toggled=true}}
</div>
{{/if}}
{{/each}}
</div>
{{/if}}
<div class="items-section">
{{> 'daggerheart.inventory-items'

View file

@ -15,37 +15,18 @@
</a>
</div>
<div class="currency-section">
{{#each this.inventory.currencies as | currency |}}
{{#if currency.enabled}}
<div class="input">
<span>{{localize currency.label}}</span>
{{formInput currency.field value=currency.value enriched=currency.value toggled=true}}
</div>
{{/if}}
{{/each}}
{{!-- <div class="input">
<span>{{localize this.inventory.currency.coins}}</span>
{{formInput systemFields.gold.fields.coins value=source.system.gold.coins enriched=source.system.gold.coins
localize=true toggled=true}}
{{#if inventory.hasCurrency}}
<div class="currency-section">
{{#each this.inventory.currencies as | currency |}}
{{#if currency.enabled}}
<div class="input">
<span>{{localize currency.label}}</span>
{{formInput currency.field value=currency.value enriched=currency.value toggled=true}}
</div>
{{/if}}
{{/each}}
</div>
<div class="input">
<span>{{localize this.inventory.currency.handfuls}}</span>
{{formInput systemFields.gold.fields.handfuls value=source.system.gold.handfuls
enriched=source.system.gold.handfuls localize=true toggled=true}}
</div>
<div class="input">
<span>{{localize this.inventory.currency.bags}}</span>
{{formInput systemFields.gold.fields.bags value=source.system.gold.bags enriched=source.system.gold.bags
localize=true toggled=true}}
</div>
<div class="input">
<span>{{localize this.inventory.currency.chests}}</span>
{{formInput systemFields.gold.fields.chests value=source.system.gold.chests
enriched=source.system.gold.chests localize=true toggled=true}}
</div> --}}
</div>
{{/if}}
<div class="items-section">
{{> 'daggerheart.inventory-items'