summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2006-08-14 08:36:16 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2006-08-14 08:36:16 +0000
commitc79bf8c82f0a38b574b83be2484eb347852cd833 (patch)
treebf13ca5f0ff3f0413bab52f89ba95e705ffce745 /src/gui
parent9e6862623370f53d1b78e4bd167152b840e28884 (diff)
downloadmana-c79bf8c82f0a38b574b83be2484eb347852cd833.tar.gz
mana-c79bf8c82f0a38b574b83be2484eb347852cd833.tar.bz2
mana-c79bf8c82f0a38b574b83be2484eb347852cd833.tar.xz
mana-c79bf8c82f0a38b574b83be2484eb347852cd833.zip
Completed porting of character creation/deletion, fixed some issues with network code.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/char_select.cpp42
-rw-r--r--src/gui/char_select.h1
-rw-r--r--src/gui/playerbox.cpp3
-rw-r--r--src/gui/playerbox.h8
-rw-r--r--src/gui/status.cpp12
-rw-r--r--src/gui/status.h2
6 files changed, 33 insertions, 35 deletions
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index 75887b99..775eea24 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -38,6 +38,8 @@
#include "../main.h"
#include "../net/messageout.h"
+#include "../net/network.h"
+#include "../net/protocol.h"
#include "../utils/tostring.h"
@@ -83,7 +85,6 @@ CharSelectDialog::CharSelectDialog(Network *network,
mNameLabel = new gcn::Label("Name");
mLevelLabel = new gcn::Label("Level");
- mJobLevelLabel = new gcn::Label("Job Level");
mMoneyLabel = new gcn::Label("Money");
mPlayerBox = new PlayerBox(0);
@@ -93,7 +94,6 @@ CharSelectDialog::CharSelectDialog(Network *network,
mPlayerBox->setDimension(gcn::Rectangle(5, 5, w - 10, 90));
mNameLabel->setDimension(gcn::Rectangle(10, 100, 128, 16));
mLevelLabel->setDimension(gcn::Rectangle(10, 116, 128, 16));
- mJobLevelLabel->setDimension(gcn::Rectangle(10, 132, 128, 16));
mMoneyLabel->setDimension(gcn::Rectangle(10, 148, 128, 16));
mPreviousButton->setPosition(5, 170);
mNextButton->setPosition(mPreviousButton->getWidth() + 10, 170);
@@ -117,7 +117,6 @@ CharSelectDialog::CharSelectDialog(Network *network,
add(mNextButton);
add(mNameLabel);
add(mLevelLabel);
- add(mJobLevelLabel);
add(mMoneyLabel);
mSelectButton->requestFocus();
@@ -177,8 +176,7 @@ void CharSelectDialog::updatePlayerInfo()
if (pi) {
mNameLabel->setCaption(pi->getName());
mLevelLabel->setCaption("Lvl: " + toString(pi->mLevel));
- mJobLevelLabel->setCaption("Job Lvl: " + toString(pi->mJobLevel));
- mMoneyLabel->setCaption("Gold: " + toString(pi->mGp));
+ mMoneyLabel->setCaption("Money: " + toString(pi->mMoney));
if (!mCharSelected)
{
mNewCharButton->setEnabled(false);
@@ -192,7 +190,6 @@ void CharSelectDialog::updatePlayerInfo()
} else {
mNameLabel->setCaption("Name");
mLevelLabel->setCaption("Level");
- mJobLevelLabel->setCaption("Job Level");
mMoneyLabel->setCaption("Money");
mNewCharButton->setEnabled(true);
mDelCharButton->setEnabled(false);
@@ -207,10 +204,11 @@ void CharSelectDialog::updatePlayerInfo()
void CharSelectDialog::attemptCharDelete()
{
// Request character deletion
- MessageOut outMsg;
- outMsg.writeShort(0x0068);
- outMsg.writeLong(mCharInfo->getEntry()->mCharId);
- outMsg.writeString("a@a.com", 40);
+ MessageOut msg;
+ msg.writeShort(PAMSG_CHAR_DELETE);
+ // TODO: Send the selected slot
+ msg.writeByte(0);
+ network->send(msg);
mCharInfo->lock();
}
@@ -326,15 +324,17 @@ void CharCreateDialog::attemptCharCreate()
{
// Send character infos
MessageOut outMsg;
- outMsg.writeShort(0x0067);
- outMsg.writeString(getName(), 24);
- outMsg.writeByte(5);
- outMsg.writeByte(5);
- outMsg.writeByte(5);
- outMsg.writeByte(5);
- outMsg.writeByte(5);
- outMsg.writeByte(5);
- outMsg.writeByte(mSlot);
- outMsg.writeShort(mPlayerBox->mHairColor + 1);
- outMsg.writeShort(mPlayerBox->mHairStyle + 1);
+ outMsg.writeShort(PAMSG_CHAR_CREATE);
+ outMsg.writeString(getName());
+ outMsg.writeByte(mPlayerBox->mHairStyle + 1);
+ outMsg.writeByte(mPlayerBox->mHairColor + 1);
+ // 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(outMsg);
}
diff --git a/src/gui/char_select.h b/src/gui/char_select.h
index 3bf9911e..e65f400d 100644
--- a/src/gui/char_select.h
+++ b/src/gui/char_select.h
@@ -69,7 +69,6 @@ class CharSelectDialog : public Window, public gcn::ActionListener
gcn::Label *mNameLabel;
gcn::Label *mLevelLabel;
- gcn::Label *mJobLevelLabel;
gcn::Label *mMoneyLabel;
PlayerBox *mPlayerBox;
diff --git a/src/gui/playerbox.cpp b/src/gui/playerbox.cpp
index f0ed9b71..d8faff99 100644
--- a/src/gui/playerbox.cpp
+++ b/src/gui/playerbox.cpp
@@ -94,8 +94,7 @@ void PlayerBox::draw(gcn::Graphics *graphics)
playerset[mSex]->get(0), 23, 12);
// Draw his hair
- if (mHairColor >= 0 && mHairStyle >= 0 &&
- mHairColor < NR_HAIR_COLORS && mHairStyle < NR_HAIR_STYLES)
+ if (mHairColor < NR_HAIR_COLORS && mHairStyle < NR_HAIR_STYLES)
{
int hf = 9 * mHairColor;
if (hf >= 0 && hf < (int)hairset[mHairStyle]->size()) {
diff --git a/src/gui/playerbox.h b/src/gui/playerbox.h
index 79f7c2aa..ec04eaf6 100644
--- a/src/gui/playerbox.h
+++ b/src/gui/playerbox.h
@@ -57,10 +57,10 @@ class PlayerBox : public gcn::ScrollArea
*/
void drawBorder(gcn::Graphics *graphics);
- int mHairColor; /**< The hair color index */
- int mHairStyle; /**< The hair style index */
- unsigned char mSex; /**< Sex */
- bool mShowPlayer; /**< Wether to show the player or not */
+ unsigned char mHairColor; /**< The hair color index */
+ unsigned char mHairStyle; /**< The hair style index */
+ unsigned char mSex; /**< Sex */
+ bool mShowPlayer; /**< Wether to show the player or not */
private:
static int instances;
diff --git a/src/gui/status.cpp b/src/gui/status.cpp
index bf109460..2b61ed35 100644
--- a/src/gui/status.cpp
+++ b/src/gui/status.cpp
@@ -48,7 +48,7 @@ StatusWindow::StatusWindow(LocalPlayer *player):
// ----------------------
mLvlLabel = new gcn::Label("Level:");
- mGpLabel = new gcn::Label("Money:");
+ mMoneyLabel = new gcn::Label("Money:");
mHpLabel = new gcn::Label("HP:");
mHpBar = new ProgressBar(1.0f, 80, 15, 0, 171, 34);
@@ -71,7 +71,7 @@ StatusWindow::StatusWindow(LocalPlayer *player):
mLvlLabel->setPosition(x, y);
x += mLvlLabel->getWidth() + 40;
- mGpLabel->setPosition(x, y);
+ mMoneyLabel->setPosition(x, y);
y += mLvlLabel->getHeight() + 5; // Next Row
x = 5;
@@ -100,7 +100,7 @@ StatusWindow::StatusWindow(LocalPlayer *player):
mJobValueLabel->setPosition(290, y);
add(mLvlLabel);
- add(mGpLabel);
+ add(mMoneyLabel);
add(mHpLabel);
add(mHpValueLabel);
add(mMpLabel);
@@ -227,8 +227,8 @@ void StatusWindow::update()
mLvlLabel->setCaption("Level: " + toString(mPlayer->mLevel));
mLvlLabel->adjustSize();
- mGpLabel->setCaption("Money: " + toString(mPlayer->mGp) + " GP");
- mGpLabel->adjustSize();
+ mMoneyLabel->setCaption("Money: " + toString(mPlayer->mMoney) + " GP");
+ mMoneyLabel->adjustSize();
mJobXpLabel->setCaption("Job: " + toString(mPlayer->mJobLevel));
mJobXpLabel->adjustSize();
@@ -334,7 +334,7 @@ void StatusWindow::update()
mStatsReflexPoints->adjustSize();
// Update Second column widgets position
- mGpLabel->setPosition(mLvlLabel->getX() + mLvlLabel->getWidth() + 20,
+ mMoneyLabel->setPosition(mLvlLabel->getX() + mLvlLabel->getWidth() + 20,
mLvlLabel->getY());
mXpLabel->setPosition(
diff --git a/src/gui/status.h b/src/gui/status.h
index 6b963d24..fe2140e3 100644
--- a/src/gui/status.h
+++ b/src/gui/status.h
@@ -69,7 +69,7 @@ class StatusWindow : public Window, public gcn::ActionListener {
/**
* Status Part
*/
- gcn::Label *mLvlLabel, *mGpLabel, *mHpLabel, *mHpValueLabel;
+ gcn::Label *mLvlLabel, *mMoneyLabel, *mHpLabel, *mHpValueLabel;
gcn::Label *mMpLabel, *mMpValueLabel;
gcn::Label *mXpLabel, *mXpValueLabel, *mJobXpLabel, *mJobValueLabel;
ProgressBar *mHpBar, *mMpBar;