diff options
author | Daniel O'Brien <marmot.daniel@gmail.com> | 2013-11-14 15:46:41 +0100 |
---|---|---|
committer | Daniel O'Brien <marmot.daniel@gmail.com> | 2013-11-14 15:46:41 +0100 |
commit | ea778c70278aa4032565c1c7a450f345a38c1105 (patch) | |
tree | 47168bfb3c2069e09ab5209d602bb79c9ad05b40 /source/Entities | |
parent | Merge pull request #344 from marmot21/playerxp (diff) | |
download | cuberite-ea778c70278aa4032565c1c7a450f345a38c1105.tar cuberite-ea778c70278aa4032565c1c7a450f345a38c1105.tar.gz cuberite-ea778c70278aa4032565c1c7a450f345a38c1105.tar.bz2 cuberite-ea778c70278aa4032565c1c7a450f345a38c1105.tar.lz cuberite-ea778c70278aa4032565c1c7a450f345a38c1105.tar.xz cuberite-ea778c70278aa4032565c1c7a450f345a38c1105.tar.zst cuberite-ea778c70278aa4032565c1c7a450f345a38c1105.zip |
Diffstat (limited to 'source/Entities')
-rw-r--r-- | source/Entities/Player.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source/Entities/Player.cpp b/source/Entities/Player.cpp index 098417dc5..f5c28b326 100644 --- a/source/Entities/Player.cpp +++ b/source/Entities/Player.cpp @@ -318,8 +318,10 @@ int cPlayer::XpGetLevel() float cPlayer::XpGetPercentage() { int currentLevel = CalcLevelFromXp(m_XpTotal); + int currentLevel_XpBase = XpForLevel(currentLevel); - return (float)m_XpTotal / (float)XpForLevel(1+currentLevel); + return (float)(m_XpTotal - currentLevel_XpBase) / + (float)(XpForLevel(1+currentLevel) - currentLevel_XpBase); } |