mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-23 10:59:54 +02:00
Added some safety for missing things if someone was on a REALLY old system version and then updated all the way
This commit is contained in:
parent
453054c0e4
commit
f47ec012ea
1 changed files with 51 additions and 47 deletions
|
|
@ -155,6 +155,7 @@ export async function runMigrations() {
|
||||||
|
|
||||||
/* Migrate old countdown structure */
|
/* Migrate old countdown structure */
|
||||||
const countdownSettings = 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 (!countdownSettings.narrative || !countdownSettings.encounter) {
|
||||||
const getCountdowns = (data, type) => {
|
const getCountdowns = (data, type) => {
|
||||||
return Object.keys(data.countdowns).reduce((acc, key) => {
|
return Object.keys(data.countdowns).reduce((acc, key) => {
|
||||||
const countdown = data.countdowns[key];
|
const countdown = data.countdowns[key];
|
||||||
|
|
@ -189,11 +190,13 @@ export async function runMigrations() {
|
||||||
data: { refreshType: RefreshType.Countdown }
|
data: { refreshType: RefreshType.Countdown }
|
||||||
});
|
});
|
||||||
Hooks.callAll(socketEvent.Refresh, { refreshType: RefreshType.Countdown });
|
Hooks.callAll(socketEvent.Refresh, { refreshType: RefreshType.Countdown });
|
||||||
|
}
|
||||||
|
|
||||||
lastMigrationVersion = '1.2.0';
|
lastMigrationVersion = '1.2.0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (foundry.utils.isNewerVersion('1.2.7', lastMigrationVersion)) {
|
if (foundry.utils.isNewerVersion('1.2.7', lastMigrationVersion)) {
|
||||||
|
try {
|
||||||
const tagTeam = game.settings.get(CONFIG.DH.id, 'TagTeamRoll');
|
const tagTeam = game.settings.get(CONFIG.DH.id, 'TagTeamRoll');
|
||||||
const initatorMissing = tagTeam.initiator && !game.actors.some(actor => actor.id === tagTeam.initiator);
|
const initatorMissing = tagTeam.initiator && !game.actors.some(actor => actor.id === tagTeam.initiator);
|
||||||
const missingMembers = Object.keys(tagTeam.members).reduce((acc, id) => {
|
const missingMembers = Object.keys(tagTeam.members).reduce((acc, id) => {
|
||||||
|
|
@ -208,9 +211,10 @@ export async function runMigrations() {
|
||||||
members: missingMembers
|
members: missingMembers
|
||||||
});
|
});
|
||||||
await game.settings.set(CONFIG.DH.id, 'TagTeamRoll', tagTeam);
|
await game.settings.set(CONFIG.DH.id, 'TagTeamRoll', tagTeam);
|
||||||
|
} finally {
|
||||||
lastMigrationVersion = '1.2.7';
|
lastMigrationVersion = '1.2.7';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (foundry.utils.isNewerVersion('1.5.5', lastMigrationVersion)) {
|
if (foundry.utils.isNewerVersion('1.5.5', lastMigrationVersion)) {
|
||||||
/* Clear out Environments that were added directly from compendium */
|
/* Clear out Environments that were added directly from compendium */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue