diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index c67b91d..2ec308a 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,7 +4,13 @@
-
+
+
+
+
+
+
+
@@ -73,10 +79,68 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -99,6 +163,7 @@
+
1640148826800
diff --git a/bot.js b/bot.js
index 0fd1dce..06a8357 100644
--- a/bot.js
+++ b/bot.js
@@ -54,6 +54,7 @@ client.misc = {
charsNum: 0,
charsLove: new Discord.Collection(),
monners: {},
+ lastMonners: {},
monnersNames: new Map(),
spin: new spinnies(),
rp: new Map(),
diff --git a/events/messageCreate.js b/events/messageCreate.js
index 80ff409..14aa1a4 100644
--- a/events/messageCreate.js
+++ b/events/messageCreate.js
@@ -122,6 +122,17 @@ module.exports = async (client, message) => {
if (!client.misc.cache.monners[message.author.id]) {
let tmonners = await Monners.findOne({uid: message.author.id}) || new Monners({uid: message.author.id});
client.misc.cache.monners[message.author.id] = tmonners.currency;
+ client.misc.cache.lastMonners[message.author.id] = new Date().getTime() - (62 * 1000);
+ }
+
+ if (message.guild && client.misc.cache.lastMonners[message.author.id] && new Date().getTime() - client.misc.cache.lastMonners[message.author.id] > 60000) {
+ client.misc.cache.monners[message.author.id] += (Math.floor(
+ (client.misc.cache.lxp.xp[message.guild.id] && client.misc.cache.lxp.xp[message.guild.id][message.author.id]
+ ? client.misc.cache.lxp.xp[message.guild.id][message.member.id].level
+ : 35)
+ / 35
+ ) + 1);
+ client.misc.cache.lastMonners[message.author.id] = new Date().getTime();
}
if (message.guild && client.misc.cache.monitEnabled.includes(message.guild.id)) {
diff --git a/util/lxp/cacheloop.js b/util/lxp/cacheloop.js
index aeaae65..b697a50 100644
--- a/util/lxp/cacheloop.js
+++ b/util/lxp/cacheloop.js
@@ -7,22 +7,28 @@ module.exports = async (client) => {
LXP.findOne({gid: gxp}).then(xp => {
if (!xp) {return;}
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().catch(() => {});
- });
xp.xp[user] = [client.misc.cache.lxp.xp[gxp][user].xp, client.misc.cache.lxp.xp[gxp][user].level];
xp.markModified(`xp.${user}`);
if (cd - client.misc.cache.lxp.xp[gxp][user].lastXP > 600000) {
delete client.misc.cache.lxp.xp[gxp][user];
- delete client.misc.cache.monners[user];
if (!Object.keys(client.misc.cache.lxp.xp[gxp]).length) {delete client.misc.cache.lxp.xp[gxp];}
}
});
xp.save().catch(() => {});
});
+
+ Object.keys(client.misc.cache.monners).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().catch(() => {});
+ if (cd - client.misc.cache.lastMonners[user] > 600000) {
+ delete client.misc.cache.monners[user];
+ delete client.misc.cache.lastMonners[user];
+ }
+ });
+ })
});
};
\ No newline at end of file
diff --git a/util/lxp/gainxp.js b/util/lxp/gainxp.js
index ccf4d93..d1aa4df 100644
--- a/util/lxp/gainxp.js
+++ b/util/lxp/gainxp.js
@@ -18,7 +18,6 @@ const applyText = (canvas, text) => {
module.exports = async (client, member, channel) => {
client.misc.cache.lxp.xp[channel.guild.id][member].lastXP = new Date().getTime();
client.misc.cache.lxp.xp[channel.guild.id][member].xp += 10;
- client.misc.cache.monners[member] += (Math.floor(client.misc.cache.lxp.xp[channel.guild.id][member].level / 35) + 1);
let x = client.misc.cache.lxp.xp[channel.guild.id][member].level;
let max = Math.ceil(100 + (((x / 3) ** 2) * 2));