User: Add experience / levels
Each drop and claim hands out 10 and 5 xp respectively. The profile then renders the users current level based on the formula 0.5 * sqrt(exp)
This commit is contained in:
@@ -61,6 +61,8 @@ module.exports = {
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
);
|
||||
}
|
||||
//add 10 experience to the user
|
||||
await user.addExperience(10);
|
||||
|
||||
const file = new AttachmentBuilder(deckImage);
|
||||
|
||||
@@ -93,7 +95,7 @@ module.exports = {
|
||||
cards[cardId].userId = claimUser.id;
|
||||
await UserUtils.setCooldown(claimUser, "pull", await GeneralUtils.getBotProperty("pullTimeout"));
|
||||
await cards[cardId].save();
|
||||
|
||||
await claimUser.addExperience(5);
|
||||
//fetch character name from database given the character id
|
||||
let character = await Character.findOne({
|
||||
attributes: ["name"],
|
||||
|
||||
@@ -20,7 +20,7 @@ module.exports = {
|
||||
profileTemplate = profileTemplate.replace(/{{USERNAME}}/g, interaction.member.displayName.substr(0,15)+(interaction.member.displayName.length>15?'...':''));
|
||||
profileTemplate = profileTemplate.replace(/{{HEADER_COLOR}}/g, '190,31,97');
|
||||
profileTemplate = profileTemplate.replace(/{{CC}}/g, await Card.count({where: {userId: user.id}}));
|
||||
profileTemplate = profileTemplate.replace(/{{LVL}}/g, "0");
|
||||
profileTemplate = profileTemplate.replace(/{{LVL}}/g, await user.getLevel());
|
||||
|
||||
let slots = ['slotOne', 'slotTwo', 'slotThree', 'slotFour'];
|
||||
let renderedCards = [];
|
||||
|
||||
Reference in New Issue
Block a user