mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-15 21:21:08 +01:00
Fixed multilevel buttons
This commit is contained in:
parent
aca1f8a541
commit
8db8619bf5
2 changed files with 11 additions and 2 deletions
|
|
@ -533,7 +533,11 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.levelup.updateSource({
|
await this.levelup.updateSource({
|
||||||
multiclass: { class: item.uuid, level: this.levelup.currentLevel },
|
multiclass: {
|
||||||
|
class: item.uuid,
|
||||||
|
level: this.levelup.currentLevel,
|
||||||
|
tier: Number(target.dataset.tier)
|
||||||
|
},
|
||||||
[target.dataset.path]: {
|
[target.dataset.path]: {
|
||||||
tier: Number(target.dataset.tier),
|
tier: Number(target.dataset.tier),
|
||||||
minCost: Number(target.dataset.minCost),
|
minCost: Number(target.dataset.minCost),
|
||||||
|
|
@ -557,6 +561,9 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
|
||||||
if (!button.checked) {
|
if (!button.checked) {
|
||||||
update[`levels.${button.dataset.level}.choices.${button.dataset.option}.-=${button.dataset.checkboxNr}`] =
|
update[`levels.${button.dataset.level}.choices.${button.dataset.option}.-=${button.dataset.checkboxNr}`] =
|
||||||
null;
|
null;
|
||||||
|
if (button.dataset.type === 'multiclass') {
|
||||||
|
update['-=multiclass'] = null;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!this.levelup.levels[this.levelup.currentLevel].nrSelections.available) {
|
if (!this.levelup.levels[this.levelup.currentLevel].nrSelections.available) {
|
||||||
ui.notifications.info(
|
ui.notifications.info(
|
||||||
|
|
@ -575,6 +582,7 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
|
||||||
value: button.dataset.value,
|
value: button.dataset.value,
|
||||||
type: button.dataset.type
|
type: button.dataset.type
|
||||||
};
|
};
|
||||||
|
update['multiclass'] = { tier: Number(button.dataset.tier), level: this.levelup.currentLevel };
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.levelup.updateSource(update);
|
await this.levelup.updateSource(update);
|
||||||
|
|
@ -639,7 +647,7 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
await this.levelup.updateSource({
|
await this.levelup.updateSource({
|
||||||
currentLevel: Math.max(this.levelup.currentLevel + 1, this.levelup.endLevel)
|
currentLevel: Math.min(this.levelup.currentLevel + 1, this.levelup.endLevel)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,7 @@ export class DhLevelup extends foundry.abstract.DataModel {
|
||||||
multiclass: new fields.SchemaField({
|
multiclass: new fields.SchemaField({
|
||||||
class: new fields.StringField({ required: true }),
|
class: new fields.StringField({ required: true }),
|
||||||
domain: new fields.StringField(),
|
domain: new fields.StringField(),
|
||||||
|
tier: new fields.NumberField({ required: true, integer: true }),
|
||||||
level: new fields.NumberField({ required: true, integer: true })
|
level: new fields.NumberField({ required: true, integer: true })
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue