foundryvtt / dnd5e

An implementation of the 5th Edition game system for Foundry Virtual Tabletop (http://foundryvtt.com).
MIT License
304 stars 210 forks source link

[Bug] Spells in compendium lost components/properties in migration to DnD 3 #3940

Open flyingsquad opened 1 month ago

flyingsquad commented 1 month ago

I had a lot of spells in compendiums that lost the components (V, S, M, Concentration) when they migrated to DnD 3. This didn't happen to spells that were on characters, which migrated without errors.

I noticed that the internal representation of these data was changed in DnD 3, to a collection of property strings rather than boolen flags, and the migration apparently didn't handle that conversion.

I searched the issue database and couldn't find any reports about this, so I'm not sure whether this has been fixed, or was just a glitch that only happened on my system.

krbz999 commented 1 month ago

There isn't any automated migration for personal compendiums if they are located in a module (such as a 'compendium module'). You would be required to run the migration scripts yourself for now.

flyingsquad commented 1 month ago

Thanks for the response. How do I run the migration script myself?

krbz999 commented 1 month ago

Step 0: Make a backup.

Step 1: Run macro.

const id = "<id of your module goes here>";
const packs = game.modules.get(id).packs.map(p => game.packs.get(p.id));
for (const pack of packs) {
  await pack.configure({locked: false});
  await dnd5e.migrations.migrateCompendium(pack);
}
ui.notifications.info("Migration completed!");

Step 2: Wait for macro to finish.

Step 3: Run second macro.

const id = "<id of your module goes here>";
const packs = game.modules.get(id).packs.map(p => game.packs.get(p.id));
for (const pack of packs) await dnd5e.migrations.refreshCompendium(pack);
ui.notifications.info("All compendiums have been refreshed!");