From 315954df1470227efce31a0795971511cac25b2a Mon Sep 17 00:00:00 2001 From: JonnyBro Date: Sat, 25 Dec 2021 15:32:59 +0500 Subject: [PATCH] show in profile how much xp needed for new level --- commands/Economy/profile.js | 2 +- events/message.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/commands/Economy/profile.js b/commands/Economy/profile.js index cd03905f..8f51318a 100644 --- a/commands/Economy/profile.js +++ b/commands/Economy/profile.js @@ -69,7 +69,7 @@ class Profile extends Command { points: userData.rep }), true) .addField(message.translate("economy/profile:LEVEL"), `**${memberData.level}**`, true) - .addField(message.translate("economy/profile:EXP"), `**${memberData.exp}** xp`, true) + .addField(message.translate("economy/profile:EXP"), `**${memberData.exp}/${5 * (memberData.level * memberData.level) + 80 * memberData.level + 100}** xp`, true) .addField(message.translate("economy/profile:REGISTERED"), message.printDate(new Date(memberData.registeredAt)), true) .addField(message.translate("economy/profile:BIRTHDATE"), (!userData.birthdate ? message.translate("economy/profile:NO_BIRTHDATE"): message.printDate(new Date(userData.birthdate))), true) .addField(message.translate("economy/profile:LOVER"), (!userData.lover ? message.translate("economy/profile:NO_LOVER") : this.client.users.cache.get(userData.lover).tag), true) diff --git a/events/message.js b/events/message.js index 0d9da3c6..6eff3378 100644 --- a/events/message.js +++ b/events/message.js @@ -196,14 +196,15 @@ async function updateXp(msg, data) { if (isInCooldown) { if (isInCooldown > Date.now()) return; }; + // Records in the database the time when the member will be able to win xp again (1min) const toWait = Date.now() + 60000; xpCooldown[msg.author.id] = toWait; // Gets a random number between 10 and 5 - const won = Math.floor(Math.random() * ( Math.floor(10) - Math.ceil(5))) + Math.ceil(5); + const won = Math.floor(Math.random() * (Math.floor(10) - Math.ceil(5))) + Math.ceil(5); - const newXp = parseInt(points+won, 10); + const newXp = parseInt(points + won, 10); // calculation how many xp it takes for the next new one const neededXp = 5 * (level * level) + 80 * level + 100;