diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-02-17 13:32:56 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-02-17 13:33:33 +0300 |
commit | d7a4988bffc489e9584def3ce65ebe2b8f4ca0b0 (patch) | |
tree | 3aded6c870558c63e06761e69745c91abbfed1f9 | |
parent | fa1edb2eff191d3c1ab7366d3918a57769379c57 (diff) | |
download | manaverse-d7a4988bffc489e9584def3ce65ebe2b8f4ca0b0.tar.gz manaverse-d7a4988bffc489e9584def3ce65ebe2b8f4ca0b0.tar.bz2 manaverse-d7a4988bffc489e9584def3ce65ebe2b8f4ca0b0.tar.xz manaverse-d7a4988bffc489e9584def3ce65ebe2b8f4ca0b0.zip |
eathena: add pet talk command
Changed client version to 6.
-rw-r--r-- | src/actions/pets.cpp | 14 | ||||
-rw-r--r-- | src/net/eathena/chathandler.cpp | 16 | ||||
-rw-r--r-- | src/net/eathena/network.h | 2 | ||||
-rw-r--r-- | src/net/eathena/protocol.h | 1 |
4 files changed, 17 insertions, 16 deletions
diff --git a/src/actions/pets.cpp b/src/actions/pets.cpp index 7d3e4c672..fa413227f 100644 --- a/src/actions/pets.cpp +++ b/src/actions/pets.cpp @@ -67,17 +67,9 @@ impHandler(talkPet) return false; std::string args = event.args; - // in future probably need add channel detection - if (!localPlayer->getPets().empty()) - { - if (findCutFirst(args, "/me ")) - args = textToMe(args); - chatHandler->talkPet(args, GENERAL_CHANNEL); - } - else - { - chatHandler->talk(args, GENERAL_CHANNEL); - } + if (findCutFirst(args, "/me ")) + args = textToMe(args); + chatHandler->talkPet(args, GENERAL_CHANNEL); return true; } 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 diff --git a/src/net/eathena/network.h b/src/net/eathena/network.h index 0e51b5a38..5aefb248c 100644 --- a/src/net/eathena/network.h +++ b/src/net/eathena/network.h @@ -29,7 +29,7 @@ * Protocol version, reported to the eAthena char and mapserver who can adjust * the protocol accordingly. */ -#define CLIENT_PROTOCOL_VERSION 5 +#define CLIENT_PROTOCOL_VERSION 6 namespace EAthena { diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index c285c5667..e2d1d9b7e 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -512,6 +512,7 @@ #define CMSG_PET_SET_NAME 0x01a5 #define CMSG_PET_SELECT_EGG 0x01a7 #define CMSG_PET_MENU_ACTION 0x01a1 +#define CMSG_PET_TALK 0x0b0c #define CMSG_MERCENARY_ACTION 0x029f #define CMSG_HOMUNCULUS_SET_NAME 0x0231 |