summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-12-17 14:42:42 +0300
committerAndrei Karas <akaras@inbox.ru>2013-12-17 14:42:42 +0300
commita714d83889a34d30b542c3c6ab7c49228fe71f53 (patch)
tree0e5f9887c73b5c0854b30370714c2cc3579acf61
parent79114bbfe4bddf95345c33505a750f3aa80f1c56 (diff)
downloadplus-a714d83889a34d30b542c3c6ab7c49228fe71f53.tar.gz
plus-a714d83889a34d30b542c3c6ab7c49228fe71f53.tar.bz2
plus-a714d83889a34d30b542c3c6ab7c49228fe71f53.tar.xz
plus-a714d83889a34d30b542c3c6ab7c49228fe71f53.zip
Add support for set npc dialog title from server script.
Change client version netcode to 12.
-rw-r--r--src/net/tmwa/network.cpp2
-rw-r--r--src/net/tmwa/network.h2
-rw-r--r--src/net/tmwa/npchandler.cpp16
-rw-r--r--src/net/tmwa/npchandler.h2
-rw-r--r--src/net/tmwa/protocol.h1
5 files changed, 20 insertions, 3 deletions
diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp
index 24615ab16..77b28dadd 100644
--- a/src/net/tmwa/network.cpp
+++ b/src/net/tmwa/network.cpp
@@ -78,7 +78,7 @@ int16_t packet_lengths[] =
// #0x0200
26, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 19, 10, 0, 0, 0,
2, -1, 16, 0, 8, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- -1, 122, -1, -1, -1, -1, 10, -1, 0, 0, 0, 0, 0, 0, 0, 0,
+ -1, 122, -1, -1, -1, -1, 10, -1, -1, 0, 0, 0, 0, 0, 0, 0,
};
static const int packet_lengths_size
diff --git a/src/net/tmwa/network.h b/src/net/tmwa/network.h
index 83bd34610..21ff221aa 100644
--- a/src/net/tmwa/network.h
+++ b/src/net/tmwa/network.h
@@ -31,7 +31,7 @@
* Protocol version, reported to the eAthena char and mapserver who can adjust
* the protocol accordingly.
*/
-#define CLIENT_PROTOCOL_VERSION 11
+#define CLIENT_PROTOCOL_VERSION 12
#define CLIENT_TMW_PROTOCOL_VERSION 1
namespace TmwAthena
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
diff --git a/src/net/tmwa/npchandler.h b/src/net/tmwa/npchandler.h
index 50238cdf7..2cd4a3cd0 100644
--- a/src/net/tmwa/npchandler.h
+++ b/src/net/tmwa/npchandler.h
@@ -72,6 +72,8 @@ class NpcHandler final : public MessageHandler, public Ea::NpcHandler
void processLangReuqest(Net::MessageIn &msg, const int npcId);
+ void processChangeTitle(Net::MessageIn &msg, const int npcId) const;
+
private:
bool mRequestLang;
};
diff --git a/src/net/tmwa/protocol.h b/src/net/tmwa/protocol.h
index 965c67a50..a09a498aa 100644
--- a/src/net/tmwa/protocol.h
+++ b/src/net/tmwa/protocol.h
@@ -352,6 +352,7 @@ enum
#define SMSG_BEING_MOVE3 0x0225
#define SMSG_MAP_MASK 0x0226
#define SMSG_MAP_MUSIC 0x0227
+#define SMSG_NPC_CHANGETITLE 0x0228
#define CMSG_SEND_CLIENT_INFO 0x7533
#define SMSG_UPDATE_HOST2 0x7534