Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ultrakorne committed Jun 13, 2021
2 parents 5da5503 + e79a80c commit 3e33183
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions scripts/loot/loot-creator.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ export class LootCreator {
const lootCurrency = this.currencyData;
for (var key in lootCurrency) {
if (currencyData.hasOwnProperty(key)) {
const amount = Number(currencyData[key].value || 0) + Number(lootCurrency[key]);
currencyData[key] = {"value": amount.toString()};
if (typeof(currencyData[key]) == 'object') {
const amount = Number(currencyData[key].value || 0) + Number(lootCurrency[key]);
currencyData[key] = {"value": amount.toString()};
} else {
const amount = Number(currencyData[key] || 0) + Number(lootCurrency[key]);
currencyData[key] = amount.toString();
}
}
}
await this.actor.update({"data.currency": currencyData});
Expand Down

0 comments on commit 3e33183

Please sign in to comment.