summaryrefslogtreecommitdiff
path: root/src/localplayer.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-01-24 05:33:44 +0200
committerAndrei Karas <akaras@inbox.ru>2011-01-24 05:34:02 +0200
commit79d88fe4045ea209c7ec3612edb5b96044c6e1f2 (patch)
tree8ad2a7765a6ed5e7e357ca07a0ea9c905f447a64 /src/localplayer.cpp
parent088bb9486bb87580889941341a6dbd2f60076b27 (diff)
downloadmanaverse-79d88fe4045ea209c7ec3612edb5b96044c6e1f2.tar.gz
manaverse-79d88fe4045ea209c7ec3612edb5b96044c6e1f2.tar.bz2
manaverse-79d88fe4045ea209c7ec3612edb5b96044c6e1f2.tar.xz
manaverse-79d88fe4045ea209c7ec3612edb5b96044c6e1f2.zip
Show job xp in particles.
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r--src/localplayer.cpp37
1 files changed, 37 insertions, 0 deletions
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<int, int> 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");
+ }
+ }
+ }
+ }
}
}