summaryrefslogtreecommitdiff
path: root/src/net/tmwserv/tradehandler.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-04-03 07:39:18 -0600
committerJared Adams <jaxad0127@gmail.com>2009-04-03 07:39:18 -0600
commit754cc498156371d0b6d32de0e58d7256236ed676 (patch)
tree54abf2170a48e72dffdf8a2ba7ded5386fc28813 /src/net/tmwserv/tradehandler.cpp
parentd13b3eaca82e3547c84f60b9b135464ff3a51cf0 (diff)
downloadmana-754cc498156371d0b6d32de0e58d7256236ed676.tar.gz
mana-754cc498156371d0b6d32de0e58d7256236ed676.tar.bz2
mana-754cc498156371d0b6d32de0e58d7256236ed676.tar.xz
mana-754cc498156371d0b6d32de0e58d7256236ed676.zip
Fill in TMWServ's TradeHandler
Also started temparary implementation of the Net::getXHandler() methods and started using them.
Diffstat (limited to 'src/net/tmwserv/tradehandler.cpp')
-rw-r--r--src/net/tmwserv/tradehandler.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/net/tmwserv/tradehandler.cpp b/src/net/tmwserv/tradehandler.cpp
index 8b3e06c6..07ed81e6 100644
--- a/src/net/tmwserv/tradehandler.cpp
+++ b/src/net/tmwserv/tradehandler.cpp
@@ -54,6 +54,8 @@ namespace {
} listener;
}
+Net::TradeHandler *tradeHandler;
+
TradeHandler::TradeHandler():
mAcceptTradeRequests(true)
{
@@ -68,6 +70,7 @@ TradeHandler::TradeHandler():
0
};
handledMessages = _messages;
+ tradeHandler = this;
}
void TradeHandler::setAcceptTradeRequests(bool acceptTradeRequests)
@@ -136,3 +139,49 @@ void TradeHandler::handleMessage(MessageIn &msg)
break;
}
}
+
+void TradeHandler::request(Being *being)
+{
+ extern std::string tradePartnerName;
+ extern int tradePartnerID;
+ tradePartnerName = being->getName();
+ tradePartnerID = being->getId();
+ Net::GameServer::Player::requestTrade(tradePartnerID);
+}
+
+void TradeHandler::respond(bool accept)
+{
+ // TODO
+}
+
+void TradeHandler::addItem(Item *item, int amount)
+{
+ Net::GameServer::Player::tradeItem(item->getInvIndex(), amount);
+ tradeWindow->addItem(item->getId(), true, amount);
+ item->increaseQuantity(-amount);
+}
+
+void TradeHandler::removeItem(int slotNum, int amount)
+{
+ // TODO
+}
+
+void TradeHandler::setMoney(int amount)
+{
+ // TODO
+}
+
+void TradeHandler::confirm()
+{
+ // TODO
+}
+
+void TradeHandler::finish()
+{
+ // TODO
+}
+
+void TradeHandler::cancel()
+{
+ Net::GameServer::Player::acceptTrade(false);
+}