From a6f6dc9c2db87ed852cac1f8a3047f9b1d3efac0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 27 Apr 2014 16:24:12 +0300 Subject: Add StatListener. --- src/gui/windows/chatwindow.cpp | 45 ++++++++++++++---------------------------- 1 file changed, 15 insertions(+), 30 deletions(-) (limited to 'src/gui/windows/chatwindow.cpp') 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 exp - = PlayerInfo::getStatExperience(id); - if (event.getInt("oldValue1") > exp.first - || !event.getInt("oldValue2")) - { - return; - } + const std::pair 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")); } } -- cgit v1.2.3-70-g09d2