From 79d88fe4045ea209c7ec3612edb5b96044c6e1f2 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 24 Jan 2011 05:33:44 +0200 Subject: Show job xp in particles. --- src/localplayer.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'src/localplayer.cpp') diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 67ba0db3c..3ce1ae7a9 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -1505,6 +1505,43 @@ void LocalPlayer::event(Channels channel, const Mana::Event &event) break; }; } + else if (event.getName() == EVENT_UPDATESTAT) + { + int id = event.getInt("id"); + if (id == Net::getPlayerHandler()->getJobLocation()) + { + std::pair exp + = PlayerInfo::getStatExperience(id); + if (event.getInt("oldValue1") > exp.first + || !event.getInt("oldValue2")) + { + return; + } + + int change = exp.first - event.getInt("oldValue1"); + if (change != 0 && mMessages.size() < 20) + { + if (mMessages.size() > 0) + { + MessagePair pair = mMessages.back(); + if (pair.first.find(" xp") == pair.first.size() - 3) + { + mMessages.pop_back(); + pair.first += ", " + toString(change) + " job"; + mMessages.push_back(pair); + } + else + { + addMessageToQueue(toString(change) + " job"); + } + } + else + { + addMessageToQueue(toString(change) + " job"); + } + } + } + } } } -- cgit v1.2.3-70-g09d2