Skip to content

Instantly share code, notes, and snippets.

@palikhov
Created February 11, 2019 08:12
Show Gist options
  • Save palikhov/bf1130dc045d8836396acd7ca83427da to your computer and use it in GitHub Desktop.
Save palikhov/bf1130dc045d8836396acd7ca83427da to your computer and use it in GitHub Desktop.
Character to Handout: Migrate character bio/gm notes/avatar into handouts with the character names
(function(){
Campaign.characters.models.forEach(m => {
if(!confirm(m.attributes.name)) return;
let handout = Campaign.handouts.create({
name: m.attributes.name,
avatar: m.attributes.avatar
});
const migrateBlob = (sourceName, destName) => {
m._getLatestBlob(sourceName, data => {
handout.updateBlobs({
[destName]: data
});
handout.save({
[destName]: Date.now()
});
});
};
migrateBlob("bio", "notes");
migrateBlob("gmnotes", "gmnotes");
});
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment