diff --git a/Official Savage Worlds/SavageWorldsCharSheet.html b/Official Savage Worlds/SavageWorldsCharSheet.html index dec5d125b4..be6e2880ff 100644 --- a/Official Savage Worlds/SavageWorldsCharSheet.html +++ b/Official Savage Worlds/SavageWorldsCharSheet.html @@ -2137,37 +2137,20 @@ const requiredAttrLookup = new Proxy(requiredAttrLookupBase, genericLookupHandle //statblock (object): base object dropped from the compendium //callback (function): A function that will use the parsed compendium lookup data to finish the drag and drop of the item //The callback function receives the parsed statblock as an argument -const independentProducts = ['Savage Worlds Adventure Edition','Pathfinder for Savage Worlds']; const compendiumLookup = function({queue, callback}) { - getProductLines([...independentProducts],(IDPathways)=>{ - compendiumDataLookup({queue,callback,IDPathways}); - }); -}; - -/** - * - * @param {array} queue - Array of product index pages to work through - * @param {function} callback - The function to call when a valid product index page is found. - * @returns {void} - */ -const getProductLines = function(queue,callback){ - const curr = queue.shift(); - getCompendiumPage(`Introduction:${curr}`,(data)=>{ - if(data.data.blobs.IDPathways){ + getCompendiumPage(`Introduction:BookIndex`,(data)=>{ + if(data.data['data-IDPathways']){ try{ - const IDPathways = JSON.parse(data.data.blobs.IDPathways['data-IDPathways']); - callback(IDPathways); + const IDPathways = JSON.parse(data.data['data-IDPathways']); + compendiumDataLookup({queue,callback,IDPathways}); }catch(err){ debug('No IDPathways found, exiting drag and drop'); - return null; } - }else if(!queue.length){ - debug(`!!! No product index page found. No valid base compendiums present !!!`); }else{ - getProductLines(queue,callback); + debug(`!!! No product index page found. No valid base compendiums present !!!`); } }); -} +}; const compendiumDataLookup = function({queue, callback, origBlock,IDPathways}){ origBlock = origBlock || queue[0]; @@ -3215,6 +3198,8 @@ const compendiumBestiary = function () { lookupObj.display_name ? (finalCharacterDetails.character_name = lookupObj.display_name) : log('Character Name', 'Using compendium default', r20color); + finalCharacterDetails.sheet_theme = lookupObj['data-sheet_theme'] || 0; + finalCharacterDetails.rolltemplate_theme = lookupObj['data-rolltemplate_theme'] || 'default'; //switch character sheet view to mini-view //run dice handling finalCharacterDetails = processAdditionalPHEGs(lookupObj,finalCharacterDetails,monster); @@ -3311,10 +3296,11 @@ const processAdditionalPHEGs = function(lookupObj,finalCharacterDetails,monster) on('change:CompendiumCategory', function (eventInfo) { log('Compendium Drop', eventInfo.newValue, '#E948C9'); log('Compendium Change Source', eventInfo.sourceType, r20color); + debug(eventInfo); if (eventInfo.newValue !== '') { let cCategory = eventInfo.newValue; let resetFields; - if(cCategory === 'Bestiary'){ + if(cCategory === 'Bestiary' ||cCategory === 'Archetypes' || cCategory === 'SWADE Archetypes'){ compendiumBestiary(); }else{ compendiumDrop(cCategory);