summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-16 11:11:46 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-16 11:11:46 +0300
commitf1d3e3325d28a43f838052385ad798527dff9c2d (patch)
treec7f86a2af1d4e7c206db583e632b999d5c57fd90 /src/net
parent7c701ca5041fbd7430c478f0c709c12eda664c89 (diff)
downloadmanaverse-f1d3e3325d28a43f838052385ad798527dff9c2d.tar.gz
manaverse-f1d3e3325d28a43f838052385ad798527dff9c2d.tar.bz2
manaverse-f1d3e3325d28a43f838052385ad798527dff9c2d.tar.xz
manaverse-f1d3e3325d28a43f838052385ad798527dff9c2d.zip
eathena: add packet CMSG_BATTLE_CHAT_MESSAGE 0x02db.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/chathandler.h2
-rw-r--r--src/net/eathena/chathandler.cpp14
-rw-r--r--src/net/eathena/chathandler.h2
-rw-r--r--src/net/eathena/protocol.h1
-rw-r--r--src/net/tmwa/chathandler.cpp4
-rw-r--r--src/net/tmwa/chathandler.h2
6 files changed, 25 insertions, 0 deletions
diff --git a/src/net/chathandler.h b/src/net/chathandler.h
index 3a9e3debe..86ff5eecd 100644
--- a/src/net/chathandler.h
+++ b/src/net/chathandler.h
@@ -70,6 +70,8 @@ class ChatHandler notfinal
const std::string &password,
const int limit,
const bool isPublic) = 0;
+
+ virtual void battleTalk(const std::string &text) const = 0;
};
} // namespace Net
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<int16_t>(mes.length() + 4 + 1), "len");
+ outMsg.writeString(mes, static_cast<int>(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
diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp
index cc285d081..0e2b0103b 100644
--- a/src/net/tmwa/chathandler.cpp
+++ b/src/net/tmwa/chathandler.cpp
@@ -274,6 +274,10 @@ void ChatHandler::createChatRoom(const std::string &title A_UNUSED,
{
}
+void ChatHandler::battleTalk(const std::string &text A_UNUSED) const
+{
+}
+
void ChatHandler::processChat(Net::MessageIn &msg)
{
BLOCK_START("ChatHandler::processChat")
diff --git a/src/net/tmwa/chathandler.h b/src/net/tmwa/chathandler.h
index af2333ea6..cebb0674f 100644
--- a/src/net/tmwa/chathandler.h
+++ b/src/net/tmwa/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);