monners/chest NaN failsafe

master
Kit Kasune 3 years ago
parent 441ef940aa
commit d2d02555bb
  1. 1
      util/lxp/cacheloop.js
  2. 1
      util/lxp/spawnchest.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();

@ -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;}

Loading…
Cancel
Save