So I've been fooling around(my level of javascript) with trying to convert the json data from the PF Bestiary ( npcdrop_data ) into the attributes used on the PF Community sheet. Chris B. already has an excellent parser in-place on the sheet which works very well with the free PF compendium, however the Bestiary that's available for purchase uses a different attribute schema. Not sure if it's possible, but I would like to leave the current parser in-tact and simply copy the Bestiary attributes into a format that the parser can handle. Here's an example of what I'm trying <script type="text/worker">
on("change:npcdrop_data", function () {
"use strict";
console.log("~~~compendium drop detected~~~");
getAttrs(["npcdrop_category", "npcdrop_name", "npcdrop_uniq", "npcdrop_data", "npcdrop_content"], function (v) {
var obj = JSON.parse(v.npcdrop_data);
console.log("~~~compendium drop Category: " + v.npcdrop_category);
console.log("~~~compendium drop Name: " + v.npcdrop_name);
console.log("~~~compendium drop Unique Name: " + v.npcdrop_uniq);
console.log("~~~compendium drop raw stat block: " + v.npcdrop_data);
console.log("~~~compendium drop Content: " + v.npcdrop_content);
setAttrs({
["Flat-Footed"] : obj["data-AC Flat-Footed"],
["Armor-notes"] : obj["data-AC Notes"],
Touch : obj["data-AC Touch"],
ac_compendium : obj["data-AC"],
["Acrobatics-note"] : obj["data-Acrobatics Notes"],
Acrobatics : obj["data-Acrobatics"],
alignment : obj["data-Alignment"]
});
});
});
</script> Do you think this approach would work, or would a completely new parser need to be written? Thoughts? TIA