summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChuck Miller <shadowmil@gmail.com>2010-07-18 23:02:25 -0400
committerChuck Miller <shadowmil@gmail.com>2010-07-18 23:10:02 -0400
commit41a23cb4511e9ba3985990e2703fb3d680a23d14 (patch)
tree2bf03217e3c3b0f28aed5649e2e43cf2b965bd1d
parent782158dfd719fb6d196f79075f275fb8599d393c (diff)
downloadmana-41a23cb4511e9ba3985990e2703fb3d680a23d14.tar.gz
mana-41a23cb4511e9ba3985990e2703fb3d680a23d14.tar.bz2
mana-41a23cb4511e9ba3985990e2703fb3d680a23d14.tar.xz
mana-41a23cb4511e9ba3985990e2703fb3d680a23d14.zip
Move the majority of the netcode's server messages to the event system
There is still a good way to go, but this should get us started Reviewed-by: Jared Adams
-rw-r--r--src/eventmanager.h5
-rw-r--r--src/gui/chat.cpp14
-rw-r--r--src/gui/chat.h6
-rw-r--r--src/net/manaserv/guildhandler.cpp12
-rw-r--r--src/net/manaserv/partyhandler.cpp12
-rw-r--r--src/net/manaserv/tradehandler.cpp15
-rw-r--r--src/net/tmwa/adminhandler.cpp8
-rw-r--r--src/net/tmwa/buysellhandler.cpp14
-rw-r--r--src/net/tmwa/chathandler.cpp18
-rw-r--r--src/net/tmwa/gamehandler.cpp6
-rw-r--r--src/net/tmwa/guildhandler.cpp5
-rw-r--r--src/net/tmwa/inventoryhandler.cpp8
-rw-r--r--src/net/tmwa/partyhandler.cpp15
-rw-r--r--src/net/tmwa/playerhandler.cpp19
-rw-r--r--src/net/tmwa/tradehandler.cpp40
15 files changed, 109 insertions, 88 deletions
diff --git a/src/eventmanager.h b/src/eventmanager.h
index 611c4eca..53a3be60 100644
--- a/src/eventmanager.h
+++ b/src/eventmanager.h
@@ -25,6 +25,11 @@
#include <map>
#include <set>
+#define SERVER_NOTICE(message) { \
+Mana::Event event("ServerNotice"); \
+event.setString("message", message); \
+Mana::EventManager::trigger("Notices", event); }
+
namespace Mana
{
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index f11f23ef..31f6e279 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -23,6 +23,7 @@
#include "actorspritemanager.h"
#include "configuration.h"
+#include "event.h"
#include "localplayer.h"
#include "party.h"
@@ -77,6 +78,8 @@ ChatWindow::ChatWindow():
Window(_("Chat")),
mTmpVisible(false)
{
+ listen("Notices");
+
setWindowName("Chat");
setupWindow->registerWindowForReset(this);
@@ -393,6 +396,17 @@ void ChatWindow::keyPressed(gcn::KeyEvent &event)
}
}
+void ChatWindow::event(const std::string &channel, const Mana::Event &event)
+{
+ if (channel == "Notices")
+ {
+ if (event.getName() == "ServerNotice")
+ {
+ localChatTab->chatLog(event.getString("message"), BY_SERVER);
+ }
+ }
+}
+
void ChatWindow::addInputText(const std::string &text)
{
const int caretPos = mChatInput->getCaretPosition();
diff --git a/src/gui/chat.h b/src/gui/chat.h
index aeba2ece..d6378907 100644
--- a/src/gui/chat.h
+++ b/src/gui/chat.h
@@ -22,6 +22,8 @@
#ifndef CHAT_H
#define CHAT_H
+#include "listener.h"
+
#include "gui/widgets/window.h"
#include <guichan/actionlistener.hpp>
@@ -74,7 +76,8 @@ struct CHATLOG
*/
class ChatWindow : public Window,
public gcn::ActionListener,
- public gcn::KeyListener
+ public gcn::KeyListener,
+ public Mana::Listener
{
public:
/**
@@ -159,6 +162,7 @@ class ChatWindow : public Window,
void mousePressed(gcn::MouseEvent &event);
void mouseDragged(gcn::MouseEvent &event);
+ void event(const std::string &channel, const Mana::Event &event);
/**
* Scrolls the chat window
diff --git a/src/net/manaserv/guildhandler.cpp b/src/net/manaserv/guildhandler.cpp
index 1fbfdf21..b5d7e7bd 100644
--- a/src/net/manaserv/guildhandler.cpp
+++ b/src/net/manaserv/guildhandler.cpp
@@ -21,6 +21,8 @@
#include "net/manaserv/guildhandler.h"
+#include "event.h"
+#include "eventmanager.h"
#include "guild.h"
#include "log.h"
#include "localplayer.h"
@@ -78,12 +80,12 @@ void GuildHandler::handleMessage(Net::MessageIn &msg)
if (msg.readInt8() == ERRMSG_OK)
{
// TODO - Acknowledge guild was created
- localChatTab->chatLog(_("Guild created."));
+ SERVER_NOTICE(_("Guild created."))
joinedGuild(msg);
}
else
{
- localChatTab->chatLog(_("Error creating guild."));
+ SERVER_NOTICE(_("Error creating guild."))
}
} break;
@@ -93,7 +95,7 @@ void GuildHandler::handleMessage(Net::MessageIn &msg)
if (msg.readInt8() == ERRMSG_OK)
{
// TODO - Acknowledge invite was sent
- localChatTab->chatLog(_("Invite sent."));
+ SERVER_NOTICE(_("Invite sent."))
}
} break;
@@ -200,12 +202,12 @@ void GuildHandler::handleMessage(Net::MessageIn &msg)
if (msg.readInt8() == ERRMSG_OK)
{
// promotion succeeded
- localChatTab->chatLog(_("Member was promoted successfully."));
+ SERVER_NOTICE(_("Member was promoted successfully."))
}
else
{
// promotion failed
- localChatTab->chatLog(_("Failed to promote member."));
+ SERVER_NOTICE(_("Failed to promote member."))
}
}
diff --git a/src/net/manaserv/partyhandler.cpp b/src/net/manaserv/partyhandler.cpp
index 2fd48f57..a9145269 100644
--- a/src/net/manaserv/partyhandler.cpp
+++ b/src/net/manaserv/partyhandler.cpp
@@ -21,13 +21,13 @@
#include "net/manaserv/partyhandler.h"
+#include "event.h"
+#include "eventmanager.h"
#include "log.h"
#include "localplayer.h"
#include "gui/socialwindow.h"
-#include "gui/widgets/chattab.h"
-
#include "net/manaserv/connection.h"
#include "net/manaserv/messagein.h"
#include "net/manaserv/messageout.h"
@@ -85,7 +85,7 @@ void PartyHandler::handleMessage(Net::MessageIn &msg)
if (msg.readInt8() == ERRMSG_OK)
{
//
- localChatTab->chatLog(_("Joined party."));
+ SERVER_NOTICE(_("Joined party."));
}
}
@@ -103,7 +103,7 @@ void PartyHandler::handleMessage(Net::MessageIn &msg)
int id = msg.readInt16(); // being id
std::string name = msg.readString();
- localChatTab->chatLog(strprintf(_("%s joined the party."),
+ SERVER_NOTICE(strprintf(_("%s joined the party."),
name.c_str()));
if (id == player_node->getId())
@@ -120,8 +120,8 @@ void PartyHandler::handleMessage(Net::MessageIn &msg)
case CPMSG_PARTY_REJECTED:
{
std::string name = msg.readString();
- localChatTab->chatLog(strprintf(_("%s rejected your invite."),
- name.c_str()));
+ SERVER_NOTICE(strprintf(
+ _("%s rejected your invite."), name.c_str()));
} break;
}
}
diff --git a/src/net/manaserv/tradehandler.cpp b/src/net/manaserv/tradehandler.cpp
index d5505075..5f9fa83e 100644
--- a/src/net/manaserv/tradehandler.cpp
+++ b/src/net/manaserv/tradehandler.cpp
@@ -22,6 +22,8 @@
#include "net/manaserv/tradehandler.h"
#include "actorspritemanager.h"
+#include "event.h"
+#include "eventmanager.h"
#include "item.h"
#include "localplayer.h"
#include "playerinfo.h"
@@ -29,8 +31,6 @@
#include "gui/confirmdialog.h"
#include "gui/trade.h"
-#include "gui/widgets/chattab.h"
-
#include "net/net.h"
#include "net/manaserv/connection.h"
@@ -87,16 +87,15 @@ TradeHandler::TradeHandler():
};
handledMessages = _messages;
tradeHandler = this;
-
}
void TradeHandler::setAcceptTradeRequests(bool acceptTradeRequests)
{
mAcceptTradeRequests = acceptTradeRequests;
if (mAcceptTradeRequests)
- localChatTab->chatLog(_("Accepting incoming trade requests."), BY_SERVER);
+ SERVER_NOTICE(_("Accepting incoming trade requests."))
else
- localChatTab->chatLog(_("Ignoring incoming trade requests."), BY_SERVER);
+ SERVER_NOTICE(_("Ignoring incoming trade requests."))
}
void TradeHandler::handleMessage(Net::MessageIn &msg)
@@ -145,16 +144,16 @@ void TradeHandler::handleMessage(Net::MessageIn &msg)
case GPMSG_TRADE_AGREED:
tradeWindow->receivedOk(false);
break;
-
+
case GPMSG_TRADE_CANCEL:
- localChatTab->chatLog(_("Trade canceled."), BY_SERVER);
+ SERVER_NOTICE(_("Trade canceled."))
tradeWindow->setVisible(false);
tradeWindow->reset();
PlayerInfo::setTrading(false);
break;
case GPMSG_TRADE_COMPLETE:
- localChatTab->chatLog(_("Trade completed."), BY_SERVER);
+ SERVER_NOTICE(_("Trade completed."))
tradeWindow->setVisible(false);
tradeWindow->reset();
PlayerInfo::setTrading(false);
diff --git a/src/net/tmwa/adminhandler.cpp b/src/net/tmwa/adminhandler.cpp
index da089b2b..330708db 100644
--- a/src/net/tmwa/adminhandler.cpp
+++ b/src/net/tmwa/adminhandler.cpp
@@ -23,11 +23,11 @@
#include "actorspritemanager.h"
#include "being.h"
+#include "event.h"
+#include "eventmanager.h"
#include "game.h"
#include "playerrelations.h"
-#include "gui/widgets/chattab.h"
-
#include "net/chathandler.h"
#include "net/net.h"
@@ -60,9 +60,9 @@ void AdminHandler::handleMessage(Net::MessageIn &msg)
case SMSG_ADMIN_KICK_ACK:
id = msg.readInt32();
if (id == 0)
- localChatTab->chatLog(_("Kick failed!"), BY_SERVER);
+ SERVER_NOTICE(_("Kick failed!"))
else
- localChatTab->chatLog(_("Kick succeeded!"), BY_SERVER);
+ SERVER_NOTICE(_("Kick succeeded!"))
break;
}
}
diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp
index d0c8fd40..03480e45 100644
--- a/src/net/tmwa/buysellhandler.cpp
+++ b/src/net/tmwa/buysellhandler.cpp
@@ -22,6 +22,8 @@
#include "net/tmwa/buysellhandler.h"
#include "actorspritemanager.h"
+#include "event.h"
+#include "eventmanager.h"
#include "inventory.h"
#include "item.h"
#include "localplayer.h"
@@ -31,8 +33,6 @@
#include "gui/buysell.h"
#include "gui/sell.h"
-#include "gui/widgets/chattab.h"
-
#include "net/messagein.h"
#include "net/tmwa/protocol.h"
@@ -107,29 +107,29 @@ void BuySellHandler::handleMessage(Net::MessageIn &msg)
}
else
{
- localChatTab->chatLog(_("Nothing to sell."), BY_SERVER);
+ SERVER_NOTICE(_("Nothing to sell."))
}
break;
case SMSG_NPC_BUY_RESPONSE:
if (msg.readInt8() == 0)
{
- localChatTab->chatLog(_("Thanks for buying."), BY_SERVER);
+ SERVER_NOTICE(_("Thanks for buying."))
}
else
{
// Reset player money since buy dialog already assumed purchase
// would go fine
mBuyDialog->setMoney(PlayerInfo::getAttribute(MONEY));
- localChatTab->chatLog(_("Unable to buy."), BY_SERVER);
+ SERVER_NOTICE(_("Unable to buy."))
}
break;
case SMSG_NPC_SELL_RESPONSE:
if (msg.readInt8() == 0)
- localChatTab->chatLog(_("Thanks for selling."), BY_SERVER);
+ SERVER_NOTICE(_("Thanks for selling."))
else
- localChatTab->chatLog(_("Unable to sell."), BY_SERVER);
+ SERVER_NOTICE(_("Unable to sell."))
break;
}
diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp
index 53af2e6b..13879152 100644
--- a/src/net/tmwa/chathandler.cpp
+++ b/src/net/tmwa/chathandler.cpp
@@ -23,6 +23,8 @@
#include "actorspritemanager.h"
#include "being.h"
+#include "event.h"
+#include "eventmanager.h"
#include "game.h"
#include "localplayer.h"
#include "playerrelations.h"
@@ -212,43 +214,43 @@ void ChatHandler::privateMessage(const std::string &recipient,
void ChatHandler::channelList()
{
- localChatTab->chatLog(_("Channels are not supported!"), BY_SERVER);
+ SERVER_NOTICE(_("Channels are not supported!"))
}
void ChatHandler::enterChannel(const std::string &channel,
const std::string &password)
{
- localChatTab->chatLog(_("Channels are not supported!"), BY_SERVER);
+ SERVER_NOTICE(_("Channels are not supported!"))
}
void ChatHandler::quitChannel(int channelId)
{
- localChatTab->chatLog(_("Channels are not supported!"), BY_SERVER);
+ SERVER_NOTICE(_("Channels are not supported!"))
}
void ChatHandler::sendToChannel(int channelId, const std::string &text)
{
- localChatTab->chatLog(_("Channels are not supported!"), BY_SERVER);
+ SERVER_NOTICE(_("Channels are not supported!"))
}
void ChatHandler::userList(const std::string &channel)
{
- localChatTab->chatLog(_("Channels are not supported!"), BY_SERVER);
+ SERVER_NOTICE(_("Channels are not supported!"))
}
void ChatHandler::setChannelTopic(int channelId, const std::string &text)
{
- localChatTab->chatLog(_("Channels are not supported!"), BY_SERVER);
+ SERVER_NOTICE(_("Channels are not supported!"))
}
void ChatHandler::setUserMode(int channelId, const std::string &name, int mode)
{
- localChatTab->chatLog(_("Channels are not supported!"), BY_SERVER);
+ SERVER_NOTICE(_("Channels are not supported!"))
}
void ChatHandler::kickUser(int channelId, const std::string &name)
{
- localChatTab->chatLog(_("Channels are not supported!"), BY_SERVER);
+ SERVER_NOTICE(_("Channels are not supported!"))
}
void ChatHandler::who()
diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp
index 4810a3ea..183c2c8a 100644
--- a/src/net/tmwa/gamehandler.cpp
+++ b/src/net/tmwa/gamehandler.cpp
@@ -23,12 +23,11 @@
#include "client.h"
#include "event.h"
+#include "eventmanager.h"
#include "game.h"
#include "localplayer.h"
#include "log.h"
-#include "gui/widgets/chattab.h"
-
#include "gui/okdialog.h"
#include "net/messagein.h"
@@ -87,8 +86,7 @@ void GameHandler::handleMessage(Net::MessageIn &msg)
break;
case SMSG_WHO_ANSWER:
- localChatTab->chatLog(strprintf(_("Online users: %d"),
- msg.readInt32()), BY_SERVER);
+ SERVER_NOTICE(strprintf(_("Online users: %d"), msg.readInt32()))
break;
case SMSG_CHAR_SWITCH_RESPONSE:
diff --git a/src/net/tmwa/guildhandler.cpp b/src/net/tmwa/guildhandler.cpp
index 3d3b0ab2..21cf9c32 100644
--- a/src/net/tmwa/guildhandler.cpp
+++ b/src/net/tmwa/guildhandler.cpp
@@ -21,6 +21,8 @@
#include "net/tmwa/guildhandler.h"
#include "guild.h"
+#include "event.h"
+#include "eventmanager.h"
#include "localplayer.h"
#include "log.h"
@@ -387,8 +389,7 @@ void GuildHandler::handleMessage(Net::MessageIn &msg)
void GuildHandler::create(const std::string &name)
{
- localChatTab->chatLog(_("Guild creation isn't supported yet."),
- BY_SERVER);
+ SERVER_NOTICE(_("Guild creation isn't supported yet."))
return;
MessageOut msg(CMSG_GUILD_CREATE);
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp
index 41049c3d..7b019085 100644
--- a/src/net/tmwa/inventoryhandler.cpp
+++ b/src/net/tmwa/inventoryhandler.cpp
@@ -23,6 +23,8 @@
#include "configuration.h"
#include "equipment.h"
+#include "event.h"
+#include "eventmanager.h"
#include "inventory.h"
#include "item.h"
#include "itemshortcut.h"
@@ -276,7 +278,7 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
if (msg.readInt8() == 0)
{
- localChatTab->chatLog(_("Failed to use item."), BY_SERVER);
+ SERVER_NOTICE(_("Failed to use item."))
}
else
{
@@ -386,7 +388,7 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
flag = msg.readInt8();
if (!flag)
- localChatTab->chatLog(_("Unable to equip."), BY_SERVER);
+ SERVER_NOTICE(_("Unable to equip."))
else
mEquips.setEquipment(getSlot(equipType), index);
break;
@@ -397,7 +399,7 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
flag = msg.readInt8();
if (!flag)
- localChatTab->chatLog(_("Unable to unequip."), BY_SERVER);
+ SERVER_NOTICE(_("Unable to unequip."))
else
mEquips.setEquipment(getSlot(equipType), -1);
break;
diff --git a/src/net/tmwa/partyhandler.cpp b/src/net/tmwa/partyhandler.cpp
index 820331e8..7f8dca0f 100644
--- a/src/net/tmwa/partyhandler.cpp
+++ b/src/net/tmwa/partyhandler.cpp
@@ -21,6 +21,8 @@
#include "net/tmwa/partyhandler.h"
#include "actorspritemanager.h"
+#include "event.h"
+#include "eventmanager.h"
#include "localplayer.h"
#include "log.h"
@@ -78,12 +80,9 @@ void PartyHandler::handleMessage(Net::MessageIn &msg)
{
case SMSG_PARTY_CREATE:
if (msg.readInt8())
- localChatTab->chatLog(_("Could not create party."), BY_SERVER);
+ SERVER_NOTICE(_("Could not create party."))
else
- {
- localChatTab->chatLog(_("Party successfully created."),
- BY_SERVER);
- }
+ SERVER_NOTICE(_("Party successfully created."))
break;
case SMSG_PARTY_INFO:
{
@@ -235,8 +234,7 @@ void PartyHandler::handleMessage(Net::MessageIn &msg)
{
taParty->removeFromMembers();
taParty->clearMembers();
- localChatTab->chatLog(_("You have left the party."),
- BY_SERVER);
+ SERVER_NOTICE(_("You have left the party."))
if (partyTab)
{
delete partyTab;
@@ -330,8 +328,7 @@ void PartyHandler::invite(const std::string &name)
}
else
{
- localChatTab->chatLog(_("You can only inivte when you are in a party!"),
- BY_SERVER);
+ SERVER_NOTICE(_("You can only inivte when you are in a party!"))
}
// TODO?
diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp
index 0ada96d7..0388573f 100644
--- a/src/net/tmwa/playerhandler.cpp
+++ b/src/net/tmwa/playerhandler.cpp
@@ -21,6 +21,8 @@
#include "net/tmwa/playerhandler.h"
+#include "event.h"
+#include "eventmanager.h"
#include "game.h"
#include "localplayer.h"
#include "log.h"
@@ -36,8 +38,6 @@
#include "gui/statuswindow.h"
#include "gui/viewport.h"
-#include "gui/widgets/chattab.h"
-
#include "net/messagein.h"
#include "net/messageout.h"
@@ -308,10 +308,9 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg)
int oldMoney = PlayerInfo::getAttribute(MONEY);
int newMoney = msg.readInt32();
if (newMoney > oldMoney)
- localChatTab->chatLog(strprintf(_("You picked up "
- "%s."),
- Units::formatCurrency(newMoney - oldMoney).c_str()),
- BY_SERVER);
+ SERVER_NOTICE(strprintf(_("You picked up %s."),
+ Units::formatCurrency(newMoney -
+ oldMoney).c_str()))
}
break;
case 0x0016:
@@ -344,8 +343,7 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg)
if (ok != 1)
{
- localChatTab->chatLog(_("Cannot raise skill!"),
- BY_SERVER);
+ SERVER_NOTICE(_("Cannot raise skill!"))
}
PlayerInfo::setStatBase(type, value);
@@ -484,8 +482,9 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg)
switch (type)
{
case 0:
- localChatTab->chatLog(_("Equip arrows first."),
- BY_SERVER);
+ {
+ SERVER_NOTICE(_("Equip arrows first."))
+ }
break;
default:
logger->log("0x013b: Unhandled message %i", type);
diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp
index 2c82f1e2..0610f5be 100644
--- a/src/net/tmwa/tradehandler.cpp
+++ b/src/net/tmwa/tradehandler.cpp
@@ -21,6 +21,8 @@
#include "net/tmwa/tradehandler.h"
+#include "event.h"
+#include "eventmanager.h"
#include "inventory.h"
#include "item.h"
#include "localplayer.h"
@@ -30,8 +32,6 @@
#include "gui/confirmdialog.h"
#include "gui/trade.h"
-#include "gui/widgets/chattab.h"
-
#include "net/inventoryhandler.h"
#include "net/messagein.h"
#include "net/messageout.h"
@@ -122,16 +122,16 @@ void TradeHandler::handleMessage(Net::MessageIn &msg)
switch (msg.readInt8())
{
case 0: // Too far away
- localChatTab->chatLog(_("Trading isn't possible. Trade "
- "partner is too far away."), BY_SERVER);
+ SERVER_NOTICE(_("Trading isn't possible. Trade "
+ "partner is too far away."))
break;
case 1: // Character doesn't exist
- localChatTab->chatLog(_("Trading isn't possible. Character "
- "doesn't exist."), BY_SERVER);
+ SERVER_NOTICE(_("Trading isn't possible. Character "
+ "doesn't exist."))
break;
case 2: // Invite request check failed...
- localChatTab->chatLog(_("Trade cancelled due to an unknown "
- "reason."), BY_SERVER);
+ SERVER_NOTICE(_("Trade cancelled due to an unknown "
+ "reason."))
break;
case 3: // Trade accepted
tradeWindow->reset();
@@ -142,17 +142,15 @@ void TradeHandler::handleMessage(Net::MessageIn &msg)
case 4: // Trade cancelled
if (player_relations.hasPermission(tradePartnerName,
PlayerRelation::SPEECH_LOG))
- localChatTab->chatLog(strprintf(_("Trade with %s "
- "cancelled."), tradePartnerName.c_str()),
- BY_SERVER);
+ SERVER_NOTICE(strprintf(_("Trade with %s cancelled."),
+ tradePartnerName.c_str()))
// otherwise ignore silently
tradeWindow->setVisible(false);
PlayerInfo::setTrading(false);
break;
default: // Shouldn't happen as well, but to be sure
- localChatTab->chatLog(_("Unhandled trade cancel packet."),
- BY_SERVER);
+ SERVER_NOTICE(_("Unhandled trade cancel packet."))
break;
}
break;
@@ -200,17 +198,17 @@ void TradeHandler::handleMessage(Net::MessageIn &msg)
break;
case 1:
// Add item failed - player overweighted
- localChatTab->chatLog(_("Failed adding item. Trade "
- "partner is over weighted."), BY_SERVER);
+ SERVER_NOTICE(_("Failed adding item. Trade "
+ "partner is over weighted."))
break;
case 2:
// Add item failed - player has no free slot
- localChatTab->chatLog(_("Failed adding item. Trade "
- "partner has no free slot."), BY_SERVER);
+ SERVER_NOTICE(_("Failed adding item. Trade "
+ "partner has no free slot."))
break;
default:
- localChatTab->chatLog(_("Failed adding item for "
- "unknown reason."), BY_SERVER);
+ SERVER_NOTICE(_("Failed adding item for "
+ "unknown reason."))
break;
}
}
@@ -222,14 +220,14 @@ void TradeHandler::handleMessage(Net::MessageIn &msg)
break;
case SMSG_TRADE_CANCEL:
- localChatTab->chatLog(_("Trade canceled."), BY_SERVER);
+ SERVER_NOTICE(_("Trade canceled."))
tradeWindow->setVisible(false);
tradeWindow->reset();
PlayerInfo::setTrading(false);
break;
case SMSG_TRADE_COMPLETE:
- localChatTab->chatLog(_("Trade completed."), BY_SERVER);
+ SERVER_NOTICE(_("Trade completed."))
tradeWindow->setVisible(false);
tradeWindow->reset();
PlayerInfo::setTrading(false);