summaryrefslogtreecommitdiff
path: root/src/gui/char_select.cpp
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2006-11-02 12:43:49 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2006-11-02 12:43:49 +0000
commit5f0ebee0d4d75fa91d417f4f352abdbc7502c2f0 (patch)
treeb030f9ff00fceb9f90fab2c9fd56bdc16cd4126c /src/gui/char_select.cpp
parentfa035c2fd70945a0b12143ce9b81284d8d24d13b (diff)
downloadmana-5f0ebee0d4d75fa91d417f4f352abdbc7502c2f0.tar.gz
mana-5f0ebee0d4d75fa91d417f4f352abdbc7502c2f0.tar.bz2
mana-5f0ebee0d4d75fa91d417f4f352abdbc7502c2f0.tar.xz
mana-5f0ebee0d4d75fa91d417f4f352abdbc7502c2f0.zip
Network layer refactoring.
Diffstat (limited to 'src/gui/char_select.cpp')
-rw-r--r--src/gui/char_select.cpp50
1 files changed, 13 insertions, 37 deletions
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index 3e6c4a5f..d825db31 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -37,9 +37,7 @@
#include "../localplayer.h"
#include "../main.h"
-#include "../net/messageout.h"
-#include "../net/network.h"
-#include "../net/protocol.h"
+#include "../net/accountserver/account.h"
#include "../utils/tostring.h"
@@ -134,7 +132,8 @@ void CharSelectDialog::action(const std::string &eventId, gcn::Widget *widget)
mPreviousButton->setEnabled(false);
mNextButton->setEnabled(false);
mCharSelected = true;
- attemptCharSelect();
+ Net::AccountServer::Account::selectCharacter(mCharInfo->getPos());
+ mCharInfo->lock();
}
else if (eventId == "cancel")
{
@@ -202,20 +201,7 @@ void CharSelectDialog::updatePlayerInfo()
void CharSelectDialog::attemptCharDelete()
{
- // Request character deletion
- MessageOut msg(PAMSG_CHAR_DELETE);
- // TODO: Send the selected slot
- msg.writeByte(0);
- Network::send(Network::ACCOUNT, msg);
- mCharInfo->lock();
-}
-
-void CharSelectDialog::attemptCharSelect()
-{
- // Request character selection
- MessageOut msg(PAMSG_CHAR_SELECT);
- msg.writeByte(mCharInfo->getPos());
- Network::send(Network::ACCOUNT, msg);
+ Net::AccountServer::Account::deleteCharacter(mCharInfo->getPos());
mCharInfo->lock();
}
@@ -312,7 +298,15 @@ void CharCreateDialog::action(const std::string &eventId, gcn::Widget *widget)
if (getName().length() >= 4) {
// Attempt to create the character
mCreateButton->setEnabled(false);
- attemptCharCreate();
+ Net::AccountServer::Account::createCharacter(
+ getName(), mPlayerBox->mHairStyle, mPlayerBox->mHairColor,
+ 0, // gender
+ 10, // STR
+ 10, // AGI
+ 10, // VIT
+ 10, // INT
+ 10, // DEX
+ 10); // LUK
scheduleDelete();
}
else {
@@ -344,21 +338,3 @@ std::string CharCreateDialog::getName()
{
return mNameField->getText();
}
-
-void CharCreateDialog::attemptCharCreate()
-{
- // Send character infos
- MessageOut outMsg(PAMSG_CHAR_CREATE);
- outMsg.writeString(getName());
- outMsg.writeByte(mPlayerBox->mHairStyle);
- outMsg.writeByte(mPlayerBox->mHairColor);
- // TODO: send selected sex
- outMsg.writeByte(0); // Player sex
- outMsg.writeShort(10); // STR
- outMsg.writeShort(10); // AGI
- outMsg.writeShort(10); // VIT
- outMsg.writeShort(10); // INT
- outMsg.writeShort(10); // DEX
- outMsg.writeShort(10); // LUK
- Network::send(Network::ACCOUNT, outMsg);
-}