summaryrefslogtreecommitdiff
path: root/src/net/tmwa
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/tmwa')
-rw-r--r--src/net/tmwa/chathandler.cpp37
-rw-r--r--src/net/tmwa/network.cpp2
-rw-r--r--src/net/tmwa/network.h2
-rw-r--r--src/net/tmwa/protocol.h3
4 files changed, 36 insertions, 8 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)
diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp
index 957fdd5a3..94a462aba 100644
--- a/src/net/tmwa/network.cpp
+++ b/src/net/tmwa/network.cpp
@@ -83,7 +83,7 @@ short packet_lengths[] =
// #0x0200
26, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 19, 10, 0, 0, 0,
2, -1, 16, 0, 8, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- -1, 122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ -1, 122, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
static const int packet_lengths_size
diff --git a/src/net/tmwa/network.h b/src/net/tmwa/network.h
index 66c1acb26..e2018fd37 100644
--- a/src/net/tmwa/network.h
+++ b/src/net/tmwa/network.h
@@ -38,7 +38,7 @@
* Protocol version, reported to the eAthena char and mapserver who can adjust
* the protocol accordingly.
*/
-#define CLIENT_PROTOCOL_VERSION 7
+#define CLIENT_PROTOCOL_VERSION 8
#define CLIENT_TMW_PROTOCOL_VERSION 1
namespace TmwAthena
diff --git a/src/net/tmwa/protocol.h b/src/net/tmwa/protocol.h
index 7464cc877..f40599fa5 100644
--- a/src/net/tmwa/protocol.h
+++ b/src/net/tmwa/protocol.h
@@ -143,6 +143,7 @@ enum
#define SMSG_BEING_EMOTION 0x00c0
#define SMSG_BEING_ACTION 0x008a /**< Attack, sit, stand up, ... */
#define SMSG_BEING_CHAT 0x008d /**< A being talks */
+#define SMSG_BEING_CHAT2 0x0223 /**< A being talks in channels */
#define SMSG_BEING_NAME_RESPONSE 0x0095 /**< Has to be requested */
#define SMSG_BEING_NAME_RESPONSE2 0x0220 /**< Has to be requested */
#define SMSG_BEING_CHANGE_DIRECTION 0x009c
@@ -164,6 +165,7 @@ enum
#define SMSG_NPC_INT_INPUT 0x0142 /**< Integer input */
#define SMSG_NPC_STR_INPUT 0x01d4 /**< String input */
#define SMSG_PLAYER_CHAT 0x008e /**< Player talks */
+#define SMSG_PLAYER_CHAT2 0x0224 /**< Player talks */
#define SMSG_WHISPER 0x0097 /**< Whisper Recieved */
#define SMSG_WHISPER_RESPONSE 0x0098
#define SMSG_GM_CHAT 0x009a /**< GM announce */
@@ -246,6 +248,7 @@ enum
#define CMSG_CLIENT_QUIT 0x018A
#define CMSG_CHAT_MESSAGE 0x008c
+#define CMSG_CHAT_MESSAGE2 0x0222
#define CMSG_CHAT_WHISPER 0x0096
#define CMSG_CHAT_ANNOUNCE 0x0099
#define CMSG_CHAT_WHO 0x00c1