Skip to content

Commit

Permalink
#63 Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mclemente committed Mar 15, 2023
1 parent ddb7ccf commit 5d1f803
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions module/SystemProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,21 +130,28 @@ export class archmageProvider extends SystemProvider {

getActorDetails(actor) {
const data = actor.system;
const coins = {};
Object.keys(data.coins).forEach((coin) => {
coins[coin] = data.coins[coin].value ?? 0;
});
const coins = {
copper: 0,
gold: 0,
platinum: 0,
silver: 0,
};
if (data.coins) {
Object.keys(data.coins).forEach((coin) => {
coins[coin] = data.coins[coin].value ?? 0;
});
}
return {
id: actor.id,
name: actor.name,
hp: data.attributes.hp,
ac: data.attributes.ac,
pd: data.attributes.pd,
md: data.attributes.md,
recoveries: data.attributes.recoveries,
recoveries: data.attributes?.recoveries ?? { value: 0, max: 0 },

backgrounds: this.getBackgrounds(data.backgrounds),
icons: this.getIcons(data.icons),
backgrounds: data.backgrounds ? this.getBackgrounds(data.backgrounds) : "",
icons: data.icons ? this.getIcons(data.icons) : {},

coins: coins,
totalGP: this.getTotalGP(coins).toFixed(2),
Expand Down

0 comments on commit 5d1f803

Please sign in to comment.