From c43d0ae7b171373f4ee352c8faa4ae6a7e93c49c Mon Sep 17 00:00:00 2001
From: Andrei Karas <akaras@inbox.ru>
Date: Sun, 5 Oct 2014 18:33:30 +0300
Subject: eathena: add packet CMSG_CHAR_RENAME 0x08fc.

---
 src/net/charserverhandler.h           |  3 +++
 src/net/eathena/charserverhandler.cpp | 11 +++++++++++
 src/net/eathena/charserverhandler.h   |  3 +++
 src/net/eathena/protocol.h            |  1 +
 src/net/tmwa/charserverhandler.cpp    |  5 +++++
 src/net/tmwa/charserverhandler.h      |  3 +++
 6 files changed, 26 insertions(+)

diff --git a/src/net/charserverhandler.h b/src/net/charserverhandler.h
index 2ad06901d..3b45e3e33 100644
--- a/src/net/charserverhandler.h
+++ b/src/net/charserverhandler.h
@@ -63,6 +63,9 @@ class CharServerHandler notfinal
 
         virtual void deleteCharacter(Net::Character *const character) = 0;
 
+        virtual void renameCharacter(Net::Character *const character,
+                                     const std::string &newName) = 0;
+
         virtual void switchCharacter() const = 0;
 
         virtual unsigned int baseSprite() const A_WARN_UNUSED = 0;
diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp
index b62ff5cf0..22c9ee849 100644
--- a/src/net/eathena/charserverhandler.cpp
+++ b/src/net/eathena/charserverhandler.cpp
@@ -471,4 +471,15 @@ void CharServerHandler::processCharCreate(Net::MessageIn &msg)
     BLOCK_END("CharServerHandler::processCharCreate")
 }
 
+void CharServerHandler::renameCharacter(Net::Character *const character,
+                                        const std::string &newName)
+{
+    if (!character)
+        return;
+
+    createOutPacket(CMSG_CHAR_RENAME);
+    outMsg.writeInt32(mSelectedCharacter->dummy->getId(), "char id");
+    outMsg.writeString(newName, 24, "name");
+}
+
 }  // namespace EAthena
diff --git a/src/net/eathena/charserverhandler.h b/src/net/eathena/charserverhandler.h
index cd14660ed..8fe6a27a4 100644
--- a/src/net/eathena/charserverhandler.h
+++ b/src/net/eathena/charserverhandler.h
@@ -51,6 +51,9 @@ class CharServerHandler final : public MessageHandler,
                           const unsigned char look,
                           const std::vector<int> &stats) const override final;
 
+        void renameCharacter(Net::Character *const character,
+                             const std::string &newName) override final;
+
         void deleteCharacter(Net::Character *const character) override final;
 
         void switchCharacter() const override final;
diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h
index 326ed3bad..7e9de4e8f 100644
--- a/src/net/eathena/protocol.h
+++ b/src/net/eathena/protocol.h
@@ -291,6 +291,7 @@
 #define CMSG_CHAR_CREATE             0x0970
 #define CMSG_CHAR_DELETE             0x0068
 #define CMSG_CHAR_CREATE_PIN         0x08ba
+#define CMSG_CHAR_RENAME             0x08fc
 
 #define CMSG_MAP_SERVER_CONNECT      0x089c
 #define CMSG_MAP_PING                0x035f /**< Send to server with tick */
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp
index 732e438e6..274120a83 100644
--- a/src/net/tmwa/charserverhandler.cpp
+++ b/src/net/tmwa/charserverhandler.cpp
@@ -511,4 +511,9 @@ void CharServerHandler::processCharCreate2(Net::MessageIn &msg)
     BLOCK_END("CharServerHandler::processCharCreate2")
 }
 
+void CharServerHandler::renameCharacter(Net::Character *const character,
+                                        const std::string &newName)
+{
+}
+
 }  // namespace TmwAthena
diff --git a/src/net/tmwa/charserverhandler.h b/src/net/tmwa/charserverhandler.h
index 0fd6f1f93..29af074a5 100644
--- a/src/net/tmwa/charserverhandler.h
+++ b/src/net/tmwa/charserverhandler.h
@@ -53,6 +53,9 @@ class CharServerHandler final : public MessageHandler,
 
         void deleteCharacter(Net::Character *const character) override final;
 
+        void renameCharacter(Net::Character *const character,
+                             const std::string &newName) override final;
+
         void switchCharacter() const override final;
 
         void connect() override final;
-- 
cgit v1.2.3-70-g09d2