Skip to content

Commit

Permalink
fix: uses detection when uses is stored as a string instead of a number
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosFdez committed May 20, 2021
1 parent da748f2 commit 7bc0d48
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion betterrolls5e/scripts/betterrolls5e.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ CONFIG.betterRolls5e = {
quickDamage: { type: "Array", value: [], altValue: [], context: [] },
quickVersatile: { type: "Boolean", value: false, altValue: false },
quickProperties: { type: "Boolean", value: true, altValue: true },
quickCharges: { type: "Boolean", value: {quantity: false, use: false, resource: true}, altValue: {quantity: false, use: false, resource: true} },
quickCharges: { type: "Boolean", value: {quantity: false, use: false, resource: true}, altValue: {quantity: false, use: true, resource: true} },
quickTemplate: { type: "Boolean", value: true, altValue: true },
quickOther: { type: "Boolean", value: true, altValue: true, context: "" },
quickFlavor: { type: "Boolean", value: true, altValue: true },
Expand Down
5 changes: 2 additions & 3 deletions betterrolls5e/scripts/custom-roll.js
Original file line number Diff line number Diff line change
Expand Up @@ -1180,14 +1180,13 @@ export class CustomItemRoll {
}

const itemData = item.data.data;
const hasUses = !!(itemData.uses?.value || itemData.uses?.max); // Actual check to see if uses exist on the item, even if params.useCharge.use == true
const hasUses = !!(Number(itemData.uses?.value) || Number(itemData.uses?.max)); // Actual check to see if uses exist on the item, even if params.useCharge.use == true
const hasResource = !!(itemData.consume?.target); // Actual check to see if a resource is entered on the item, even if params.useCharge.resource == true

const request = this.params.useCharge; // Has bools for quantity, use, resource, and charge
const recharge = itemData.recharge || {};
const uses = itemData.uses || {};
const quantity = itemData.quantity;
const autoDestroy = uses.autoDestroy;
const { autoDestroy } = itemData.uses || {};

let output = "success";

Expand Down

0 comments on commit 7bc0d48

Please sign in to comment.