23 lines
957 B
JavaScript
23 lines
957 B
JavaScript
/**
|
|
* Perform a system migration for the entire World, applying migrations for Actors, Items, and Compendium packs
|
|
* @return {Promise} A Promise which resolves once the migration is completed
|
|
*/
|
|
export const migrateWorld = async function () {
|
|
ui.notifications.info(
|
|
`Applying System Migration for version ${game.system.data.version}. Please be patient and do not close your game or shut down your server.`,
|
|
{permanent: true}
|
|
);
|
|
|
|
console.log(game.system.data.version)
|
|
|
|
game.items.forEach((item) => {
|
|
// Migrate to v0.1 from v0.0.1 and v0.0.1
|
|
if (item.data.type === "spell") {
|
|
item.update({"data.roll.label": "SPELL.ROLLTITLE"});
|
|
}
|
|
});
|
|
|
|
// Set the migration as complete
|
|
game.settings.set("kopparhavet", "worldSchemaVersion", game.system.data.version);
|
|
ui.notifications.info(`System Migration to version ${game.system.data.version} completed!`, { permanent: true });
|
|
} |