From ecd9b4fbe3e280d93139a29310ff77d30e1427a2 Mon Sep 17 00:00:00 2001 From: Jonas Karlsson Date: Wed, 25 Aug 2021 18:58:29 +0200 Subject: [PATCH] Adds basic support for loot actors (as in, pretend they have a 0 in everything they don't actually have) so that party-overview doesn't crash if the party owns a Loot Actor. --- module/SystemProvider.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/module/SystemProvider.js b/module/SystemProvider.js index e243e2c..f187ddd 100644 --- a/module/SystemProvider.js +++ b/module/SystemProvider.js @@ -316,21 +316,21 @@ export class pf2eProvider extends SystemProvider { id: actor.id, name: actor.name, hp: { - value: data.attributes.hp.value, - max: data.attributes.hp.max + value: data.attributes.hp?.value || 0, + max: data.attributes.hp?.max || 0 }, - heroPoints: data.attributes.heroPoints, - armor: data.attributes.ac.value ? data.attributes.ac.value : 10, + heroPoints: data.attributes.heroPoints || 0, + armor: data.attributes.ac?.value ? data.attributes.ac.value : 10, shieldAC: data.attributes.shield && data.attributes.shield.ac ? `(+${data.attributes.shield.ac})` : "", - perception: data.attributes.perception.value, - speed: data.attributes.speed.value, + perception: data.attributes.perception?.value || 0, + speed: data.attributes.speed?.value || 0, saves: { - fortitude: data.saves.fortitude.value, - reflex: data.saves.reflex.value, - will: data.saves.will.value, + fortitude: data.saves?.fortitude.value || 0, + reflex: data.saves?.reflex.value || 0, + will: data.saves?.will.value || 0, }, - languages: data.traits.languages ? data.traits.languages.value.map(code => game.i18n.localize(CONFIG.PF2E.languages[code])) : [], + languages: data.traits?.languages ? data.traits.languages.value.map(code => game.i18n.localize(CONFIG.PF2E.languages[code])) : [], currency: currency, lore: this.getLore(actor.data),