diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-11-01 04:22:50 +0100 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-11-01 04:22:50 +0100 |
commit | a1e61f8446b7928d854a062f6494e75fe3fec9ab (patch) | |
tree | 953cba5593a49f818612f38de1149a2763a36aa8 /src/localplayer.cpp | |
parent | 79cb8fa1ca81440e21bcb186785d47c50a608e8e (diff) | |
parent | 8954a7ca0f70bbf167c9119d26c7bca8407e8da6 (diff) | |
download | mana-a1e61f8446b7928d854a062f6494e75fe3fec9ab.tar.gz mana-a1e61f8446b7928d854a062f6494e75fe3fec9ab.tar.bz2 mana-a1e61f8446b7928d854a062f6494e75fe3fec9ab.tar.xz mana-a1e61f8446b7928d854a062f6494e75fe3fec9ab.zip |
Merge github.com:mana/mana
Conflicts:
src/localplayer.cpp
src/net/manaserv/beinghandler.cpp
src/net/manaserv/charhandler.cpp
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r-- | src/localplayer.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 0a041021..0ee35ebe 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -1032,14 +1032,24 @@ void LocalPlayer::event(Event::Channel channel, const Event &event) { if (event.getInt("id") == EXP) { - int change = 0, - oldXp = event.getInt("oldValue"), - newXp = event.getInt("newValue"); - + int change = 0; + int oldXp = event.getInt("oldValue"); + int newXp = event.getInt("newValue"); + + // When the new XP is lower than the old one, + // it means that a new level has been reached. + // Thus, the xp difference can only be obtained + // with the exp needed for the next level. + // The new XP value is then the XP obtained for the new level. if (newXp < oldXp) - change = PlayerInfo::getAttribute(EXP_NEEDED) - oldXp; + { + change = PlayerInfo::getAttribute(EXP_NEEDED) + - oldXp + newXp; + } else + { change = newXp - oldXp; + } if (change > 0) addMessageToQueue(toString(change) + " xp"); |