Skip to content

Commit

Permalink
dnd5e: use system's conversion
Browse files Browse the repository at this point in the history
Fix #1
  • Loading branch information
mclemente committed Aug 24, 2021
1 parent ecf1ab6 commit aa433b0
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions module/SystemProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ export class dnd5eProvider extends SystemProvider {
const move = data.attributes.movement;
let extra = [];
if (move.fly) extra.push(`${move.fly} ${move.units} fly`);
if (move.hover) extra.push("hover");
if (move.hover) extra.push("hover");
if (move.burrow) extra.push(`${move.burrow} ${move.units} burrow`);
if (move.swim) extra.push(`${move.swim} ${move.units} swim`);
if (move.climb) extra.push(`${move.climb} ${move.units} climb`);
if (move.swim) extra.push(`${move.swim} ${move.units} swim`);
if (move.climb) extra.push(`${move.climb} ${move.units} climb`);

let str = `${move.walk} ${move.units}`;
if (extra.length)
Expand All @@ -80,7 +80,13 @@ export class dnd5eProvider extends SystemProvider {

getTotalGP(data) {
const currency = data.currency;
return currency.cp / 100 + currency.sp / 10 + currency.ep / 2 + currency.gp + currency.pp * 10;
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;
}

htmlDecode(input) {
Expand Down

0 comments on commit aa433b0

Please sign in to comment.