diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-02-25 13:39:42 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-02-25 13:39:42 +0300 |
commit | a08416d782bb9296578b2a69e4eb1e33f55523a4 (patch) | |
tree | 467817701e3c35ea6a41e8723d31b652c910db21 /src/net/eathena | |
parent | c551238526f12f0c28bf44bc131c7e95d675b61d (diff) | |
download | plus-a08416d782bb9296578b2a69e4eb1e33f55523a4.tar.gz plus-a08416d782bb9296578b2a69e4eb1e33f55523a4.tar.bz2 plus-a08416d782bb9296578b2a69e4eb1e33f55523a4.tar.xz plus-a08416d782bb9296578b2a69e4eb1e33f55523a4.zip |
eathena: add packet CMSG_HOMMERC_TALK 0x0b13.
Diffstat (limited to 'src/net/eathena')
-rw-r--r-- | src/net/eathena/homunculushandler.cpp | 15 | ||||
-rw-r--r-- | src/net/eathena/homunculushandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/mercenaryhandler.cpp | 15 | ||||
-rw-r--r-- | src/net/eathena/mercenaryhandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/protocol.h | 1 |
5 files changed, 35 insertions, 0 deletions
diff --git a/src/net/eathena/homunculushandler.cpp b/src/net/eathena/homunculushandler.cpp index 6a8c42efa..7eafac3cc 100644 --- a/src/net/eathena/homunculushandler.cpp +++ b/src/net/eathena/homunculushandler.cpp @@ -285,4 +285,19 @@ void HomunculusHandler::fire() const outMsg.writeInt8(2, "command"); // delete } +void HomunculusHandler::talk(const std::string &restrict text) const +{ + if (text.empty()) + return; + std::string msg = text; + if (msg.size() > 500) + msg = msg.substr(0, 500); + const size_t sz = msg.size(); + + createOutPacket(CMSG_HOMMERC_TALK); + outMsg.writeInt16(static_cast<int16_t>(sz + 4 + 1), "len"); + outMsg.writeString(msg, sz, "message"); + outMsg.writeInt8(0, "zero byte"); +} + } // namespace EAthena diff --git a/src/net/eathena/homunculushandler.h b/src/net/eathena/homunculushandler.h index 55b6aa165..c8f42f6b6 100644 --- a/src/net/eathena/homunculushandler.h +++ b/src/net/eathena/homunculushandler.h @@ -49,6 +49,8 @@ class HomunculusHandler final : public MessageHandler, void fire() const override final; + void talk(const std::string &restrict text) const override final; + protected: static void processHomunculusSkills(Net::MessageIn &msg); diff --git a/src/net/eathena/mercenaryhandler.cpp b/src/net/eathena/mercenaryhandler.cpp index 165f0b37a..27c1e361c 100644 --- a/src/net/eathena/mercenaryhandler.cpp +++ b/src/net/eathena/mercenaryhandler.cpp @@ -215,4 +215,19 @@ void MercenaryHandler::attack(const int targetId, const bool keep) const outMsg.writeInt8(static_cast<int8_t>(keep ? 1 : 0), "keep"); } +void MercenaryHandler::talk(const std::string &restrict text) const +{ + if (text.empty()) + return; + std::string msg = text; + if (msg.size() > 500) + msg = msg.substr(0, 500); + const size_t sz = msg.size(); + + createOutPacket(CMSG_HOMMERC_TALK); + outMsg.writeInt16(static_cast<int16_t>(sz + 4 + 1), "len"); + outMsg.writeString(msg, sz, "message"); + outMsg.writeInt8(0, "zero byte"); +} + } // namespace EAthena diff --git a/src/net/eathena/mercenaryhandler.h b/src/net/eathena/mercenaryhandler.h index c0eca551d..b4e1cd48d 100644 --- a/src/net/eathena/mercenaryhandler.h +++ b/src/net/eathena/mercenaryhandler.h @@ -47,6 +47,8 @@ class MercenaryHandler final : public MessageHandler, void attack(const int targetId, const bool keep) const override final; + void talk(const std::string &restrict text) const override final; + protected: static void processMercenaryUpdate(Net::MessageIn &msg); diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index fa4e6ffec..b46b8ef12 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -524,6 +524,7 @@ #define CMSG_HOMMERC_MOVE_TO_MASTER 0x0234 #define CMSG_HOMMERC_MOVE_TO 0x0232 #define CMSG_HOMMERC_ATTACK 0x0233 +#define CMSG_HOMMERC_TALK 0x0b13 #define CMSG_DORI_DORI 0x01e7 #define CMSG_EXPLOSION_SPIRITS 0x01ed |