diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-04-02 21:25:25 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-04-02 21:25:25 -0600 |
commit | 4916370e6130bfee7eb9ae486f03391d2214ecf4 (patch) | |
tree | 69311c3f543b538f4cd8e619d367d3ef22f6e43c /src/net/ea | |
parent | 22f19d7a201abe8f6df69b82ebd6dce55c3b1655 (diff) | |
download | mana-client-4916370e6130bfee7eb9ae486f03391d2214ecf4.tar.gz mana-client-4916370e6130bfee7eb9ae486f03391d2214ecf4.tar.bz2 mana-client-4916370e6130bfee7eb9ae486f03391d2214ecf4.tar.xz mana-client-4916370e6130bfee7eb9ae486f03391d2214ecf4.zip |
Make eAthena's CharHandler
Also add ping to MapHandler and fill in eAthena's MapHandler's connect
method.
Diffstat (limited to 'src/net/ea')
-rw-r--r-- | src/net/ea/charserverhandler.cpp | 34 | ||||
-rw-r--r-- | src/net/ea/charserverhandler.h | 12 | ||||
-rw-r--r-- | src/net/ea/maphandler.cpp | 16 | ||||
-rw-r--r-- | src/net/ea/maphandler.h | 4 | ||||
-rw-r--r-- | src/net/ea/network.cpp | 2 | ||||
-rw-r--r-- | src/net/ea/protocol.h | 5 |
6 files changed, 67 insertions, 6 deletions
diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp index d212ebfe..822c15c4 100644 --- a/src/net/ea/charserverhandler.cpp +++ b/src/net/ea/charserverhandler.cpp @@ -24,9 +24,9 @@ #include "net/ea/protocol.h" #include "net/messagein.h" +#include "net/messageout.h" #include "game.h" -#include "localplayer.h" #include "log.h" #include "logindata.h" #include "main.h" @@ -37,6 +37,8 @@ #include "utils/gettext.h" #include "utils/stringutils.h" +Net::CharHandler *charHandler; + CharServerHandler::CharServerHandler(): mCharCreateDialog(0) { @@ -52,6 +54,7 @@ CharServerHandler::CharServerHandler(): 0 }; handledMessages = _messages; + charHandler = this; } void CharServerHandler::handleMessage(MessageIn &msg) @@ -235,3 +238,32 @@ LocalPlayer *CharServerHandler::readPlayerData(MessageIn &msg, int &slot) return tempPlayer; } + +void CharServerHandler::chooseCharacter(int slot, LocalPlayer* character) +{ + MessageOut outMsg(CMSG_CHAR_SELECT); + outMsg.writeInt8(slot); +} + +void CharServerHandler::newCharacter(const std::string &name, int slot, + bool gender, int hairstyle, int hairColor) +{ + MessageOut outMsg(CMSG_CHAR_CREATE); + outMsg.writeString(name, 24); + outMsg.writeInt8(5); + outMsg.writeInt8(5); + outMsg.writeInt8(5); + outMsg.writeInt8(5); + outMsg.writeInt8(5); + outMsg.writeInt8(5); + outMsg.writeInt8(slot); + outMsg.writeInt16(hairColor); + outMsg.writeInt16(hairstyle); +} + +void CharServerHandler::deleteCharacter(int slot, LocalPlayer* character) +{ + MessageOut outMsg(CMSG_CHAR_DELETE); + outMsg.writeInt32(character->mCharId); + outMsg.writeString("a@a.com", 40); +} diff --git a/src/net/ea/charserverhandler.h b/src/net/ea/charserverhandler.h index ec21a357..e499ab74 100644 --- a/src/net/ea/charserverhandler.h +++ b/src/net/ea/charserverhandler.h @@ -23,6 +23,7 @@ #define NET_EA_CHARSERVERHANDLER_H #include "net/messagehandler.h" +#include "net/charhandler.h" #include "lockedarray.h" @@ -33,7 +34,7 @@ class LoginData; /** * Deals with incoming messages from the character server. */ -class CharServerHandler : public MessageHandler +class CharServerHandler : public MessageHandler, public Net::CharHandler { public: CharServerHandler(); @@ -54,6 +55,13 @@ class CharServerHandler : public MessageHandler void setCharCreateDialog(CharCreateDialog *window) { mCharCreateDialog = window; } + void chooseCharacter(int slot, LocalPlayer* character); + + void newCharacter(const std::string &name, int slot, bool gender, + int hairstyle, int hairColor); + + void deleteCharacter(int slot, LocalPlayer* character); + protected: LoginData *mLoginData; LockedArray<LocalPlayer*> *mCharInfo; @@ -62,4 +70,6 @@ class CharServerHandler : public MessageHandler LocalPlayer *readPlayerData(MessageIn &msg, int &slot); }; +extern Net::CharHandler *charHandler; + #endif // NET_EA_CHARSERVERHANDLER_H diff --git a/src/net/ea/maphandler.cpp b/src/net/ea/maphandler.cpp index fefeac86..d12106d6 100644 --- a/src/net/ea/maphandler.cpp +++ b/src/net/ea/maphandler.cpp @@ -96,9 +96,15 @@ void MapHandler::handleMessage(MessageIn &msg) } } -void MapHandler::connect() +void MapHandler::connect(LoginData *loginData) { - // TODO + // Send login infos + MessageOut outMsg(CMSG_MAP_SERVER_CONNECT); + outMsg.writeInt32(loginData->account_ID); + outMsg.writeInt32(player_node->mCharId); + outMsg.writeInt32(loginData->session_ID1); + outMsg.writeInt32(loginData->session_ID2); + outMsg.writeInt8(loginData->sex); } void MapHandler::mapLoaded(const std::string &mapName) @@ -115,3 +121,9 @@ void MapHandler::quit() { MessageOut outMsg(CMSG_CLIENT_QUIT); } + +void MapHandler::ping(int tick) +{ + MessageOut msg(CMSG_CLIENT_PING); + msg.writeInt32(tick); +} diff --git a/src/net/ea/maphandler.h b/src/net/ea/maphandler.h index 77811b4e..d4ccdbe2 100644 --- a/src/net/ea/maphandler.h +++ b/src/net/ea/maphandler.h @@ -33,13 +33,15 @@ class MapHandler : public MessageHandler, public Net::MapHandler void handleMessage(MessageIn &msg); - void connect(); + void connect(LoginData *loginData); void mapLoaded(const std::string &mapName); void who(); void quit(); + + void ping(int tick); }; extern MapHandler *mapHandler; diff --git a/src/net/ea/network.cpp b/src/net/ea/network.cpp index 4aecb268..8f55236f 100644 --- a/src/net/ea/network.cpp +++ b/src/net/ea/network.cpp @@ -72,7 +72,7 @@ short packet_lengths[] = { 8, 14, 10, 35, 6, 8, 4, 11, 54, 53, 60, 2, -1, 47, 33, 6, 30, 8, 34, 14, 2, 6, 26, 2, 28, 81, 6, 10, 26, 2, -1, -1, -1, -1, 20, 10, 32, 9, 34, 14, 2, 6, 48, 56, -1, 4, 5, 10, -// #0x200 +// #0x2000 26, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 19, 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/ea/protocol.h b/src/net/ea/protocol.h index 356b34a4..4dc7db36 100644 --- a/src/net/ea/protocol.h +++ b/src/net/ea/protocol.h @@ -122,6 +122,11 @@ static const int STORAGE_OFFSET = 1; /********************************** * Packets from client to server * **********************************/ +#define CMSG_CHAR_SELECT 0x0066 +#define CMSG_CHAR_CREATE 0x0067 +#define CMSG_CHAR_DELETE 0x0068 + +#define CMSG_MAP_SERVER_CONNECT 0x0072 #define CMSG_CLIENT_PING 0x007e /**< Send to server with tick */ #define CMSG_CLIENT_QUIT 0x018A #define CMSG_TRADE_RESPONSE 0x00e6 |