From 485cf3ed0a92beddfbff839d3603ff1f2a98f805 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 18 Mar 2015 15:23:24 +0300 Subject: eathena: add packet SMSG_CHAR_CHARACTERS 0x099d. --- src/net/eathena/charserverhandler.cpp | 31 +++++++++++++++++++++++++++++++ src/net/eathena/charserverhandler.h | 2 ++ src/net/eathena/packets.h | 2 +- src/net/eathena/protocol.h | 1 + 4 files changed, 35 insertions(+), 1 deletion(-) (limited to 'src/net/eathena') diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp index 8034d873b..79a316420 100644 --- a/src/net/eathena/charserverhandler.cpp +++ b/src/net/eathena/charserverhandler.cpp @@ -96,6 +96,7 @@ CharServerHandler::CharServerHandler() : SMSG_CHAR_DELETE2_ACK, SMSG_CHAR_DELETE2_ACCEPT_ACTUAL_ACK, SMSG_CHAR_DELETE2_CANCEL_ACK, + SMSG_CHAR_CHARACTERS, 0 }; handledMessages = _messages; @@ -174,6 +175,10 @@ void CharServerHandler::handleMessage(Net::MessageIn &msg) processCharDelete2CancelAck(msg); break; + case SMSG_CHAR_CHARACTERS: + processCharCharacters(msg); + break; + default: break; } @@ -676,4 +681,30 @@ void CharServerHandler::processCharDelete2CancelAck(Net::MessageIn &msg) msg.readInt32("result"); } +void CharServerHandler::processCharCharacters(Net::MessageIn &msg) +{ + msg.skip(2, "packet len"); + + delete_all(mCharacters); + mCharacters.clear(); + + // Derive number of characters from message length + const int count = (msg.getLength() - 4) + / (106 + 4 + 2 + 16 + 4 + 4 + 4 + 4); + + for (int i = 0; i < count; ++i) + { + Net::Character *const character = new Net::Character; + charServerHandler->readPlayerData(msg, character, false); + mCharacters.push_back(character); + if (character->dummy) + { + logger->log("CharServer: Player: %s (%d)", + character->dummy->getName().c_str(), character->slot); + } + } + + client->setState(STATE_CHAR_SELECT); +} + } // namespace EAthena diff --git a/src/net/eathena/charserverhandler.h b/src/net/eathena/charserverhandler.h index ef1e71851..6d0cb48a9 100644 --- a/src/net/eathena/charserverhandler.h +++ b/src/net/eathena/charserverhandler.h @@ -112,6 +112,8 @@ class CharServerHandler final : public MessageHandler, static void processCharDelete2CancelAck(Net::MessageIn &msg); + static void processCharCharacters(Net::MessageIn &msg); + private: static std::string mNewName; static uint32_t mPinSeed; diff --git a/src/net/eathena/packets.h b/src/net/eathena/packets.h index d3ad5d001..b5d286ee7 100644 --- a/src/net/eathena/packets.h +++ b/src/net/eathena/packets.h @@ -248,7 +248,7 @@ int16_t packet_lengths[] = 31, 0, 0, 0, 0, 0, 0, 14, 0, 0, -1, 0, 0, 288, 12, 0, // #0x0980 0, 0, 0, 29, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 31, -1, -1, -1, -1, -1, -1, 0, 0, 11, 9, 8, 0, 0, 0, 0, + 31, -1, -1, -1, -1, -1, -1, 0, 0, 11, 9, 8, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 16, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // #0x09C0 diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index 9de6db139..dccaf107c 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -55,6 +55,7 @@ #define SMSG_CHAR_DELETE2_ACCEPT_ACTUAL_ACK 0x082a #define SMSG_CHAR_DELETE2_CANCEL_ACK 0x082c #define SMSG_CHAR_MAP_INFO 0x0071 +#define SMSG_CHAR_CHARACTERS 0x099d #define SMSG_CHAR_SWITCH_RESPONSE 0x00b3 #define SMSG_CHANGE_MAP_SERVER 0x0092 -- cgit v1.2.3-70-g09d2