summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/net/tmwserv/gameserver/player.cpp20
-rw-r--r--src/net/tmwserv/gameserver/player.h3
-rw-r--r--src/net/tmwserv/tradehandler.cpp12
3 files changed, 9 insertions, 26 deletions
diff --git a/src/net/tmwserv/gameserver/player.cpp b/src/net/tmwserv/gameserver/player.cpp
index 733b7cdc..10ffdcda 100644
--- a/src/net/tmwserv/gameserver/player.cpp
+++ b/src/net/tmwserv/gameserver/player.cpp
@@ -57,26 +57,6 @@ void Net::GameServer::Player::useSpecial(int special)
Net::GameServer::connection->send(msg);
}
-void Net::GameServer::Player::requestTrade(int id)
-{
- MessageOut msg(PGMSG_TRADE_REQUEST);
- msg.writeInt16(id);
- Net::GameServer::connection->send(msg);
-}
-
-void Net::GameServer::Player::acceptTrade(bool accept)
-{
- MessageOut msg(accept ? PGMSG_TRADE_REQUEST : PGMSG_TRADE_CANCEL);
- Net::GameServer::connection->send(msg);
-}
-
-void Net::GameServer::Player::tradeMoney(int amount)
-{
- MessageOut msg(PGMSG_TRADE_SET_MONEY);
- msg.writeInt32(amount);
- Net::GameServer::connection->send(msg);
-}
-
void Net::GameServer::Player::raiseAttribute(int attribute)
{
MessageOut msg(PGMSG_RAISE_ATTRIBUTE);
diff --git a/src/net/tmwserv/gameserver/player.h b/src/net/tmwserv/gameserver/player.h
index 76d7844b..b6a51ef0 100644
--- a/src/net/tmwserv/gameserver/player.h
+++ b/src/net/tmwserv/gameserver/player.h
@@ -43,9 +43,6 @@ namespace Net
void walk(int x, int y);
void moveItem(int oldSlot, int newSlot, int amount);
void useSpecial(int special);
- void requestTrade(int id);
- void acceptTrade(bool accept);
- void tradeMoney(int amount);
void raiseAttribute(int attribute);
void lowerAttribute(int attribute);
void respawn();
diff --git a/src/net/tmwserv/tradehandler.cpp b/src/net/tmwserv/tradehandler.cpp
index aabd8b2a..55a00d4c 100644
--- a/src/net/tmwserv/tradehandler.cpp
+++ b/src/net/tmwserv/tradehandler.cpp
@@ -55,7 +55,11 @@ namespace {
void action(const gcn::ActionEvent &event)
{
if (event.getId() == "yes")
- Net::GameServer::Player::requestTrade(tradePartnerID);
+ {
+ MessageOut msg(PGMSG_TRADE_REQUEST);
+ msg.writeInt16(tradePartnerID);
+ Net::GameServer::connection->send(msg);
+ }
else
Net::getTradeHandler()->cancel();
}
@@ -105,7 +109,7 @@ void TradeHandler::handleMessage(MessageIn &msg)
Being *being = beingManager->findBeing(msg.readInt16());
if (!being || !mAcceptTradeRequests)
{
- Net::GameServer::Player::acceptTrade(false);
+ respond(false);
break;
}
player_node->setTrading(true);
@@ -171,7 +175,9 @@ void TradeHandler::request(Being *being)
void TradeHandler::respond(bool accept)
{
- // TODO
+ MessageOut msg(accept ? PGMSG_TRADE_REQUEST : PGMSG_TRADE_CANCEL);
+ Net::GameServer::connection->send(msg);
+
if (!accept)
player_node->setTrading(false);
}