From 12bc5f140a15f28ea57e8904a3858ba633d22b6d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 11 Oct 2013 23:36:41 +0300 Subject: add /talkraw chat command for special use. --- src/commands.cpp | 5 +++++ src/commands.h | 3 +++ src/net/eathena/chathandler.cpp | 5 ++--- src/net/tmwa/chathandler.cpp | 5 ++--- 4 files changed, 12 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/commands.cpp b/src/commands.cpp index 2119bdb50..3dd4175eb 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -1243,6 +1243,11 @@ impHandler0(createItems) dialog->sort(); } +impHandler1(talkRaw) +{ + Net::getChatHandler()->talkRaw(args); +} + impHandler0(testsdlfont) { #if defined USE_OPENGL && defined DEBUG_SDLFONT diff --git a/src/commands.h b/src/commands.h index 6825159c4..851789282 100644 --- a/src/commands.h +++ b/src/commands.h @@ -126,6 +126,7 @@ namespace Commands decHandler(enableAway); decHandler(testParticle); decHandler(createItems); + decHandler(talkRaw); void replaceVars(std::string &str); } // namespace Commands @@ -219,6 +220,7 @@ enum COMMAND_MAGICATTACK, COMMAND_TEST_PARTICLE, COMMAND_CREATEITEMS, + COMMAND_TALKRAW, COMMAND_HACK, END_COMMANDS }; @@ -312,6 +314,7 @@ static const CommandInfo commands[] = {"magicattack", nullptr, Input::KEY_MAGIC_ATTACK, false}, {"testparticle", &Commands::testParticle, -1, true}, {"createitems", &Commands::createItems, -1, false}, + {"talkraw", &Commands::talkRaw, -1, true}, {"hack", &Commands::hack, -1, true} }; diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp index 0f247f66e..d8b75bfe6 100644 --- a/src/net/eathena/chathandler.cpp +++ b/src/net/eathena/chathandler.cpp @@ -113,9 +113,8 @@ void ChatHandler::talk(const std::string &text, void ChatHandler::talkRaw(const std::string &mes) const { MessageOut outMsg(CMSG_CHAT_MESSAGE); - // Added + 1 in order to let eAthena parse admin commands correctly - outMsg.writeInt16(static_cast(mes.length() + 4 + 1)); - outMsg.writeString(mes, static_cast(mes.length() + 1)); + outMsg.writeInt16(static_cast(mes.length() + 4)); + outMsg.writeString(mes, static_cast(mes.length())); } void ChatHandler::privateMessage(const std::string &recipient, diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index 8f269542c..833e8d4b7 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -141,9 +141,8 @@ void ChatHandler::talk(const std::string &text, void ChatHandler::talkRaw(const std::string &mes) const { MessageOut outMsg(CMSG_CHAT_MESSAGE); - // Added + 1 in order to let eAthena parse admin commands correctly - outMsg.writeInt16(static_cast(mes.length() + 4 + 1)); - outMsg.writeString(mes, static_cast(mes.length() + 1)); + outMsg.writeInt16(static_cast(mes.length() + 4)); + outMsg.writeString(mes, static_cast(mes.length())); } void ChatHandler::privateMessage(const std::string &recipient, -- cgit v1.2.3-70-g09d2