mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-06-06 04:44:16 +02:00
Merge 7c84de6a96 into 5be79f4ab8
This commit is contained in:
commit
d1e4aa4533
7 changed files with 70 additions and 19 deletions
|
|
@ -2887,7 +2887,9 @@
|
||||||
"iconName": "Icon Name",
|
"iconName": "Icon Name",
|
||||||
"iconNameHint": "Icons are from fontawesome",
|
"iconNameHint": "Icons are from fontawesome",
|
||||||
"bagName": "Bag Name",
|
"bagName": "Bag Name",
|
||||||
"chestName": "Chest Name"
|
"chestName": "Chest Name",
|
||||||
|
"quantityName": "Quantity Name",
|
||||||
|
"initialAmount": "Starting Amount"
|
||||||
},
|
},
|
||||||
"domains": {
|
"domains": {
|
||||||
"domainsTitle": "Base Domains",
|
"domainsTitle": "Base Domains",
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ const companionBaseResources = Object.freeze({
|
||||||
|
|
||||||
export const character = {
|
export const character = {
|
||||||
base: characterBaseResources,
|
base: characterBaseResources,
|
||||||
|
initialCurrency: { coins: 0, handfuls: 1, bags: 0, chests: 0 },
|
||||||
custom: {}, // module stuff goes here
|
custom: {}, // module stuff goes here
|
||||||
all: { ...characterBaseResources }
|
all: { ...characterBaseResources }
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import ForeignDocumentUUIDField from '../fields/foreignDocumentUUIDField.mjs';
|
||||||
import DhLevelData from '../levelData.mjs';
|
import DhLevelData from '../levelData.mjs';
|
||||||
import { commonActorRules } from './base.mjs';
|
import { commonActorRules } from './base.mjs';
|
||||||
import DhCreature from './creature.mjs';
|
import DhCreature from './creature.mjs';
|
||||||
import { attributeField, stressDamageReductionRule, bonusField, GoldField } from '../fields/actorField.mjs';
|
import { attributeField, stressDamageReductionRule, bonusField, CharacterGoldField } from '../fields/actorField.mjs';
|
||||||
import { ActionField } from '../fields/actionField.mjs';
|
import { ActionField } from '../fields/actionField.mjs';
|
||||||
import DHCharacterSettings from '../../applications/sheets-configs/character-settings.mjs';
|
import DHCharacterSettings from '../../applications/sheets-configs/character-settings.mjs';
|
||||||
import { getArmorSources } from '../../helpers/utils.mjs';
|
import { getArmorSources } from '../../helpers/utils.mjs';
|
||||||
|
|
@ -64,7 +64,7 @@ export default class DhCharacter extends DhCreature {
|
||||||
core: new fields.BooleanField({ initial: false })
|
core: new fields.BooleanField({ initial: false })
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
gold: new GoldField(),
|
gold: new CharacterGoldField(),
|
||||||
scars: new fields.NumberField({ initial: 0, integer: true, label: 'DAGGERHEART.GENERAL.scars' }),
|
scars: new fields.NumberField({ initial: 0, integer: true, label: 'DAGGERHEART.GENERAL.scars' }),
|
||||||
biography: new fields.SchemaField({
|
biography: new fields.SchemaField({
|
||||||
background: new fields.HTMLField(),
|
background: new fields.HTMLField(),
|
||||||
|
|
|
||||||
|
|
@ -126,4 +126,15 @@ class GoldField extends fields.SchemaField {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { attributeField, ResourcesField, GoldField, stressDamageReductionRule, bonusField };
|
class CharacterGoldField extends GoldField {
|
||||||
|
getInitialValue(options) {
|
||||||
|
const base = super.getInitialValue(options);
|
||||||
|
const initialCurrency = CONFIG.DH.RESOURCE.character.initialCurrency;
|
||||||
|
for (const type of ['coins', 'handfuls', 'bags', 'chests']) {
|
||||||
|
base[type] = initialCurrency[type];
|
||||||
|
}
|
||||||
|
return base;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export { attributeField, ResourcesField, GoldField, CharacterGoldField, stressDamageReductionRule, bonusField };
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { defaultRestOptions } from '../../config/generalConfig.mjs';
|
||||||
import { resetAndRerenderActors } from '../../helpers/utils.mjs';
|
import { resetAndRerenderActors } from '../../helpers/utils.mjs';
|
||||||
import { ActionsField } from '../fields/actionField.mjs';
|
import { ActionsField } from '../fields/actionField.mjs';
|
||||||
|
|
||||||
const currencyField = (initial, label, icon) =>
|
const currencyField = (initial, label, icon, initialAmount = 0) =>
|
||||||
new foundry.data.fields.SchemaField({
|
new foundry.data.fields.SchemaField({
|
||||||
enabled: new foundry.data.fields.BooleanField({ required: true, initial: true }),
|
enabled: new foundry.data.fields.BooleanField({ required: true, initial: true }),
|
||||||
label: new foundry.data.fields.StringField({
|
label: new foundry.data.fields.StringField({
|
||||||
|
|
@ -10,7 +10,14 @@ const currencyField = (initial, label, icon) =>
|
||||||
initial,
|
initial,
|
||||||
label
|
label
|
||||||
}),
|
}),
|
||||||
icon: new foundry.data.fields.StringField({ required: true, nullable: false, blank: true, initial: icon })
|
icon: new foundry.data.fields.StringField({ required: true, nullable: false, blank: true, initial: icon }),
|
||||||
|
initialAmount: new foundry.data.fields.NumberField({
|
||||||
|
required: true,
|
||||||
|
integer: true,
|
||||||
|
min: 0,
|
||||||
|
initial: initialAmount,
|
||||||
|
label: 'DAGGERHEART.SETTINGS.Homebrew.currency.initialAmount'
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
const restMoveField = () =>
|
const restMoveField = () =>
|
||||||
|
|
@ -108,7 +115,8 @@ export default class DhHomebrew extends foundry.abstract.DataModel {
|
||||||
handfuls: currencyField(
|
handfuls: currencyField(
|
||||||
'Handfuls',
|
'Handfuls',
|
||||||
'DAGGERHEART.SETTINGS.Homebrew.currency.handfulName',
|
'DAGGERHEART.SETTINGS.Homebrew.currency.handfulName',
|
||||||
'fa-solid fa-coins'
|
'fa-solid fa-coins',
|
||||||
|
1
|
||||||
),
|
),
|
||||||
bags: currencyField('Bags', 'DAGGERHEART.SETTINGS.Homebrew.currency.bagName', 'fa-solid fa-sack'),
|
bags: currencyField('Bags', 'DAGGERHEART.SETTINGS.Homebrew.currency.bagName', 'fa-solid fa-sack'),
|
||||||
chests: currencyField(
|
chests: currencyField(
|
||||||
|
|
@ -193,6 +201,7 @@ export default class DhHomebrew extends foundry.abstract.DataModel {
|
||||||
for (const type of ['coins', 'handfuls', 'bags', 'chests']) {
|
for (const type of ['coins', 'handfuls', 'bags', 'chests']) {
|
||||||
const initial = this.schema.fields.currency.fields[type].getInitialValue();
|
const initial = this.schema.fields.currency.fields[type].getInitialValue();
|
||||||
source.currency[type] = foundry.utils.mergeObject(initial, source.currency[type], { inplace: false });
|
source.currency[type] = foundry.utils.mergeObject(initial, source.currency[type], { inplace: false });
|
||||||
|
source.currency[type].initialAmount ??= 0;
|
||||||
}
|
}
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
|
@ -230,6 +239,11 @@ export default class DhHomebrew extends foundry.abstract.DataModel {
|
||||||
...config.base
|
...config.base
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const currencyInitial = CONFIG.DH.RESOURCE.character.initialCurrency;
|
||||||
|
for (const type of ['coins', 'handfuls', 'bags', 'chests']) {
|
||||||
|
currencyInitial[type] = this.currency[type].initialAmount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -201,6 +201,23 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.currency-rows {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: auto 1fr 1fr auto;
|
||||||
|
gap: 4px;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
.currency-header-label {
|
||||||
|
text-align: center;
|
||||||
|
font-size: var(--font-size-14);
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type='checkbox'] {
|
||||||
|
justify-self: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.settings-hint {
|
.settings-hint {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
||||||
|
|
@ -47,24 +47,30 @@
|
||||||
<div class="toggleable-row spaced">
|
<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}}
|
||||||
</div>
|
</div>
|
||||||
<div class="toggleable-row">
|
<div class="currency-rows">
|
||||||
|
<span></span>
|
||||||
|
<span class="currency-header-label">{{localize "DAGGERHEART.SETTINGS.Homebrew.currency.quantityName"}}</span>
|
||||||
|
<span class="currency-header-label">{{localize "DAGGERHEART.SETTINGS.Homebrew.currency.initialAmount"}}</span>
|
||||||
|
<span></span>
|
||||||
|
|
||||||
<button class="icon {{settingFields._source.currency.coins.icon}}" data-action="editCurrencyIcon" data-currency="coins" data-tooltip="DAGGERHEART.SETTINGS.Homebrew.currency.changeIcon"></button>
|
<button class="icon {{settingFields._source.currency.coins.icon}}" data-action="editCurrencyIcon" data-currency="coins" data-tooltip="DAGGERHEART.SETTINGS.Homebrew.currency.changeIcon"></button>
|
||||||
{{formGroup settingFields.schema.fields.currency.fields.coins.fields.label value=settingFields._source.currency.coins.label localize=true}}
|
<input type="text" name="currency.coins.label" value="{{settingFields._source.currency.coins.label}}" />
|
||||||
|
<input type="number" name="currency.coins.initialAmount" value="{{settingFields._source.currency.coins.initialAmount}}" min="0" step="1" />
|
||||||
<input type="checkbox" name="currency.coins.enabled" {{checked settingFields._source.currency.coins.enabled}} />
|
<input type="checkbox" name="currency.coins.enabled" {{checked settingFields._source.currency.coins.enabled}} />
|
||||||
</div>
|
|
||||||
<div class="toggleable-row">
|
|
||||||
<button class="icon {{settingFields._source.currency.handfuls.icon}}" data-action="editCurrencyIcon" data-currency="handfuls" data-tooltip="DAGGERHEART.SETTINGS.Homebrew.currency.changeIcon"></button>
|
<button class="icon {{settingFields._source.currency.handfuls.icon}}" data-action="editCurrencyIcon" data-currency="handfuls" data-tooltip="DAGGERHEART.SETTINGS.Homebrew.currency.changeIcon"></button>
|
||||||
{{formGroup settingFields.schema.fields.currency.fields.handfuls.fields.label value=settingFields._source.currency.handfuls.label localize=true}}
|
<input type="text" name="currency.handfuls.label" value="{{settingFields._source.currency.handfuls.label}}" />
|
||||||
|
<input type="number" name="currency.handfuls.initialAmount" value="{{settingFields._source.currency.handfuls.initialAmount}}" min="0" step="1" />
|
||||||
<input type="checkbox" name="currency.handfuls.enabled" {{checked settingFields._source.currency.handfuls.enabled}} />
|
<input type="checkbox" name="currency.handfuls.enabled" {{checked settingFields._source.currency.handfuls.enabled}} />
|
||||||
</div>
|
|
||||||
<div class="toggleable-row">
|
|
||||||
<button class="icon {{settingFields._source.currency.bags.icon}}" data-action="editCurrencyIcon" data-currency="bags" data-tooltip="DAGGERHEART.SETTINGS.Homebrew.currency.changeIcon"></button>
|
<button class="icon {{settingFields._source.currency.bags.icon}}" data-action="editCurrencyIcon" data-currency="bags" data-tooltip="DAGGERHEART.SETTINGS.Homebrew.currency.changeIcon"></button>
|
||||||
{{formGroup settingFields.schema.fields.currency.fields.bags.fields.label value=settingFields._source.currency.bags.label localize=true}}
|
<input type="text" name="currency.bags.label" value="{{settingFields._source.currency.bags.label}}" />
|
||||||
|
<input type="number" name="currency.bags.initialAmount" value="{{settingFields._source.currency.bags.initialAmount}}" min="0" step="1" />
|
||||||
<input type="checkbox" name="currency.bags.enabled" {{checked settingFields._source.currency.bags.enabled}} />
|
<input type="checkbox" name="currency.bags.enabled" {{checked settingFields._source.currency.bags.enabled}} />
|
||||||
</div>
|
|
||||||
<div class="toggleable-row">
|
|
||||||
<button class="icon {{settingFields._source.currency.chests.icon}}" data-action="editCurrencyIcon" data-currency="chests" data-tooltip="DAGGERHEART.SETTINGS.Homebrew.currency.changeIcon"></button>
|
<button class="icon {{settingFields._source.currency.chests.icon}}" data-action="editCurrencyIcon" data-currency="chests" data-tooltip="DAGGERHEART.SETTINGS.Homebrew.currency.changeIcon"></button>
|
||||||
{{formGroup settingFields.schema.fields.currency.fields.chests.fields.label value=settingFields._source.currency.chests.label localize=true}}
|
<input type="text" name="currency.chests.label" value="{{settingFields._source.currency.chests.label}}" />
|
||||||
|
<input type="number" name="currency.chests.initialAmount" value="{{settingFields._source.currency.chests.initialAmount}}" min="0" step="1" />
|
||||||
<input type="checkbox" name="currency.chests.enabled" {{checked settingFields._source.currency.chests.enabled}} />
|
<input type="checkbox" name="currency.chests.enabled" {{checked settingFields._source.currency.chests.enabled}} />
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue