show in profile how much xp needed for new level

This commit is contained in:
JonnyBro 2021-12-25 15:32:59 +05:00
parent 64794ba36a
commit 315954df14
2 changed files with 4 additions and 3 deletions

View file

@ -69,7 +69,7 @@ class Profile extends Command {
points: userData.rep points: userData.rep
}), true) }), true)
.addField(message.translate("economy/profile:LEVEL"), `**${memberData.level}**`, 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: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: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) .addField(message.translate("economy/profile:LOVER"), (!userData.lover ? message.translate("economy/profile:NO_LOVER") : this.client.users.cache.get(userData.lover).tag), true)

View file

@ -196,14 +196,15 @@ async function updateXp(msg, data) {
if (isInCooldown) { if (isInCooldown) {
if (isInCooldown > Date.now()) return; if (isInCooldown > Date.now()) return;
}; };
// Records in the database the time when the member will be able to win xp again (1min) // Records in the database the time when the member will be able to win xp again (1min)
const toWait = Date.now() + 60000; const toWait = Date.now() + 60000;
xpCooldown[msg.author.id] = toWait; xpCooldown[msg.author.id] = toWait;
// Gets a random number between 10 and 5 // 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 // calculation how many xp it takes for the next new one
const neededXp = 5 * (level * level) + 80 * level + 100; const neededXp = 5 * (level * level) + 80 * level + 100;