Update to dnd 0.98 Core with some fixes

Updated to 0.98 core for 0.7.x compatability (untested)

Class Skills are pulling in automatically on class item drop to character sheet.

TODO: Expand automated skill drop for Archetypes

KNOWN ISSUE: init.value is being converted to a string causing some NaN errors on the html.  Initiative was changed to a number instead of a string in 0.98 likely some place is assuming it is still a string.  I had to use Number() on the value because it was forcing other vales to be a string because the value is "".  Maybe someone can fix this
This commit is contained in:
supervj 2020-10-08 02:20:12 -04:00
parent 4bed1d1869
commit 44312146a7
132 changed files with 748 additions and 1010 deletions

View file

@ -250,3 +250,33 @@ const _migrateRemoveDeprecated = function(ent, updateData) {
updateData[`data.${parts.join(".")}`] = null;
}
};
/* -------------------------------------------- */
/**
* A general tool to purge flags from all entities in a Compendium pack.
* @param {Compendium} pack The compendium pack to clean
* @private
*/
export async function purgeFlags(pack) {
const cleanFlags = (flags) => {
const flags5e = flags.sw5e || null;
return flags5e ? {sw5e: flags5e} : {};
};
await pack.configure({locked: false});
const content = await pack.getContent();
for ( let entity of content ) {
const update = {_id: entity.id, flags: cleanFlags(entity.data.flags)};
if ( pack.entity === "Actor" ) {
update.items = entity.data.items.map(i => {
i.flags = cleanFlags(i.flags);
return i;
})
}
await pack.updateEntity(update, {recursive: false});
console.log(`Purged flags from ${entity.name}`);
}
await pack.configure({locked: true});
}