// SPDX-FileCopyrightText: 2021 Johannes Loher // // SPDX-License-Identifier: MIT import { getActorUpdateDataGetter, getCompendiumMigrator, getSceneUpdateDataGetter, migrateActors, migrateCompendiums, migrateItems, migrateScenes, } from "./migrationHelpers"; export async function migrate(): Promise { await migrateItems(getItemUpdateData); await migrateActors(getActorUpdateData); await migrateScenes(getSceneUpdateData); await migrateCompendiums(migrateCompendium); } function getItemUpdateData(itemData: Partial) { if (itemData.type !== "spell") return; const updateData: Record = { "-=data.scrollPrice": null, "data.minimumLevels": { healer: null, wizard: null, sorcerer: null }, }; const cooldownDurationUnit: string | undefined = itemData.data?.cooldownDuration.unit; if (cooldownDurationUnit === "custom") { updateData["data.cooldownDuration.unit"] = "rounds"; } return updateData; } const getActorUpdateData = getActorUpdateDataGetter(getItemUpdateData); const getSceneUpdateData = getSceneUpdateDataGetter(getActorUpdateData); const migrateCompendium = getCompendiumMigrator({ getItemUpdateData, getActorUpdateData, getSceneUpdateData });