Created
February 11, 2019 08:12
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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