summaryrefslogtreecommitdiff
path: root/src/net/eathena/chathandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-02-17 13:32:56 +0300
committerAndrei Karas <akaras@inbox.ru>2015-02-17 13:33:33 +0300
commitd7a4988bffc489e9584def3ce65ebe2b8f4ca0b0 (patch)
tree3aded6c870558c63e06761e69745c91abbfed1f9 /src/net/eathena/chathandler.cpp
parentfa1edb2eff191d3c1ab7366d3918a57769379c57 (diff)
downloadplus-d7a4988bffc489e9584def3ce65ebe2b8f4ca0b0.tar.gz
plus-d7a4988bffc489e9584def3ce65ebe2b8f4ca0b0.tar.bz2
plus-d7a4988bffc489e9584def3ce65ebe2b8f4ca0b0.tar.xz
plus-d7a4988bffc489e9584def3ce65ebe2b8f4ca0b0.zip
eathena: add pet talk command
Changed client version to 6.
Diffstat (limited to 'src/net/eathena/chathandler.cpp')
-rw-r--r--src/net/eathena/chathandler.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp
index d83daac27..0d401f0e3 100644
--- a/src/net/eathena/chathandler.cpp
+++ b/src/net/eathena/chathandler.cpp
@@ -746,11 +746,19 @@ void ChatHandler::processBeingChat(Net::MessageIn &msg)
}
void ChatHandler::talkPet(const std::string &restrict text,
- const std::string &restrict channel) const
+ const std::string &restrict channel A_UNUSED) const
{
- // here need string duplication
- std::string action = strprintf("\302\202\303 %s", text.c_str());
- talk(action, channel);
+ 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_PET_TALK);
+ outMsg.writeInt16(static_cast<int16_t>(sz + 4 + 1), "len");
+ outMsg.writeString(msg, sz, "message");
+ outMsg.writeInt8(0, "zero byte");
}
} // namespace EAthena