Fix double XP counting in prestige system when users level up
Adjusted the `prestigeUp` function in `aethex-bot/commands/prestige.js` to correctly update `total_xp_earned` and display values, preventing duplicate XP accumulation. Replit-Commit-Author: Agent Replit-Commit-Session-Id: aed2e46d-25bb-4b73-81a1-bb9e8437c261 Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Event-Id: a792080b-bc3a-474f-8aa7-6dcea7ecb128 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/3bdfff67-975a-46ad-9845-fbb6b4a4c4b5/aed2e46d-25bb-4b73-81a1-bb9e8437c261/yTaZipL Replit-Helium-Checkpoint-Created: true
This commit is contained in:
parent
d7b41b5b4f
commit
2f414e5616
2 changed files with 6 additions and 3 deletions
4
.replit
4
.replit
|
|
@ -22,6 +22,10 @@ externalPort = 80
|
||||||
localPort = 8080
|
localPort = 8080
|
||||||
externalPort = 8080
|
externalPort = 8080
|
||||||
|
|
||||||
|
[[ports]]
|
||||||
|
localPort = 35953
|
||||||
|
externalPort = 3000
|
||||||
|
|
||||||
[workflows]
|
[workflows]
|
||||||
runButton = "Project"
|
runButton = "Project"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -193,8 +193,7 @@ async function prestigeUp(interaction, supabase, client) {
|
||||||
.from('user_profiles')
|
.from('user_profiles')
|
||||||
.update({
|
.update({
|
||||||
xp: 0,
|
xp: 0,
|
||||||
prestige_level: newPrestige,
|
prestige_level: newPrestige
|
||||||
total_xp_earned: totalEarned + currentXp
|
|
||||||
})
|
})
|
||||||
.eq('id', link.user_id);
|
.eq('id', link.user_id);
|
||||||
|
|
||||||
|
|
@ -216,7 +215,7 @@ async function prestigeUp(interaction, supabase, client) {
|
||||||
.setDescription(`Congratulations! You are now **${newPrestigeInfo.name}**!\n\n**Rewards Unlocked:**\n${getNewRewards(newPrestige).join('\n')}`)
|
.setDescription(`Congratulations! You are now **${newPrestigeInfo.name}**!\n\n**Rewards Unlocked:**\n${getNewRewards(newPrestige).join('\n')}`)
|
||||||
.addFields(
|
.addFields(
|
||||||
{ name: 'XP Bonus', value: `+${xpBonus}%`, inline: true },
|
{ name: 'XP Bonus', value: `+${xpBonus}%`, inline: true },
|
||||||
{ name: 'Total XP Earned (All Time)', value: (totalEarned + currentXp).toLocaleString(), inline: true }
|
{ name: 'Total XP Earned (All Time)', value: totalEarned.toLocaleString(), inline: true }
|
||||||
)
|
)
|
||||||
.setThumbnail(interaction.user.displayAvatarURL({ size: 256 }))
|
.setThumbnail(interaction.user.displayAvatarURL({ size: 256 }))
|
||||||
.setTimestamp();
|
.setTimestamp();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue