Skip to content

Commit

Permalink
Update SystemProvider.js
Browse files Browse the repository at this point in the history
Fix #2
  • Loading branch information
mclemente committed Aug 24, 2021
1 parent aa433b0 commit 861a5b6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions module/SystemProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,18 @@ export class dnd5eProvider extends SystemProvider {
}

getTotalGP(data) {
const currency = data.currency;
const currency = foundry.utils.deepClone(data.currency);
const convert = CONFIG.DND5E.currencyConversion;
for ( let [c, t] of Object.entries(convert) ) {
let change = Math.floor(currency[c] / t.each);
currency[c] -= (change * t.each);
currency[t.into] += change;
}
return currency["pp"] * convert["gp"].each;
return currency["pp"] * convert["gp"].each
+ currency["gp"]
+ currency["ep"] / convert["ep"].each
+ (currency["sp"] / convert["sp"].each / convert["ep"].each)
+ (currency["cp"] / convert["cp"].each / convert["sp"].each / convert["ep"].each);
}

htmlDecode(input) {
Expand Down

0 comments on commit 861a5b6

Please sign in to comment.