Fix v10 bug for shorthand attributes (#52)

Co-authored-by: Kim Mantas <kim.mantas@gmail.com>
This commit is contained in:
Matt Smith 2022-10-20 10:39:10 -05:00 committed by GitHub
parent 9e726433ea
commit 3343d3bf6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -39,7 +39,7 @@ export class SimpleActor extends Actor {
getRollData() { getRollData() {
// Copy the actor's system data // Copy the actor's system data
const data = this.toObject(false); const data = this.toObject(false).system;
const shorthand = game.settings.get("worldbuilding", "macroShorthand"); const shorthand = game.settings.get("worldbuilding", "macroShorthand");
const formulaAttributes = []; const formulaAttributes = [];
const itemAttributes = []; const itemAttributes = [];
@ -111,10 +111,10 @@ export class SimpleActor extends Actor {
// Map all items data using their slugified names // Map all items data using their slugified names
data.items = this.items.reduce((obj, item) => { data.items = this.items.reduce((obj, item) => {
const key = item.name.slugify({strict: true}); const key = item.name.slugify({strict: true});
const itemData = item.toObject(false); const itemData = item.toObject(false).system;
// Add items to shorthand and note which ones are formula attributes. // Add items to shorthand and note which ones are formula attributes.
for ( let [k, v] of Object.entries(itemData.system.attributes) ) { for ( let [k, v] of Object.entries(itemData.attributes) ) {
// When building the attribute list, prepend the item name for later use. // When building the attribute list, prepend the item name for later use.
if ( v.dtype === "Formula" ) itemAttributes.push(`${key}..${k}`); if ( v.dtype === "Formula" ) itemAttributes.push(`${key}..${k}`);
// Add shortened version of the attributes. // Add shortened version of the attributes.