summaryrefslogtreecommitdiff
path: root/src/net/tmwa/chathandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-03-20 13:41:18 +0300
committerAndrei Karas <akaras@inbox.ru>2013-03-22 00:08:12 +0300
commit5a8b8f4ad56914e1c75acd29807897ba1433c96f (patch)
tree4e29e8fee3e794ba4b69e383d3f0e12e6e8d62e0 /src/net/tmwa/chathandler.cpp
parent54ee7d240a8ab3a328d0f3f06f3b9627d4727c90 (diff)
downloadmanaverse-5a8b8f4ad56914e1c75acd29807897ba1433c96f.tar.gz
manaverse-5a8b8f4ad56914e1c75acd29807897ba1433c96f.tar.bz2
manaverse-5a8b8f4ad56914e1c75acd29807897ba1433c96f.tar.xz
manaverse-5a8b8f4ad56914e1c75acd29807897ba1433c96f.zip
add netcode support for channels (for now evol only).
for now any channel ignored and used as general tab. also change netcode version to 8.
Diffstat (limited to 'src/net/tmwa/chathandler.cpp')
-rw-r--r--src/net/tmwa/chathandler.cpp37
1 files changed, 31 insertions, 6 deletions
diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp
index 753272e4f..b44c5bf73 100644
--- a/src/net/tmwa/chathandler.cpp
+++ b/src/net/tmwa/chathandler.cpp
@@ -40,6 +40,7 @@
#include "debug.h"
extern Net::ChatHandler *chatHandler;
+extern int serverVersion;
namespace TmwAthena
{
@@ -51,7 +52,9 @@ ChatHandler::ChatHandler() :
static const uint16_t _messages[] =
{
SMSG_BEING_CHAT,
+ SMSG_BEING_CHAT2,
SMSG_PLAYER_CHAT,
+ SMSG_PLAYER_CHAT2,
SMSG_WHISPER,
SMSG_WHISPER_RESPONSE,
SMSG_GM_CHAT,
@@ -82,12 +85,21 @@ void ChatHandler::handleMessage(Net::MessageIn &msg)
// Received speech from being
case SMSG_BEING_CHAT:
- processBeingChat(msg);
+ processBeingChat(msg, false);
+ break;
+
+ // Received speech from being
+ case SMSG_BEING_CHAT2:
+ processBeingChat(msg, true);
break;
case SMSG_PLAYER_CHAT:
case SMSG_GM_CHAT:
- processChat(msg, msg.getId() == SMSG_PLAYER_CHAT);
+ processChat(msg, msg.getId() == SMSG_PLAYER_CHAT, false);
+ break;
+
+ case SMSG_PLAYER_CHAT2:
+ processChat(msg, true, true);
break;
case SMSG_MVP:
@@ -111,10 +123,23 @@ void ChatHandler::talk(const std::string &text, const std::string &channel)
std::string mes = std::string(player_node->getName()).append(
" : ").append(text);
- MessageOut outMsg(CMSG_CHAT_MESSAGE);
- // Added + 1 in order to let eAthena parse admin commands correctly
- outMsg.writeInt16(static_cast<short>(mes.length() + 4 + 1));
- outMsg.writeString(mes, static_cast<int>(mes.length() + 1));
+ if (serverVersion >= 8 && channel.size() == 3)
+ {
+ MessageOut outMsg(CMSG_CHAT_MESSAGE2);
+ // Added + 1 in order to let eAthena parse admin commands correctly
+ outMsg.writeInt16(static_cast<short>(mes.length() + 4 + 3 + 1));
+ outMsg.writeInt8(channel[0]);
+ outMsg.writeInt8(channel[1]);
+ outMsg.writeInt8(channel[2]);
+ outMsg.writeString(mes, static_cast<int>(mes.length() + 1));
+ }
+ else
+ {
+ MessageOut outMsg(CMSG_CHAT_MESSAGE);
+ // Added + 1 in order to let eAthena parse admin commands correctly
+ outMsg.writeInt16(static_cast<short>(mes.length() + 4 + 1));
+ outMsg.writeString(mes, static_cast<int>(mes.length() + 1));
+ }
}
void ChatHandler::talkRaw(const std::string &mes)