cstadther / adventure-import-export

A module for Foundy VTT for packaging and installing adventures.
MIT License
15 stars 7 forks source link

the module doesn't work with foundry VTT 0.8.9 #146

Open theksi opened 2 years ago

theksi commented 2 years ago

Hello, Foundry 0.8.9 Pathfinder Game system 2.14.0.8148 Adventure importer : 0.7.1 I've just finished creating an adventure on my sandbox and used adventure export, the adventure import on a brand new world. both operations went fine, unfortunately atfer the import, most of my actors were could not be opened with the following error on the console:

TypeError: trait.value.filter is not a function
[Detected 1 package: system:pf2e]
    at NPCSheetPF2e.prepareTraits (main.bundle.js:1)
    at NPCSheetPF2e.getData (main.bundle.js:1)
    at NPCSheetPF2e.getData (main.bundle.js:1)
    at NPCSheetPF2e.getData (main.bundle.js:1)
    at NPCSheetPF2e._render (foundry.js:2049)
    at B.🎁call_wrapped [as call_wrapped] (libWrapper-wrapper.js:467)
    at NPCSheetPF2e.🎁Application.prototype._render#lib-wrapper (listeners.js:118)
    at NPCSheetPF2e.🎁Application.prototype._render#0 (libWrapper-wrapper.js:162)
    at NPCSheetPF2e._render (foundry.js:2736)
    at NPCSheetPF2e.render (foundry.js:2011)
    at NPCSheetPF2e.render (foundry.js:3231)
    at ActorDirectory._onClickEntityName (foundry.js:23917)
    at ActorDirectory._onClickEntityName (foundry.js:32414)
    at HTMLOListElement.dispatch (jquery.min.js:2)
    at HTMLOListElement.v.handle (jquery.min.js:2)

I got some help from PF2 game system developper and we fixed that by running this from the console

game.actors.filter(a=>a.type==="npc").filter(a=>!Array.isArray(a.data.data.traits.traits.value)).forEach(a => {
  a.update({"data.traits.traits.value": Object.values(a.data.data.traits.traits.value)});
});

It looks like the export ruined the data schema somehow...