Add character’s experience and level-up threshold to /characters #596
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I love tracking a character’s progress over time, and I’m already able to retrieve the wallet, inventory and level. However, in higher levels it takes a large amount of time to reach the next one. Therefore I think it would be useful to be able to track the experience bar of a character.
I’m proposing three new values that are available via
/characters
if the token hasprogression
permission:These allow you to retrieve the current absolute amount of experience as well as the amount required to reach the current and the next level.
You can use these to calculate an XP bar percentage:
(current - next_level) / (next_level - this_level) * 100
.Once a character reaches level 80, XP gained will instead count towards masteries (if the player owns HoT/PoF), which are tracked account-wide and not per character. Therefore they are out of scope for this PR. For level 80 characters,
current
andthis_level
will become and stay the same number (maximum XP, currently 4,860,359), whilenext_level
will change tofalse
, meaning that there is no next level.An alternative way to implement this would be to just return a single number for
experience
, without providingthis_level
ornext_level
. Applications would then need to consult the XP table or a (not yet implemented) separate endpoint providing it. This would be easier to implement on the server side, but harder for clients.