diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2006-08-02 09:43:57 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2006-08-02 09:43:57 +0000 |
commit | 25fe73f89756cb4102f97bcccdb8635a6a56f35d (patch) | |
tree | 12f6737acba4927f49f7d7b676467fe301a2a430 /src/main.cpp | |
parent | 2ae843719c2a7b2325309404a0e3cbb4aeb9c3df (diff) | |
download | mana-25fe73f89756cb4102f97bcccdb8635a6a56f35d.tar.gz mana-25fe73f89756cb4102f97bcccdb8635a6a56f35d.tar.bz2 mana-25fe73f89756cb4102f97bcccdb8635a6a56f35d.tar.xz mana-25fe73f89756cb4102f97bcccdb8635a6a56f35d.zip |
Ported account registration to tmwserv. There's still a disconnection/reconnection between registration and login.
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp index 1bec709f..ce68b7bb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -447,6 +447,25 @@ void accountLogin(Network *network, LoginData *loginData) config.setValue("remember", loginData->remember); } +void accountRegister(Network *network, LoginData *loginData) +{ + logger->log("Trying to connect to account server..."); + logger->log("Username is %s", loginData->username.c_str()); + network->connect(loginData->hostname, loginData->port); + network->registerHandler(&loginHandler); + loginHandler.setCharInfo(&charInfo); + loginHandler.setLoginData(loginData); + + // Send login infos + MessageOut *msg = new MessageOut(); + msg->writeShort(PAMSG_REGISTER); + msg->writeLong(0); // client version + msg->writeString(loginData->username); + msg->writeString(loginData->password); + msg->writeString(loginData->email); + network->send(msg); +} + void mapLogin(Network *network, LoginData *loginData) { MessageOut outMsg; @@ -463,7 +482,6 @@ void mapLogin(Network *network, LoginData *loginData) outMsg.writeLong(player_node->mCharId); outMsg.writeLong(loginData->session_ID1); outMsg.writeLong(loginData->session_ID2); - outMsg.writeByte(loginData->sex); } /** Main */ @@ -629,8 +647,7 @@ int main(int argc, char *argv[]) case CHAR_SELECT_STATE: logger->log("State: CHAR_SELECT"); - currentDialog = new CharSelectDialog(network, &charInfo, - 1 - loginData.sex); + currentDialog = new CharSelectDialog(network, &charInfo); if (options.chooseDefault) { ((CharSelectDialog*)currentDialog)->action("ok", NULL); @@ -672,10 +689,13 @@ int main(int argc, char *argv[]) break; case ACCOUNT_STATE: - printf("Account: %i\n", loginData.sex); accountLogin(network, &loginData); break; + case REGISTER_ACCOUNT_STATE: + accountRegister(network, &loginData); + break; + default: state = EXIT_STATE; break; |