summaryrefslogtreecommitdiff
path: root/src/gui/windows/chatwindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-04-27 16:24:12 +0300
committerAndrei Karas <akaras@inbox.ru>2014-04-27 16:24:12 +0300
commita6f6dc9c2db87ed852cac1f8a3047f9b1d3efac0 (patch)
treebd1e6b6a1cdb42b5e6d4489158d438fe8c05f533 /src/gui/windows/chatwindow.cpp
parentaf0ae4d0b7c56d540639bb1f4ba7cc458ec718c1 (diff)
downloadmanaplus-a6f6dc9c2db87ed852cac1f8a3047f9b1d3efac0.tar.gz
manaplus-a6f6dc9c2db87ed852cac1f8a3047f9b1d3efac0.tar.bz2
manaplus-a6f6dc9c2db87ed852cac1f8a3047f9b1d3efac0.tar.xz
manaplus-a6f6dc9c2db87ed852cac1f8a3047f9b1d3efac0.zip
Add StatListener.
Diffstat (limited to 'src/gui/windows/chatwindow.cpp')
-rw-r--r--src/gui/windows/chatwindow.cpp45
1 files changed, 15 insertions, 30 deletions
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index dbda471c4..5b1eba199 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -185,8 +185,6 @@ ChatWindow::ChatWindow():
{
mChatTabs->postInit();
- listen(CHANNEL_ATTRIBUTES);
-
setWindowName("Chat");
if (setupWindow)
@@ -957,38 +955,25 @@ void ChatWindow::keyPressed(KeyEvent &event)
#undef ifKey
-void ChatWindow::processEvent(const Channels channel,
- const DepricatedEvent &event)
+void ChatWindow::statChanged(const int id,
+ const int oldVal1,
+ const int oldVal2)
{
- if (channel == CHANNEL_ATTRIBUTES)
- {
- if (!mShowBattleEvents)
- return;
+ if (!mShowBattleEvents || !config.getBoolValue("showJobExp"))
+ return;
- if (event.getName() == EVENT_UPDATESTAT)
- {
- if (!config.getBoolValue("showJobExp"))
- return;
+ if (id != Net::getPlayerHandler()->getJobLocation())
+ return;
- const int id = event.getInt("id");
- if (id == Net::getPlayerHandler()->getJobLocation())
- {
- const std::pair<int, int> exp
- = PlayerInfo::getStatExperience(id);
- if (event.getInt("oldValue1") > exp.first
- || !event.getInt("oldValue2"))
- {
- return;
- }
+ const std::pair<int, int> exp = PlayerInfo::getStatExperience(id);
+ if (oldVal1 > exp.first || !oldVal2)
+ return;
- const int change = exp.first - event.getInt("oldValue1");
- if (change != 0)
- {
- battleChatLog(std::string("+").append(
- toString(change)).append(" job"));
- }
- }
- }
+ const int change = exp.first - oldVal1;
+ if (change != 0)
+ {
+ battleChatLog(std::string("+").append(toString(
+ change)).append(" job"));
}
}