mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Made it so you enable each currency denomination separately incase you don't want to have all 4 shown.
This commit is contained in:
parent
481ce46edf
commit
023e17d47d
10 changed files with 129 additions and 94 deletions
|
|
@ -2366,7 +2366,6 @@
|
||||||
"maxDomains": { "label": "Max Class Domains", "hint": "Max domains you can set on a class" }
|
"maxDomains": { "label": "Max Class Domains", "hint": "Max domains you can set on a class" }
|
||||||
},
|
},
|
||||||
"currency": {
|
"currency": {
|
||||||
"enabled": "Enable Overrides",
|
|
||||||
"title": "Currency Overrides",
|
"title": "Currency Overrides",
|
||||||
"currencyName": "Currency Name",
|
"currencyName": "Currency Name",
|
||||||
"coinName": "Coin Name",
|
"coinName": "Coin Name",
|
||||||
|
|
|
||||||
|
|
@ -210,26 +210,33 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
context.resources.stress.emptyPips =
|
context.resources.stress.emptyPips =
|
||||||
context.resources.stress.max < maxResource ? maxResource - context.resources.stress.max : 0;
|
context.resources.stress.max < maxResource ? maxResource - context.resources.stress.max : 0;
|
||||||
|
|
||||||
context.inventory = {
|
context.inventory = { currencies: {} };
|
||||||
currency: {
|
const { title, ...currencies } = game.settings.get(
|
||||||
title: game.i18n.localize('DAGGERHEART.CONFIG.Gold.title'),
|
CONFIG.DH.id,
|
||||||
coins: game.i18n.localize('DAGGERHEART.CONFIG.Gold.coins'),
|
CONFIG.DH.SETTINGS.gameSettings.Homebrew
|
||||||
handfuls: game.i18n.localize('DAGGERHEART.CONFIG.Gold.handfuls'),
|
).currency;
|
||||||
bags: game.i18n.localize('DAGGERHEART.CONFIG.Gold.bags'),
|
for (let key in currencies) {
|
||||||
chests: game.i18n.localize('DAGGERHEART.CONFIG.Gold.chests')
|
context.inventory.currencies[key] = {
|
||||||
}
|
...currencies[key],
|
||||||
};
|
field: context.systemFields.gold.fields[key],
|
||||||
|
value: context.source.system.gold[key]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// context.inventory = {
|
||||||
|
// currency: {
|
||||||
|
// title: game.i18n.localize('DAGGERHEART.CONFIG.Gold.title'),
|
||||||
|
// coins: game.i18n.localize('DAGGERHEART.CONFIG.Gold.coins'),
|
||||||
|
// handfuls: game.i18n.localize('DAGGERHEART.CONFIG.Gold.handfuls'),
|
||||||
|
// bags: game.i18n.localize('DAGGERHEART.CONFIG.Gold.bags'),
|
||||||
|
// chests: game.i18n.localize('DAGGERHEART.CONFIG.Gold.chests')
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
|
||||||
context.beastformActive = this.document.effects.find(x => x.type === 'beastform');
|
context.beastformActive = this.document.effects.find(x => x.type === 'beastform');
|
||||||
|
|
||||||
const homebrewCurrency = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).currency;
|
// if (context.inventory.length === 0) {
|
||||||
if (homebrewCurrency.enabled) {
|
// context.inventory = Array(1).fill(Array(5).fill([]));
|
||||||
context.inventory.currency = homebrewCurrency;
|
// }
|
||||||
}
|
|
||||||
|
|
||||||
if (context.inventory.length === 0) {
|
|
||||||
context.inventory = Array(1).fill(Array(5).fill([]));
|
|
||||||
}
|
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,23 +96,17 @@ export default class Party extends DHBaseActorSheet {
|
||||||
async _prepareContext(_options) {
|
async _prepareContext(_options) {
|
||||||
const context = await super._prepareContext(_options);
|
const context = await super._prepareContext(_options);
|
||||||
|
|
||||||
context.inventory = {
|
context.inventory = { currencies: {} };
|
||||||
currency: {
|
const { title, ...currencies } = game.settings.get(
|
||||||
title: game.i18n.localize('DAGGERHEART.CONFIG.Gold.title'),
|
CONFIG.DH.id,
|
||||||
coins: game.i18n.localize('DAGGERHEART.CONFIG.Gold.coins'),
|
CONFIG.DH.SETTINGS.gameSettings.Homebrew
|
||||||
handfuls: game.i18n.localize('DAGGERHEART.CONFIG.Gold.handfuls'),
|
).currency;
|
||||||
bags: game.i18n.localize('DAGGERHEART.CONFIG.Gold.bags'),
|
for (let key in currencies) {
|
||||||
chests: game.i18n.localize('DAGGERHEART.CONFIG.Gold.chests')
|
context.inventory.currencies[key] = {
|
||||||
}
|
...currencies[key],
|
||||||
};
|
field: context.systemFields.gold.fields[key],
|
||||||
|
value: context.source.system.gold[key]
|
||||||
const homebrewCurrency = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).currency;
|
};
|
||||||
if (homebrewCurrency.enabled) {
|
|
||||||
context.inventory.currency = homebrewCurrency;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (context.inventory.length === 0) {
|
|
||||||
context.inventory = Array(1).fill(Array(5).fill([]));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,16 @@
|
||||||
import { defaultRestOptions } from '../../config/generalConfig.mjs';
|
import { defaultRestOptions } from '../../config/generalConfig.mjs';
|
||||||
import { ActionsField } from '../fields/actionField.mjs';
|
import { ActionsField } from '../fields/actionField.mjs';
|
||||||
|
|
||||||
|
const currencyField = (initial, label) =>
|
||||||
|
new foundry.data.fields.SchemaField({
|
||||||
|
enabled: new foundry.data.fields.BooleanField({ required: true, initial: true }),
|
||||||
|
label: new foundry.data.fields.StringField({
|
||||||
|
required: true,
|
||||||
|
initial,
|
||||||
|
label
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
export default class DhHomebrew extends foundry.abstract.DataModel {
|
export default class DhHomebrew extends foundry.abstract.DataModel {
|
||||||
static defineSchema() {
|
static defineSchema() {
|
||||||
const fields = foundry.data.fields;
|
const fields = foundry.data.fields;
|
||||||
|
|
@ -30,36 +40,15 @@ export default class DhHomebrew extends foundry.abstract.DataModel {
|
||||||
initial: () => [2, 1, 1, 0, 0, -1]
|
initial: () => [2, 1, 1, 0, 0, -1]
|
||||||
}),
|
}),
|
||||||
currency: new fields.SchemaField({
|
currency: new fields.SchemaField({
|
||||||
enabled: new fields.BooleanField({
|
|
||||||
required: true,
|
|
||||||
initial: false,
|
|
||||||
label: 'DAGGERHEART.SETTINGS.Homebrew.currency.enabled'
|
|
||||||
}),
|
|
||||||
title: new fields.StringField({
|
title: new fields.StringField({
|
||||||
required: true,
|
required: true,
|
||||||
initial: 'Gold',
|
initial: 'Gold',
|
||||||
label: 'DAGGERHEART.SETTINGS.Homebrew.currency.currencyName'
|
label: 'DAGGERHEART.SETTINGS.Homebrew.currency.currencyName'
|
||||||
}),
|
}),
|
||||||
coins: new fields.StringField({
|
coins: currencyField('Coins', 'DAGGERHEART.SETTINGS.Homebrew.currency.coinName'),
|
||||||
required: true,
|
handfuls: currencyField('Handfuls', 'DAGGERHEART.SETTINGS.Homebrew.currency.handfulName'),
|
||||||
initial: 'Coins',
|
bags: currencyField('Bags', 'DAGGERHEART.SETTINGS.Homebrew.currency.bagName'),
|
||||||
label: 'DAGGERHEART.SETTINGS.Homebrew.currency.coinName'
|
chests: currencyField('Chests', 'DAGGERHEART.SETTINGS.Homebrew.currency.chestName')
|
||||||
}),
|
|
||||||
handfuls: new fields.StringField({
|
|
||||||
required: true,
|
|
||||||
initial: 'Handfuls',
|
|
||||||
label: 'DAGGERHEART.SETTINGS.Homebrew.currency.handfulName'
|
|
||||||
}),
|
|
||||||
bags: new fields.StringField({
|
|
||||||
required: true,
|
|
||||||
initial: 'Bags',
|
|
||||||
label: 'DAGGERHEART.SETTINGS.Homebrew.currency.bagName'
|
|
||||||
}),
|
|
||||||
chests: new fields.StringField({
|
|
||||||
required: true,
|
|
||||||
initial: 'Chests',
|
|
||||||
label: 'DAGGERHEART.SETTINGS.Homebrew.currency.chestName'
|
|
||||||
})
|
|
||||||
}),
|
}),
|
||||||
restMoves: new fields.SchemaField({
|
restMoves: new fields.SchemaField({
|
||||||
longRest: new fields.SchemaField({
|
longRest: new fields.SchemaField({
|
||||||
|
|
@ -146,4 +135,26 @@ export default class DhHomebrew extends foundry.abstract.DataModel {
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @inheritDoc */
|
||||||
|
_initializeSource(source, options = {}) {
|
||||||
|
source = super._initializeSource(source, options);
|
||||||
|
source.currency.coins = {
|
||||||
|
enabled: source.currency.coins.enabled ?? true,
|
||||||
|
label: source.currency.coins.label || source.currency.coins
|
||||||
|
};
|
||||||
|
source.currency.handfuls = {
|
||||||
|
enabled: source.currency.handfuls.enabled ?? true,
|
||||||
|
label: source.currency.handfuls.label || source.currency.handfuls
|
||||||
|
};
|
||||||
|
source.currency.bags = {
|
||||||
|
enabled: source.currency.bags.enabled ?? true,
|
||||||
|
label: source.currency.bags.label || source.currency.bags
|
||||||
|
};
|
||||||
|
source.currency.chests = {
|
||||||
|
enabled: source.currency.chests.enabled ?? true,
|
||||||
|
label: source.currency.chests.label || source.currency.chests
|
||||||
|
};
|
||||||
|
return source;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,11 +57,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.currency-section {
|
.currency-section {
|
||||||
display: flex;
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr 1fr 1fr;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
padding: 10px 10px 0;
|
padding: 10px 10px 0;
|
||||||
|
|
||||||
input {
|
.input {
|
||||||
color: light-dark(@dark, @beige);
|
color: light-dark(@dark, @beige);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,11 +61,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.currency-section {
|
.currency-section {
|
||||||
display: flex;
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr 1fr 1fr;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
padding: 10px 10px 0;
|
padding: 10px 10px 0;
|
||||||
|
|
||||||
input {
|
.input {
|
||||||
color: light-dark(@dark, @beige);
|
color: light-dark(@dark, @beige);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,21 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.toggleable-row {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
|
||||||
|
&.spaced {
|
||||||
|
padding-right: 28.5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.setting-group-field {
|
.setting-group-field {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
||||||
|
|
@ -29,13 +29,25 @@
|
||||||
<legend>
|
<legend>
|
||||||
{{localize "DAGGERHEART.SETTINGS.Homebrew.currency.title"}}
|
{{localize "DAGGERHEART.SETTINGS.Homebrew.currency.title"}}
|
||||||
</legend>
|
</legend>
|
||||||
{{formGroup settingFields.schema.fields.currency.fields.enabled value=settingFields._source.currency.enabled localize=true}}
|
<div class="toggleable-row spaced">
|
||||||
{{formGroup settingFields.schema.fields.currency.fields.title value=settingFields._source.currency.title localize=true}}
|
{{formGroup settingFields.schema.fields.currency.fields.title value=settingFields._source.currency.title localize=true}}
|
||||||
{{formGroup settingFields.schema.fields.currency.fields.coins value=settingFields._source.currency.coins localize=true}}
|
</div>
|
||||||
{{formGroup settingFields.schema.fields.currency.fields.handfuls value=settingFields._source.currency.handfuls localize=true}}
|
<div class="toggleable-row">
|
||||||
{{formGroup settingFields.schema.fields.currency.fields.bags value=settingFields._source.currency.bags localize=true}}
|
{{formGroup settingFields.schema.fields.currency.fields.coins.fields.label value=settingFields._source.currency.coins.label localize=true}}
|
||||||
{{formGroup settingFields.schema.fields.currency.fields.chests value=settingFields._source.currency.chests localize=true}}
|
<input type="checkbox" {{checked settingFields._source.currency.coins.enabled}} disabled />
|
||||||
|
</div>
|
||||||
|
<div class="toggleable-row">
|
||||||
|
{{formGroup settingFields.schema.fields.currency.fields.handfuls.fields.label value=settingFields._source.currency.handfuls.label localize=true}}
|
||||||
|
<input type="checkbox" name="currency.handfuls.enabled" {{checked settingFields._source.currency.handfuls.enabled}} />
|
||||||
|
</div>
|
||||||
|
<div class="toggleable-row">
|
||||||
|
{{formGroup settingFields.schema.fields.currency.fields.bags.fields.label value=settingFields._source.currency.bags.label localize=true}}
|
||||||
|
<input type="checkbox" name="currency.bags.enabled" {{checked settingFields._source.currency.bags.enabled}} />
|
||||||
|
</div>
|
||||||
|
<div class="toggleable-row">
|
||||||
|
{{formGroup settingFields.schema.fields.currency.fields.chests.fields.label value=settingFields._source.currency.chests.label localize=true}}
|
||||||
|
<input type="checkbox" name="currency.chests.enabled" {{checked settingFields._source.currency.chests.enabled}} />
|
||||||
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
@ -13,27 +13,14 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="currency-section">
|
<div class="currency-section">
|
||||||
<div class="input">
|
{{#each this.inventory.currencies as | currency |}}
|
||||||
<span>{{localize this.inventory.currency.coins}}</span>
|
{{#if currency.enabled}}
|
||||||
{{formInput systemFields.gold.fields.coins value=source.system.gold.coins enriched=source.system.gold.coins
|
<div class="input">
|
||||||
localize=true toggled=true}}
|
<span>{{localize currency.label}}</span>
|
||||||
</div>
|
{{formInput currency.field value=currency.value enriched=currency.value toggled=true}}
|
||||||
<div class="input">
|
</div>
|
||||||
<span>{{localize this.inventory.currency.handfuls}}</span>
|
{{/if}}
|
||||||
{{formInput systemFields.gold.fields.handfuls value=source.system.gold.handfuls
|
{{/each}}
|
||||||
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>
|
</div>
|
||||||
|
|
||||||
<div class="items-section">
|
<div class="items-section">
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,15 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="currency-section">
|
<div class="currency-section">
|
||||||
<div class="input">
|
{{#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>
|
<span>{{localize this.inventory.currency.coins}}</span>
|
||||||
{{formInput systemFields.gold.fields.coins value=source.system.gold.coins enriched=source.system.gold.coins
|
{{formInput systemFields.gold.fields.coins value=source.system.gold.coins enriched=source.system.gold.coins
|
||||||
localize=true toggled=true}}
|
localize=true toggled=true}}
|
||||||
|
|
@ -35,7 +43,7 @@
|
||||||
<span>{{localize this.inventory.currency.chests}}</span>
|
<span>{{localize this.inventory.currency.chests}}</span>
|
||||||
{{formInput systemFields.gold.fields.chests value=source.system.gold.chests
|
{{formInput systemFields.gold.fields.chests value=source.system.gold.chests
|
||||||
enriched=source.system.gold.chests localize=true toggled=true}}
|
enriched=source.system.gold.chests localize=true toggled=true}}
|
||||||
</div>
|
</div> --}}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue