From f1d3e3325d28a43f838052385ad798527dff9c2d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 16 Sep 2014 11:11:46 +0300 Subject: eathena: add packet CMSG_BATTLE_CHAT_MESSAGE 0x02db. --- src/net/eathena/chathandler.cpp | 14 ++++++++++++++ src/net/eathena/chathandler.h | 2 ++ src/net/eathena/protocol.h | 1 + 3 files changed, 17 insertions(+) (limited to 'src/net/eathena') diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp index 3b5df895e..5eec14491 100644 --- a/src/net/eathena/chathandler.cpp +++ b/src/net/eathena/chathandler.cpp @@ -281,6 +281,20 @@ void ChatHandler::createChatRoom(const std::string &title, outMsg.writeString(title, 36, "title"); } +void ChatHandler::battleTalk(const std::string &text) const +{ + if (!localPlayer) + return; + + const std::string mes = std::string(localPlayer->getName()).append( + " : ").append(text); + + MessageOut outMsg(CMSG_BATTLE_CHAT_MESSAGE); + // Added + 1 in order to let eAthena parse admin commands correctly + outMsg.writeInt16(static_cast(mes.length() + 4 + 1), "len"); + outMsg.writeString(mes, static_cast(mes.length() + 1), "message"); +} + void ChatHandler::processChat(Net::MessageIn &msg) { BLOCK_START("ChatHandler::processChat") diff --git a/src/net/eathena/chathandler.h b/src/net/eathena/chathandler.h index dc75a6162..505a5ddea 100644 --- a/src/net/eathena/chathandler.h +++ b/src/net/eathena/chathandler.h @@ -70,6 +70,8 @@ class ChatHandler final : public MessageHandler, public Ea::ChatHandler void requestIgnoreList() const override final; + void battleTalk(const std::string &text) const override final; + protected: void processChat(Net::MessageIn &msg); diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index ae8718087..3889a2c1c 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -239,6 +239,7 @@ #define CMSG_CHAT_MESSAGE 0x00f3 #define CMSG_CHAT_WHISPER 0x0096 #define CMSG_CHAT_WHO 0x00c1 +#define CMSG_BATTLE_CHAT_MESSAGE 0x02db #define CMSG_CREAYE_CHAT_ROOM 0x00d5 -- cgit v1.2.3-60-g2f50