Log error and continue when malformed minAmount in JSON (#219)

This commit is contained in:
downthecrop 2023-06-04 11:20:20 +09:00 committed by GitHub
parent 2c699a1520
commit 1a6b8ffd6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -231,6 +231,10 @@ export default {
}
getExpectedQuantity() {
let t = 0;
if(this.minAmount > this.maxAmount ) {
console.error("ERROR WITH DROP ID", this.id, "- MinValue > MaxValue")
return(0)
}
const range = Array(this.maxAmount - this.minAmount + 1).fill(1).map((x, y) => this.minAmount + y);
return ((range.reduce((a, b) => a + b, t) / range.length * (this.rarity / 100))).toFixed(2)
}