summaryrefslogtreecommitdiff
path: root/src/net/ea
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/ea')
-rw-r--r--src/net/ea/charserverhandler.cpp36
-rw-r--r--src/net/ea/charserverhandler.h10
2 files changed, 33 insertions, 13 deletions
diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp
index 822c15c4..377cd2dd 100644
--- a/src/net/ea/charserverhandler.cpp
+++ b/src/net/ea/charserverhandler.cpp
@@ -31,7 +31,7 @@
#include "logindata.h"
#include "main.h"
-#include "gui/char_select.h"
+#include "gui/charcreatedialog.h"
#include "gui/ok_dialog.h"
#include "utils/gettext.h"
@@ -39,6 +39,8 @@
Net::CharHandler *charHandler;
+namespace EAthena {
+
CharServerHandler::CharServerHandler():
mCharCreateDialog(0)
{
@@ -239,6 +241,24 @@ LocalPlayer *CharServerHandler::readPlayerData(MessageIn &msg, int &slot)
return tempPlayer;
}
+void CharServerHandler::setCharCreateDialog(CharCreateDialog *window)
+{
+ mCharCreateDialog = window;
+
+ if (!mCharCreateDialog) return;
+
+ std::vector<std::string> attributes;
+ attributes.push_back(_("Strength:"));
+ attributes.push_back(_("Agility:"));
+ attributes.push_back(_("Vitality:"));
+ attributes.push_back(_("Intelligence:"));
+ attributes.push_back(_("Dexterity:"));
+ attributes.push_back(_("Luck:"));
+
+ mCharCreateDialog->setAttributes(attributes, 30, 1, 9);
+ mCharCreateDialog->setFixedGender(true);
+}
+
void CharServerHandler::chooseCharacter(int slot, LocalPlayer* character)
{
MessageOut outMsg(CMSG_CHAR_SELECT);
@@ -246,16 +266,14 @@ void CharServerHandler::chooseCharacter(int slot, LocalPlayer* character)
}
void CharServerHandler::newCharacter(const std::string &name, int slot,
- bool gender, int hairstyle, int hairColor)
+ bool gender, int hairstyle, int hairColor, std::vector<int> stats)
{
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);
+ for (int i = 0; i < 6; i++)
+ {
+ outMsg.writeInt8(stats[i]);
+ }
outMsg.writeInt8(slot);
outMsg.writeInt16(hairColor);
outMsg.writeInt16(hairstyle);
@@ -267,3 +285,5 @@ void CharServerHandler::deleteCharacter(int slot, LocalPlayer* character)
outMsg.writeInt32(character->mCharId);
outMsg.writeString("a@a.com", 40);
}
+
+} // namespace EAthena
diff --git a/src/net/ea/charserverhandler.h b/src/net/ea/charserverhandler.h
index e499ab74..48392ac4 100644
--- a/src/net/ea/charserverhandler.h
+++ b/src/net/ea/charserverhandler.h
@@ -27,10 +27,11 @@
#include "lockedarray.h"
-class CharCreateDialog;
class LocalPlayer;
class LoginData;
+namespace EAthena {
+
/**
* Deals with incoming messages from the character server.
*/
@@ -52,13 +53,12 @@ class CharServerHandler : public MessageHandler, public Net::CharHandler
* dialog when a new character is succesfully created, and will unlock
* the dialog when a new character failed to be created.
*/
- void setCharCreateDialog(CharCreateDialog *window)
- { mCharCreateDialog = window; }
+ void setCharCreateDialog(CharCreateDialog *window);
void chooseCharacter(int slot, LocalPlayer* character);
void newCharacter(const std::string &name, int slot, bool gender,
- int hairstyle, int hairColor);
+ int hairstyle, int hairColor, std::vector<int> stats);
void deleteCharacter(int slot, LocalPlayer* character);
@@ -70,6 +70,6 @@ class CharServerHandler : public MessageHandler, public Net::CharHandler
LocalPlayer *readPlayerData(MessageIn &msg, int &slot);
};
-extern Net::CharHandler *charHandler;
+} // namespace EAthena
#endif // NET_EA_CHARSERVERHANDLER_H