Describe the bug
I've just done the math and was wondering why the leaderboard with ?top says I have less XP than I should have by accumulating the values of the past levels shown on the profile card shown with ?profile. I couldn't wrap my head around it until I've tried around with some users. Seems like the XP required shown in the XP bar in the profile is calculated here:
But the top leaderboard and the XP that actually leads to levelups uses this formula:
|
return level * 65 + 139 * level * (level - 1) // 2 |
One example: the profile card said the user is Level 3 and at 468/621 XP to level up. But when I did check the leaderboard, it said they had 1080 points. I used the second formula to calculate that they needed 1094 XP to level up. So 14 XP more, not 153 XP like their profile said. They wrote a message, it gave 17 XP and they leveled up. The leaderboard showed 1097 points and their profile said Level 4 and 3/760 XP. the 760 needed is of course incorrect again. From 4 to 5 you need 621 XP to level up, not 760 (as calculated via the second formula). I've plotted the actual values in this pastebin. The "earned" value is interesting for the leaderboards. I assume that the XP required is calculated by the wrong formula here:
|
exp_total = await self._required_exp(userinfo["servers"][str(server.id)]["level"]) |
I think you just need to use the second formula and subtract the overall XP for the next level from the overall XP of the current level. My guess could be wrong, though.
To Reproduce
Chat until ?top says you're less than 20 XP away to a level up according to a value in the pastebin, e.g. 269 XP for level 2. Do ?profile and see how it says you need more than 20 XP for the level up. Write a message that yields XP. Check ?profile again and see that you've gained a level up.
Expected behavior
The profile exp total for the level should be correct, for example with the formula mentioned above.
Bot's logs
No error or anything.
Red version
v3.4.0
Additional context
n/a
Describe the bug
I've just done the math and was wondering why the leaderboard with
?topsays I have less XP than I should have by accumulating the values of the past levels shown on the profile card shown with?profile. I couldn't wrap my head around it until I've tried around with some users. Seems like the XP required shown in the XP bar in the profile is calculated here:Fixator10-Cogs/leveler/leveler.py
Line 3620 in b96ff1f
But the top leaderboard and the XP that actually leads to levelups uses this formula:
Fixator10-Cogs/leveler/leveler.py
Line 3623 in b96ff1f
One example: the profile card said the user is Level 3 and at 468/621 XP to level up. But when I did check the leaderboard, it said they had 1080 points. I used the second formula to calculate that they needed 1094 XP to level up. So 14 XP more, not 153 XP like their profile said. They wrote a message, it gave 17 XP and they leveled up. The leaderboard showed 1097 points and their profile said Level 4 and 3/760 XP. the 760 needed is of course incorrect again. From 4 to 5 you need 621 XP to level up, not 760 (as calculated via the second formula). I've plotted the actual values in this pastebin. The "earned" value is interesting for the leaderboards. I assume that the XP required is calculated by the wrong formula here:
Fixator10-Cogs/leveler/leveler.py
Line 3022 in b96ff1f
I think you just need to use the second formula and subtract the overall XP for the next level from the overall XP of the current level. My guess could be wrong, though.
To Reproduce
Chat until
?topsays you're less than 20 XP away to a level up according to a value in the pastebin, e.g. 269 XP for level 2. Do?profileand see how it says you need more than 20 XP for the level up. Write a message that yields XP. Check?profileagain and see that you've gained a level up.Expected behavior
The profile exp total for the level should be correct, for example with the formula mentioned above.
Bot's logs
No error or anything.
Red version
v3.4.0
Additional context
n/a