summaryrefslogtreecommitdiff
path: root/src/gui
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
parentfa035c2fd70945a0b12143ce9b81284d8d24d13b (diff)
downloadmana-client-5f0ebee0d4d75fa91d417f4f352abdbc7502c2f0.tar.gz
mana-client-5f0ebee0d4d75fa91d417f4f352abdbc7502c2f0.tar.bz2
mana-client-5f0ebee0d4d75fa91d417f4f352abdbc7502c2f0.tar.xz
mana-client-5f0ebee0d4d75fa91d417f4f352abdbc7502c2f0.zip
Network layer refactoring.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/buy.cpp6
-rw-r--r--src/gui/char_select.cpp50
-rw-r--r--src/gui/chat.cpp17
-rw-r--r--src/gui/sell.cpp6
-rw-r--r--src/gui/serverdialog.cpp3
-rw-r--r--src/gui/status.cpp12
-rw-r--r--src/gui/trade.cpp19
7 files changed, 49 insertions, 64 deletions
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index ae779503..41bdd67e 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.cpp
@@ -36,9 +36,6 @@
#include "../resources/iteminfo.h"
#include "../resources/itemmanager.h"
-#include "../net/messageout.h"
-#include "../net/protocol.h"
-
#include "../utils/tostring.h"
@@ -225,10 +222,13 @@ void BuyDialog::action(const std::string &eventId, gcn::Widget *widget)
else if (eventId == "buy" && (mAmountItems > 0 &&
mAmountItems <= mMaxItems))
{
+ // XXX Convert for new server
+ /*
MessageOut outMsg(CMSG_NPC_BUY_REQUEST);
outMsg.writeShort(8);
outMsg.writeShort(mAmountItems);
outMsg.writeShort(mShopItems->at(selectedItem).id);
+ */
// update money !
mMoney -= mAmountItems * mShopItems->at(selectedItem).price;
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);
-}
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 9a5d60b0..3dc252ab 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -36,9 +36,9 @@
#include "../game.h"
#include "../localplayer.h"
-#include "../net/messageout.h"
-#include "../net/network.h"
-#include "../net/protocol.h"
+#include "../net/chatserver/chatserver.h"
+
+#include "../net/gameserver/player.h"
ChatWindow::ChatWindow():
Window(""),
@@ -249,16 +249,12 @@ ChatWindow::chatSend(const std::string &nick, std::string msg)
// Prepare ordinary message
if (msg.substr(0, 1) != "/") {
- MessageOut outMsg(PGMSG_SAY);
- outMsg.writeString(msg);
- Network::send(Network::GAME, outMsg);
+ Net::GameServer::Player::say(msg);
}
else if (msg.substr(0, IS_ANNOUNCE_LENGTH) == IS_ANNOUNCE)
{
msg.erase(0, IS_ANNOUNCE_LENGTH);
- MessageOut outMsg(0x0099);
- outMsg.writeShort(msg.length() + 4);
- outMsg.writeString(msg, msg.length());
+ Net::ChatServer::announce(msg);
}
else if (msg.substr(0, IS_HELP_LENGTH) == IS_HELP)
{
@@ -274,7 +270,10 @@ ChatWindow::chatSend(const std::string &nick, std::string msg)
}
else if (msg.substr(0, IS_WHO_LENGTH) == IS_WHO)
{
+ // XXX Convert for new server
+ /*
MessageOut outMsg(0x00c1);
+ */
}
else
{
diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp
index d6d8cad5..9c25aced 100644
--- a/src/gui/sell.cpp
+++ b/src/gui/sell.cpp
@@ -39,9 +39,6 @@
#include "../resources/iteminfo.h"
#include "../resources/itemmanager.h"
-#include "../net/messageout.h"
-#include "../net/protocol.h"
-
#include "../utils/tostring.h"
SellDialog::SellDialog():
@@ -218,10 +215,13 @@ void SellDialog::action(const std::string &eventId, gcn::Widget *widget)
// Attempt sell
assert(mAmountItems > 0 && mAmountItems <= mMaxItems);
+ // XXX Convert for new server
+ /*
MessageOut outMsg(CMSG_NPC_SELL_REQUEST);
outMsg.writeShort(8);
outMsg.writeShort(mShopItems->at(selectedItem).index);
outMsg.writeShort(mAmountItems);
+ */
mMaxItems -= mAmountItems;
mAmountItems = 0;
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index 450ae809..39abd5ed 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -236,9 +236,6 @@ ServerDialog::action(const std::string &eventId, gcn::Widget *widget)
currentConfig = "MostUsedServerPort" + toString(i);
config.setValue(currentConfig, toString(currentServer.port));
}
- logger->log("Trying to connect to account server...");
- Network::connect(Network::ACCOUNT,
- mLoginData->hostname, mLoginData->port);
state = STATE_CONNECT_ACCOUNT;
}
}
diff --git a/src/gui/status.cpp b/src/gui/status.cpp
index 2b61ed35..b53e0942 100644
--- a/src/gui/status.cpp
+++ b/src/gui/status.cpp
@@ -368,27 +368,27 @@ void StatusWindow::action(const std::string &eventId, gcn::Widget *widget)
{
if (eventId == "STR")
{
- player_node->raiseAttribute(LocalPlayer::STR);
+ mPlayer->raiseAttribute(LocalPlayer::STR);
}
if (eventId == "AGI")
{
- player_node->raiseAttribute(LocalPlayer::AGI);
+ mPlayer->raiseAttribute(LocalPlayer::AGI);
}
if (eventId == "VIT")
{
- player_node->raiseAttribute(LocalPlayer::VIT);
+ mPlayer->raiseAttribute(LocalPlayer::VIT);
}
if (eventId == "INT")
{
- player_node->raiseAttribute(LocalPlayer::INT);
+ mPlayer->raiseAttribute(LocalPlayer::INT);
}
if (eventId == "DEX")
{
- player_node->raiseAttribute(LocalPlayer::DEX);
+ mPlayer->raiseAttribute(LocalPlayer::DEX);
}
if (eventId == "LUK")
{
- player_node->raiseAttribute(LocalPlayer::LUK);
+ mPlayer->raiseAttribute(LocalPlayer::LUK);
}
}
}
diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp
index 44efbdb1..630881ea 100644
--- a/src/gui/trade.cpp
+++ b/src/gui/trade.cpp
@@ -38,9 +38,6 @@
#include "../inventory.h"
#include "../item.h"
-#include "../net/messageout.h"
-#include "../net/protocol.h"
-
#include "../resources/iteminfo.h"
#include "../utils/tostring.h"
@@ -216,9 +213,12 @@ void TradeWindow::receivedOk(bool own)
void TradeWindow::tradeItem(Item *item, int quantity)
{
+ // XXX Convert for new server
+ /*
MessageOut outMsg(CMSG_TRADE_ITEM_ADD_REQUEST);
outMsg.writeShort(item->getInvIndex());
outMsg.writeLong(quantity);
+ */
}
void TradeWindow::selectionChanged(const SelectionEvent &event)
@@ -288,7 +288,10 @@ void TradeWindow::action(const std::string &eventId, gcn::Widget *widget)
}
else if (eventId == "cancel")
{
+ // XXX Convert for new server
+ /*
MessageOut outMsg(CMSG_TRADE_CANCEL_REQUEST);
+ */
}
else if (eventId == "ok")
{
@@ -298,17 +301,27 @@ void TradeWindow::action(const std::string &eventId, gcn::Widget *widget)
{
mMoneyField->setText(toString(tempInt));
+ // XXX Convert for new server
+ /*
MessageOut outMsg(CMSG_TRADE_ITEM_ADD_REQUEST);
outMsg.writeShort(0);
outMsg.writeLong(tempInt);
+ */
} else {
mMoneyField->setText("");
}
mMoneyField->setEnabled(false);
+
+ // XXX Convert for new server
+ /*
MessageOut outMsg(CMSG_TRADE_ADD_COMPLETE);
+ */
}
else if (eventId == "trade")
{
+ // XXX Convert for new server
+ /*
MessageOut outMsg(CMSG_TRADE_OK);
+ */
}
}