summaryrefslogtreecommitdiff
path: root/src/net/tmwa
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-08-23 15:35:00 +0300
committerAndrei Karas <akaras@inbox.ru>2015-08-23 15:35:00 +0300
commitd72a885e0b2c8a2b50a846b5c083fd158078f9c5 (patch)
treee44902674ed2548c21a61eb1d7b407e54270c407 /src/net/tmwa
parentf628081eaf70d48102ce64f6cc0f2337e2f97b78 (diff)
downloadmanaplus-d72a885e0b2c8a2b50a846b5c083fd158078f9c5.tar.gz
manaplus-d72a885e0b2c8a2b50a846b5c083fd158078f9c5.tar.bz2
manaplus-d72a885e0b2c8a2b50a846b5c083fd158078f9c5.tar.xz
manaplus-d72a885e0b2c8a2b50a846b5c083fd158078f9c5.zip
Change protocol version to 5. Add packet SMSG_SCRIPT_MESSAGE (tmwa).
Diffstat (limited to 'src/net/tmwa')
-rw-r--r--src/net/tmwa/chathandler.cpp13
-rw-r--r--src/net/tmwa/chathandler.h2
-rw-r--r--src/net/tmwa/network.h2
-rw-r--r--src/net/tmwa/packets.h2
-rw-r--r--src/net/tmwa/protocol.h1
5 files changed, 18 insertions, 2 deletions
diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp
index a11c6149f..78d0f86ab 100644
--- a/src/net/tmwa/chathandler.cpp
+++ b/src/net/tmwa/chathandler.cpp
@@ -62,6 +62,7 @@ ChatHandler::ChatHandler() :
SMSG_GM_CHAT,
SMSG_MVP_EFFECT,
SMSG_IGNORE_ALL_RESPONSE,
+ SMSG_SCRIPT_MESSAGE,
0
};
handledMessages = _messages;
@@ -103,6 +104,10 @@ void ChatHandler::handleMessage(Net::MessageIn &msg)
processIgnoreAllResponse(msg);
break;
+ case SMSG_SCRIPT_MESSAGE:
+ processScriptMessage(msg);
+ break;
+
default:
break;
}
@@ -622,6 +627,14 @@ void ChatHandler::processBeingChat(Net::MessageIn &msg)
BLOCK_END("ChatHandler::processBeingChat")
}
+void ChatHandler::processScriptMessage(Net::MessageIn &msg)
+{
+ const int sz = msg.readInt16("len") - 5;
+ msg.readUInt8("message type");
+ const std::string message = msg.readString(sz, "message");
+ localChatTab->chatLog(message, ChatMsgType::BY_SERVER);
+}
+
void ChatHandler::talkPet(const std::string &restrict text,
const std::string &restrict channel) const
{
diff --git a/src/net/tmwa/chathandler.h b/src/net/tmwa/chathandler.h
index 6d04abfe7..4bb199416 100644
--- a/src/net/tmwa/chathandler.h
+++ b/src/net/tmwa/chathandler.h
@@ -112,6 +112,8 @@ class ChatHandler final : public MessageHandler, public Ea::ChatHandler
std::string chatMsg);
static void processBeingChat(Net::MessageIn &msg);
+
+ static void processScriptMessage(Net::MessageIn &msg);
};
} // namespace TmwAthena
diff --git a/src/net/tmwa/network.h b/src/net/tmwa/network.h
index c9145f85f..0a6134e0f 100644
--- a/src/net/tmwa/network.h
+++ b/src/net/tmwa/network.h
@@ -30,7 +30,7 @@
* the protocol accordingly.
*/
#define CLIENT_PROTOCOL_VERSION 12
-#define CLIENT_TMW_PROTOCOL_VERSION 4
+#define CLIENT_TMW_PROTOCOL_VERSION 5
namespace TmwAthena
{
diff --git a/src/net/tmwa/packets.h b/src/net/tmwa/packets.h
index a21d4661a..ce9f451df 100644
--- a/src/net/tmwa/packets.h
+++ b/src/net/tmwa/packets.h
@@ -84,7 +84,7 @@ int16_t 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, -1, -1, -1, -1, 10, -1, -1, 0, 0, 0, 0, 0, 0, 0,
+ -1, 122, -1, -1, -1, -1, 10, -1, -1, -1, 0, 0, 0, 0, 0, 0,
};
} // namespace TmwAthena
diff --git a/src/net/tmwa/protocol.h b/src/net/tmwa/protocol.h
index 04a3588e4..d48e3ba5e 100644
--- a/src/net/tmwa/protocol.h
+++ b/src/net/tmwa/protocol.h
@@ -302,6 +302,7 @@ packet(SMSG_QUEST_PLAYER_VARS, 0x0215);
packet(SMSG_BEING_MOVE3, 0x0225);
packet(SMSG_MAP_MUSIC, 0x0227);
packet(SMSG_NPC_CHANGETITLE, 0x0228);
+packet(SMSG_SCRIPT_MESSAGE, 0x0229);
#undef packet