mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 07:59:03 +01:00
Merged with main
This commit is contained in:
commit
a5b656f533
51 changed files with 650 additions and 1032 deletions
|
|
@ -170,7 +170,9 @@ export function ActionMixin(Base) {
|
|||
if (!type || !game.system.api.models.actions.actionsTypes[type]) {
|
||||
({ type } =
|
||||
(await foundry.applications.api.DialogV2.input({
|
||||
window: { title: 'Select Action Type' },
|
||||
window: { title: game.i18n.localize('DAGGERHEART.CONFIG.SelectAction.selectType') },
|
||||
position: { width: 300 },
|
||||
classes: ['daggerheart', 'dh-style'],
|
||||
content: await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/actionTypes/actionType.hbs',
|
||||
{ types: CONFIG.DH.ACTIONS.actionTypes }
|
||||
|
|
@ -202,11 +204,20 @@ export function ActionMixin(Base) {
|
|||
}
|
||||
|
||||
async update(updates, options = {}) {
|
||||
const path = this.inCollection ? `system.${this.systemPath}.${this.id}` : `system.${this.systemPath}`,
|
||||
const isSetting = !this.parent.parent;
|
||||
const basePath = isSetting ? this.systemPath : `system.${this.systemPath}`;
|
||||
const path = this.inCollection ? `${basePath}.${this.id}` : basePath;
|
||||
let result = null;
|
||||
if (isSetting) {
|
||||
await this.parent.updateSource({ [path]: updates }, options);
|
||||
result = this.parent;
|
||||
} else {
|
||||
result = await this.item.update({ [path]: updates }, options);
|
||||
}
|
||||
|
||||
return this.inCollection
|
||||
? foundry.utils.getProperty(result, `system.${this.systemPath}`).get(this.id)
|
||||
: foundry.utils.getProperty(result, `system.${this.systemPath}`);
|
||||
? foundry.utils.getProperty(result, basePath).get(this.id)
|
||||
: foundry.utils.getProperty(result, basePath);
|
||||
}
|
||||
|
||||
delete() {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ const attributeField = label =>
|
|||
|
||||
const resourceField = (max = 0, label, reverse = false) =>
|
||||
new fields.SchemaField({
|
||||
value: new fields.NumberField({ initial: 0, integer: true, label }),
|
||||
value: new fields.NumberField({ initial: 0, min: 0, integer: true, label }),
|
||||
max: new fields.NumberField({ initial: max, integer: true }),
|
||||
isReversed: new fields.BooleanField({ initial: reverse })
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue