summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-02-25 13:39:42 +0300
committerAndrei Karas <akaras@inbox.ru>2015-02-25 13:39:42 +0300
commita08416d782bb9296578b2a69e4eb1e33f55523a4 (patch)
tree467817701e3c35ea6a41e8723d31b652c910db21 /src
parentc551238526f12f0c28bf44bc131c7e95d675b61d (diff)
downloadplus-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')
-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
-rw-r--r--src/net/homunculushandler.h2
-rw-r--r--src/net/mercenaryhandler.h2
-rw-r--r--src/net/tmwa/homunculushandler.cpp4
-rw-r--r--src/net/tmwa/homunculushandler.h2
-rw-r--r--src/net/tmwa/mercenaryhandler.cpp4
-rw-r--r--src/net/tmwa/mercenaryhandler.h2
11 files changed, 51 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
diff --git a/src/net/homunculushandler.h b/src/net/homunculushandler.h
index 96112d782..aed2aef28 100644
--- a/src/net/homunculushandler.h
+++ b/src/net/homunculushandler.h
@@ -45,6 +45,8 @@ class HomunculusHandler notfinal
virtual void feed() const = 0;
virtual void fire() const = 0;
+
+ virtual void talk(const std::string &restrict text) const = 0;
};
} // namespace Net
diff --git a/src/net/mercenaryhandler.h b/src/net/mercenaryhandler.h
index 3fe9c45a4..0e9c5106c 100644
--- a/src/net/mercenaryhandler.h
+++ b/src/net/mercenaryhandler.h
@@ -43,6 +43,8 @@ class MercenaryHandler notfinal
virtual void move(const int x, const int y) const = 0;
virtual void attack(const int targetId, const bool keep) const = 0;
+
+ virtual void talk(const std::string &restrict text) const = 0;
};
} // namespace Net
diff --git a/src/net/tmwa/homunculushandler.cpp b/src/net/tmwa/homunculushandler.cpp
index 5b3c5f6f7..d582371ce 100644
--- a/src/net/tmwa/homunculushandler.cpp
+++ b/src/net/tmwa/homunculushandler.cpp
@@ -67,4 +67,8 @@ void HomunculusHandler::fire() const
{
}
+void HomunculusHandler::talk(const std::string &restrict text A_UNUSED) const
+{
+}
+
} // namespace TmwAthena
diff --git a/src/net/tmwa/homunculushandler.h b/src/net/tmwa/homunculushandler.h
index 3b1ba4ef9..bd6a4b8ce 100644
--- a/src/net/tmwa/homunculushandler.h
+++ b/src/net/tmwa/homunculushandler.h
@@ -49,6 +49,8 @@ class HomunculusHandler final : public MessageHandler,
void feed() const override final;
void fire() const override final;
+
+ void talk(const std::string &restrict text) const override final;
};
} // namespace TmwAthena
diff --git a/src/net/tmwa/mercenaryhandler.cpp b/src/net/tmwa/mercenaryhandler.cpp
index 22c4350a7..29f568bcb 100644
--- a/src/net/tmwa/mercenaryhandler.cpp
+++ b/src/net/tmwa/mercenaryhandler.cpp
@@ -63,4 +63,8 @@ void MercenaryHandler::attack(const int targetId A_UNUSED,
{
}
+void MercenaryHandler::talk(const std::string &restrict text A_UNUSED) const
+{
+}
+
} // namespace TmwAthena
diff --git a/src/net/tmwa/mercenaryhandler.h b/src/net/tmwa/mercenaryhandler.h
index 88f9f27d3..43afaa969 100644
--- a/src/net/tmwa/mercenaryhandler.h
+++ b/src/net/tmwa/mercenaryhandler.h
@@ -47,6 +47,8 @@ class MercenaryHandler final : public MessageHandler,
void move(const int x, const int y) const override final;
void attack(const int targetId, const bool keep) const override final;
+
+ void talk(const std::string &restrict text) const override final;
};
} // namespace TmwAthena