summaryrefslogtreecommitdiff
path: root/src/net/eathena
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/eathena')
-rw-r--r--src/net/eathena/homunculushandler.cpp15
-rw-r--r--src/net/eathena/homunculushandler.h2
-rw-r--r--src/net/eathena/mercenaryhandler.cpp15
-rw-r--r--src/net/eathena/mercenaryhandler.h2
-rw-r--r--src/net/eathena/protocol.h1
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