Update vtt types
This commit is contained in:
parent
623558dc78
commit
c57960c153
24 changed files with 144 additions and 107 deletions
|
@ -2,25 +2,25 @@
|
|||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import { getGame } from "./helpers";
|
||||
import logger from "./logger";
|
||||
import { migrate as migrate001 } from "./migrations/001";
|
||||
// import { migrate as migrate002 } from "./migrations/002";
|
||||
// import { migrate as migrate003 } from "./migrations/003";
|
||||
// import { migrate as migrate004 } from "./migrations/004";
|
||||
|
||||
import notifications from "./ui/notifications";
|
||||
|
||||
async function migrate(): Promise<void> {
|
||||
if (!game.user?.isGM) {
|
||||
if (!getGame().user?.isGM) {
|
||||
return;
|
||||
}
|
||||
|
||||
const oldMigrationVersion = game.settings.get("ds4", "systemMigrationVersion");
|
||||
const oldMigrationVersion = getGame().settings.get("ds4", "systemMigrationVersion");
|
||||
|
||||
const targetMigrationVersion = migrations.length;
|
||||
|
||||
if (isFirstWorldStart(oldMigrationVersion)) {
|
||||
game.settings.set("ds4", "systemMigrationVersion", targetMigrationVersion);
|
||||
getGame().settings.set("ds4", "systemMigrationVersion", targetMigrationVersion);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ async function migrate(): Promise<void> {
|
|||
}
|
||||
|
||||
async function migrateFromTo(oldMigrationVersion: number, targetMigrationVersion: number): Promise<void> {
|
||||
if (!game.user?.isGM) {
|
||||
if (!getGame().user?.isGM) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ async function migrateFromTo(oldMigrationVersion: number, targetMigrationVersion
|
|||
|
||||
if (migrationsToExecute.length > 0) {
|
||||
notifications.info(
|
||||
game.i18n.format("DS4.InfoSystemUpdateStart", {
|
||||
getGame().i18n.format("DS4.InfoSystemUpdateStart", {
|
||||
currentVersion: oldMigrationVersion,
|
||||
targetVersion: targetMigrationVersion,
|
||||
}),
|
||||
|
@ -48,10 +48,10 @@ async function migrateFromTo(oldMigrationVersion: number, targetMigrationVersion
|
|||
logger.info("executing migration script ", currentMigrationVersion);
|
||||
try {
|
||||
await migration();
|
||||
game.settings.set("ds4", "systemMigrationVersion", currentMigrationVersion);
|
||||
getGame().settings.set("ds4", "systemMigrationVersion", currentMigrationVersion);
|
||||
} catch (err) {
|
||||
notifications.error(
|
||||
game.i18n.format("DS4.ErrorDuringMigration", {
|
||||
getGame().i18n.format("DS4.ErrorDuringMigration", {
|
||||
currentVersion: oldMigrationVersion,
|
||||
targetVersion: targetMigrationVersion,
|
||||
migrationVersion: currentMigrationVersion,
|
||||
|
@ -65,7 +65,7 @@ async function migrateFromTo(oldMigrationVersion: number, targetMigrationVersion
|
|||
}
|
||||
|
||||
notifications.info(
|
||||
game.i18n.format("DS4.InfoSystemUpdateCompleted", {
|
||||
getGame().i18n.format("DS4.InfoSystemUpdateCompleted", {
|
||||
currentVersion: oldMigrationVersion,
|
||||
targetVersion: targetMigrationVersion,
|
||||
}),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue