From a08416d782bb9296578b2a69e4eb1e33f55523a4 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 25 Feb 2015 13:39:42 +0300 Subject: eathena: add packet CMSG_HOMMERC_TALK 0x0b13. --- src/net/eathena/homunculushandler.cpp | 15 +++++++++++++++ src/net/eathena/homunculushandler.h | 2 ++ src/net/eathena/mercenaryhandler.cpp | 15 +++++++++++++++ src/net/eathena/mercenaryhandler.h | 2 ++ src/net/eathena/protocol.h | 1 + 5 files changed, 35 insertions(+) (limited to 'src/net/eathena') 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(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(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(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 -- cgit v1.2.3-70-g09d2