From b205c5b9e6614a2821f2a44dc104306a27ade7ba Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 30 Nov 2014 18:49:42 +0300 Subject: eathena: add packet SMSG_NPC_CHANGETITLE 0x0b06. --- src/net/ea/npchandler.cpp | 9 +++++++++ src/net/ea/npchandler.h | 2 ++ src/net/eathena/npchandler.cpp | 8 +++++++- src/net/eathena/packets.h | 2 +- src/net/eathena/protocol.h | 2 ++ src/net/tmwa/npchandler.cpp | 9 --------- src/net/tmwa/npchandler.h | 2 -- 7 files changed, 21 insertions(+), 13 deletions(-) (limited to 'src/net') diff --git a/src/net/ea/npchandler.cpp b/src/net/ea/npchandler.cpp index a436b6cbe..aa545d7d8 100644 --- a/src/net/ea/npchandler.cpp +++ b/src/net/ea/npchandler.cpp @@ -201,4 +201,13 @@ void NpcHandler::processNpcCommand(Net::MessageIn &msg) } } +void NpcHandler::processChangeTitle(Net::MessageIn &msg) +{ + npcHandler->getNpc(msg); + mRequestLang = false; + const std::string str = msg.readString(-1, "title"); + if (mDialog) + mDialog->setCaption(str); +} + } // namespace Ea diff --git a/src/net/ea/npchandler.h b/src/net/ea/npchandler.h index d518c6416..51e06e3c7 100644 --- a/src/net/ea/npchandler.h +++ b/src/net/ea/npchandler.h @@ -56,6 +56,8 @@ class NpcHandler notfinal : public Net::NpcHandler static void processNpcCommand(Net::MessageIn &msg); + static void processChangeTitle(Net::MessageIn &msg); + protected: NpcHandler(); diff --git a/src/net/eathena/npchandler.cpp b/src/net/eathena/npchandler.cpp index 0d1e8f4f8..c4fd98dd9 100644 --- a/src/net/eathena/npchandler.cpp +++ b/src/net/eathena/npchandler.cpp @@ -55,6 +55,7 @@ NpcHandler::NpcHandler() : SMSG_NPC_SHOW_PROGRESS_BAR, SMSG_NPC_CLOSE_TIMEOUT, SMSG_NPC_COMMAND, + SMSG_NPC_CHANGETITLE, 0 }; handledMessages = _messages; @@ -109,6 +110,10 @@ void NpcHandler::handleMessage(Net::MessageIn &msg) processNpcCommand(msg); break; + case SMSG_NPC_CHANGETITLE: + processChangeTitle(msg); + break; + default: break; } @@ -261,7 +266,8 @@ void NpcHandler::selectAutoSpell(const int skillId) const int NpcHandler::getNpc(Net::MessageIn &msg) { if (msg.getId() == SMSG_NPC_CHOICE - || msg.getId() == SMSG_NPC_MESSAGE) + || msg.getId() == SMSG_NPC_MESSAGE + || msg.getId() == SMSG_NPC_CHANGETITLE) { msg.readInt16("len"); } diff --git a/src/net/eathena/packets.h b/src/net/eathena/packets.h index cd1b69f93..1945f4c0d 100644 --- a/src/net/eathena/packets.h +++ b/src/net/eathena/packets.h @@ -281,7 +281,7 @@ int16_t packet_lengths[] = //0 1 2 3 4 5 6 7 8 9 a b c d e f //0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // #0x0B00 - 16, -1, 10, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 16, -1, 10, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index 0ac0a1fcc..ccbf2ac19 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -154,6 +154,7 @@ #define SMSG_NPC_INT_INPUT 0x0142 /**< Integer input */ #define SMSG_NPC_STR_INPUT 0x01d4 /**< String input */ #define SMSG_NPC_SHOW_PROGRESS_BAR 0x02f0 +#define SMSG_NPC_CHANGETITLE 0x0b06 #define SMSG_PLAYER_CHAT 0x008e /**< Player talks */ #define SMSG_WHISPER 0x0097 /**< Whisper Recieved */ #define SMSG_WHISPER_RESPONSE 0x09df @@ -315,6 +316,7 @@ #define SMSG_MAP_MUSIC 0x0b05 + /********************************** * Packets from client to server * **********************************/ diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp index 647642356..6a67dccc1 100644 --- a/src/net/tmwa/npchandler.cpp +++ b/src/net/tmwa/npchandler.cpp @@ -289,13 +289,4 @@ int NpcHandler::getNpc(Net::MessageIn &msg) return npcId; } -void NpcHandler::processChangeTitle(Net::MessageIn &msg) -{ - npcHandler->getNpc(msg); - mRequestLang = false; - const std::string str = msg.readString(-1, "title"); - if (mDialog) - mDialog->setCaption(str); -} - } // namespace TmwAthena diff --git a/src/net/tmwa/npchandler.h b/src/net/tmwa/npchandler.h index f399a98d9..c9a64d73f 100644 --- a/src/net/tmwa/npchandler.h +++ b/src/net/tmwa/npchandler.h @@ -69,8 +69,6 @@ class NpcHandler final : public MessageHandler, public Ea::NpcHandler int getNpc(Net::MessageIn &msg) override final; - static void processChangeTitle(Net::MessageIn &msg); - void produceMix(const int nameId, const int materialId1, const int materialId2, -- cgit v1.2.3-60-g2f50