mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 11:41:08 +01:00
Fixed migration of countdowns
This commit is contained in:
parent
dcd42656f0
commit
35c92ffcf4
1 changed files with 28 additions and 6 deletions
|
|
@ -150,12 +150,34 @@ export async function runMigrations() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Migrate old countdown structure */
|
/* Migrate old countdown structure */
|
||||||
const { narrative, encounter } = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns);
|
const countdownSettings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns);
|
||||||
if (narrative) {
|
const getCountdowns = (data, type) => {
|
||||||
narrative.countdowns;
|
return Object.keys(data.countdowns).reduce((acc, key) => {
|
||||||
}
|
const countdown = data.countdowns[key];
|
||||||
if (encounter) {
|
acc[key] = {
|
||||||
}
|
...countdown,
|
||||||
|
type: type,
|
||||||
|
ownership: Object.keys(countdown.ownership.players).reduce((acc, key) => {
|
||||||
|
acc[key] = countdown.ownership.players[key].type;
|
||||||
|
return acc;
|
||||||
|
}, {}),
|
||||||
|
progress: {
|
||||||
|
...countdown.progress,
|
||||||
|
type: countdown.progress.value
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return acc;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
await countdownSettings.updateSource({
|
||||||
|
countdowns: {
|
||||||
|
...getCountdowns(countdownSettings.narrative, CONFIG.DH.GENERAL.countdownBaseTypes.narrative.id),
|
||||||
|
...getCountdowns(countdownSettings.encounter, CONFIG.DH.GENERAL.countdownBaseTypes.encounter.id)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
await game.settings.set(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns, countdownSettings);
|
||||||
|
|
||||||
lastMigrationVersion = '1.2.0';
|
lastMigrationVersion = '1.2.0';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue