This commit is contained in:
WBHarry 2025-11-24 23:11:18 +01:00
parent 4b76223e45
commit de9a66e1bc
36 changed files with 328 additions and 116 deletions

View file

@ -167,10 +167,15 @@ export class DhCountdown extends foundry.abstract.DataModel {
initial: 1,
label: 'DAGGERHEART.APPLICATIONS.Countdown.FIELDS.countdowns.element.progress.current.label'
}),
max: new FormulaField({
start: new fields.NumberField({
required: true,
integer: true,
initial: 1,
label: 'DAGGERHEART.APPLICATIONS.Countdown.FIELDS.countdowns.element.progress.max.label',
label: 'DAGGERHEART.APPLICATIONS.Countdown.FIELDS.countdowns.element.progress.start.label',
deterministic: false
}),
startFormula: new FormulaField({
label: 'DAGGERHEART.APPLICATIONS.Countdown.FIELDS.countdowns.element.progress.startFormula.label',
deterministic: false
}),
looping: new fields.StringField({
@ -206,7 +211,7 @@ export class DhCountdown extends foundry.abstract.DataModel {
ownership: ownership,
progress: {
current: 1,
max: 1
start: 1
}
};
}
@ -225,4 +230,15 @@ export class DhCountdown extends foundry.abstract.DataModel {
return acc;
}, {});
}
/** @inheritDoc */
static migrateData(source) {
if (source.progress.max) {
source.progress.startFormula = source.progress.max;
source.progress.start = Number(source.progress.max);
source.progress.max = null;
}
return super.migrateData(source);
}
}