summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/localplayer.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 78395438..16382adc 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -1031,10 +1031,17 @@ void LocalPlayer::event(Event::Channel channel, const Event &event)
{
if (event.getInt("id") == EXP)
{
- int change = event.getInt("newValue")
- - event.getInt("oldValue");
+ int change = 0,
+ oldXp = event.getInt("oldValue"),
+ newXp = event.getInt("newValue");
- addMessageToQueue(toString(change) + " xp");
+ if (newXp < oldXp)
+ change = PlayerInfo::getAttribute(EXP_NEEDED) - oldXp;
+ else
+ change = newXp - oldXp;
+
+ if (change > 0)
+ addMessageToQueue(toString(change) + " xp");
}
}
}