spells from SRD

This commit is contained in:
Mark
2016-02-16 17:20:54 +01:00
parent 229145c9ba
commit 5019580027
3 changed files with 24 additions and 2 deletions
File diff suppressed because one or more lines are too long
@@ -3,7 +3,7 @@
<div class="npc-content-wrap">
<div class="compendium-drop-target">
<input type="hidden" name="attr_content_srd" accept="Content">
<input type="hidden" name="attr_spell_book_srd" accept="Spell Book">
<input type="hidden" name="attr_spells_srd" accept="Spell Book">
<input type="checkbox" name="attr_npc_edit" class="toggle-npc-edit hidden">
<div class="shaped-row">
@@ -1954,6 +1954,28 @@ on('change:saving_throws_srd', function () {
updateSavingThrowsFromSRD();
});
function updateSpellsFromSRD () {
var collectionArray = ['spells_srd'];
var finalSetAttrs = {};
getAttrs(collectionArray, function (v) {
var spells = v.spells_srd.split(', ');
for (var i = 0; i < spells.length; i++) {
var newRowId = generateRowID();
var repeatingString = 'repeating_spell_' + newRowId + '_';
finalSetAttrs[repeatingString + 'name'] = spells[i];
}
console.log('updateSpellsFromSRD', finalSetAttrs);
setFinalAttrs(v, finalSetAttrs);
});
}
on('change:spells_srd', function () {
updateSpellsFromSRD();
});
var sheetOpened = function () {
var collectionArray = ['version', 'strength', 'dexterity', 'constitution', 'intelligence', 'wisdom', 'charisma'];
var finalSetAttrs = {};