From d2d02555bbde2cb292a5537b3c614cc83c8140ed Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Thu, 13 Jan 2022 18:35:10 -0700 Subject: [PATCH] monners/chest NaN failsafe --- util/lxp/cacheloop.js | 1 + util/lxp/spawnchest.js | 1 + 2 files changed, 2 insertions(+) diff --git a/util/lxp/cacheloop.js b/util/lxp/cacheloop.js index bde7a52..a935651 100644 --- a/util/lxp/cacheloop.js +++ b/util/lxp/cacheloop.js @@ -9,6 +9,7 @@ module.exports = async (client) => { Object.keys(client.misc.cache.lxp.xp[gxp]).forEach(user => { Monners.findOne({uid: user}).then(m => { if (!Object.keys(client.misc.cache.monners).includes(user)) {return;} + if (isNaN(client.misc.cache.monners[user])) {return;} if (!m) {m = new Monners({uid: user});} m.currency = client.misc.cache.monners[user]; m.save(); diff --git a/util/lxp/spawnchest.js b/util/lxp/spawnchest.js index 65f94ef..a6636c1 100644 --- a/util/lxp/spawnchest.js +++ b/util/lxp/spawnchest.js @@ -57,6 +57,7 @@ module.exports = async (client, member, channel, prefix) => { }); let streakBonus = streak !== 0 ? Math.floor((Math.floor(Math.random() * (rarity.amount * .10)) * 1.5 * streak)) : 0; let amount = ri.calc_bubble() + streakBonus; //calculate the amount by allowing a 10% +/- variance, higher potential with higher streak, and adding another random bonus with streak + if (isNaN(amount)) {return;} let chests = await Chests.findOne({gid: member.guild.id}); if (!chests) {return;}