summaryrefslogtreecommitdiff
path: root/src/gui/windows/chatwindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-04-27 14:50:47 +0300
committerAndrei Karas <akaras@inbox.ru>2014-04-27 14:50:47 +0300
commit744b6e62e1252ca50445b21f671ad8d81dd28ea1 (patch)
tree79adc9663a740ed471e33c97932ce6b28de11377 /src/gui/windows/chatwindow.cpp
parent2ee2f8b060e4fe88feeeba5508189c916e55a70d (diff)
downloadmanaverse-744b6e62e1252ca50445b21f671ad8d81dd28ea1.tar.gz
manaverse-744b6e62e1252ca50445b21f671ad8d81dd28ea1.tar.bz2
manaverse-744b6e62e1252ca50445b21f671ad8d81dd28ea1.tar.xz
manaverse-744b6e62e1252ca50445b21f671ad8d81dd28ea1.zip
Add AttributeListener.
Diffstat (limited to 'src/gui/windows/chatwindow.cpp')
-rw-r--r--src/gui/windows/chatwindow.cpp56
1 files changed, 28 insertions, 28 deletions
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index be2daf6a9..dbda471c4 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -156,6 +156,7 @@ ChatWindow::ChatWindow():
Window(_("Chat"), false, nullptr, "chat.xml"),
ActionListener(),
KeyListener(),
+ AttributeListener(),
mItemLinkHandler(new ItemLinkHandler),
mChatTabs(new TabbedArea(this)),
mChatInput(new ChatInput(this)),
@@ -964,34 +965,7 @@ void ChatWindow::processEvent(const Channels channel,
if (!mShowBattleEvents)
return;
- if (event.getName() == EVENT_UPDATEATTRIBUTE)
- {
- switch (event.getInt("id"))
- {
- case PlayerInfo::EXP:
- {
- if (event.getInt("oldValue") > event.getInt("newValue"))
- break;
-
- const int change = event.getInt("newValue")
- - event.getInt("oldValue");
-
- if (change != 0)
- {
- battleChatLog(std::string("+").append(toString(
- change)).append(" xp"));
- }
- break;
- }
- case PlayerInfo::LEVEL:
- battleChatLog(std::string("Level: ").append(toString(
- event.getInt("newValue"))));
- break;
- default:
- break;
- };
- }
- else if (event.getName() == EVENT_UPDATESTAT)
+ if (event.getName() == EVENT_UPDATESTAT)
{
if (!config.getBoolValue("showJobExp"))
return;
@@ -1018,6 +992,32 @@ void ChatWindow::processEvent(const Channels channel,
}
}
+void ChatWindow::attributeChanged(const int id,
+ const int oldVal,
+ const int newVal)
+{
+ switch (id)
+ {
+ case PlayerInfo::EXP:
+ {
+ if (oldVal > newVal)
+ break;
+ const int change = newVal - oldVal;
+ if (change != 0)
+ {
+ battleChatLog(std::string("+").append(toString(
+ change)).append(" xp"));
+ }
+ break;
+ }
+ case PlayerInfo::LEVEL:
+ battleChatLog(std::string("Level: ").append(toString(newVal)));
+ break;
+ default:
+ break;
+ };
+}
+
void ChatWindow::addInputText(const std::string &text, const bool space)
{
const int caretPos = mChatInput->getCaretPosition();