From a714d83889a34d30b542c3c6ab7c49228fe71f53 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 17 Dec 2013 14:42:42 +0300 Subject: Add support for set npc dialog title from server script. Change client version netcode to 12. --- src/net/tmwa/npchandler.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/net/tmwa/npchandler.cpp') diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp index 7dc926c73..18191769f 100644 --- a/src/net/tmwa/npchandler.cpp +++ b/src/net/tmwa/npchandler.cpp @@ -57,6 +57,7 @@ NpcHandler::NpcHandler() : SMSG_NPC_INT_INPUT, SMSG_NPC_STR_INPUT, SMSG_NPC_COMMAND, + SMSG_NPC_CHANGETITLE, 0 }; handledMessages = _messages; @@ -66,8 +67,10 @@ NpcHandler::NpcHandler() : void NpcHandler::handleMessage(Net::MessageIn &msg) { BLOCK_START("NpcHandler::handleMessage") + const int npcId = getNpc(msg, msg.getId() == SMSG_NPC_CHOICE - || msg.getId() == SMSG_NPC_MESSAGE); + || msg.getId() == SMSG_NPC_MESSAGE + || msg.getId() == SMSG_NPC_CHANGETITLE); if (msg.getId() != SMSG_NPC_STR_INPUT) mRequestLang = false; @@ -105,6 +108,10 @@ void NpcHandler::handleMessage(Net::MessageIn &msg) processNpcCommand(msg, npcId); break; + case SMSG_NPC_CHANGETITLE: + processChangeTitle(msg, npcId); + break; + default: break; } @@ -339,4 +346,11 @@ void NpcHandler::processLangReuqest(Net::MessageIn &msg A_UNUSED, stringInput(npcId, getLangSimple()); } +void NpcHandler::processChangeTitle(Net::MessageIn &msg, const int npcId) const +{ + const std::string str = msg.readString(); + if (mDialog) + mDialog->setCaption(str); +} + } // namespace TmwAthena -- cgit v1.2.3-60-g2f50