Closed websterguy closed 2 years ago
As little background: The problem stems from .toConsumable() previously returning ItemData, and now it returns just the object used for creating items. Both have good and bad sides, but since you are never going to deal with the original document, getting ItemData was meaningless complication.
Sorry for submitting an MR to PF1 that changed this. (I guess?)
Fixed in 3.5.6 as follows:
if (entity) {
const consumable = await CONFIG.Item.documentClasses.spell.toConsumable(entity.toObject(), consumableType);
if (consumableType == "wand")
consumable.data.uses.value = parseInt(charges);
else
consumable.data.quantity = parseInt(charges);
gear.rawName = consumable.name;
// Following is somewhat redundant re-creation
entity = await Item.create(consumable, {temporary: true});
}
The code tries to run
.update
before it is an actual Item, which fails.https://github.com/Lavaeolous/PF1-StatBlock-Converter-Module/blob/master/statblock-converter/scripts/sbcParsers.js#L4012
should be
The creation isn't redundant,
spell.toConsumable()
returns a data object instead of an Item. So just have to edit the data object then create the Item.