diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-03-31 23:02:12 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-03-31 23:02:12 -0600 |
commit | ea4cfda4712ac31326b64ddf9dff61e448aeed28 (patch) | |
tree | 2bff17828862ebed77d44e65729a2d2944602ba9 /src/net/ea/tradehandler.cpp | |
parent | 78e67de6f70aab502a85578264b60493a818b39f (diff) | |
download | mana-ea4cfda4712ac31326b64ddf9dff61e448aeed28.tar.gz mana-ea4cfda4712ac31326b64ddf9dff61e448aeed28.tar.bz2 mana-ea4cfda4712ac31326b64ddf9dff61e448aeed28.tar.xz mana-ea4cfda4712ac31326b64ddf9dff61e448aeed28.zip |
Implement a few more handlers for eAthena
Party, skill, and trade handlers made for eAthena.
Diffstat (limited to 'src/net/ea/tradehandler.cpp')
-rw-r--r-- | src/net/ea/tradehandler.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/net/ea/tradehandler.cpp b/src/net/ea/tradehandler.cpp index 1df02a1e..3a6ebe07 100644 --- a/src/net/ea/tradehandler.cpp +++ b/src/net/ea/tradehandler.cpp @@ -24,6 +24,7 @@ #include "net/ea/protocol.h" #include "net/messagein.h" +#include "net/messageout.h" #include "inventory.h" #include "item.h" @@ -52,6 +53,8 @@ namespace { } listener; } +TradeHandler *tradeHandler; + TradeHandler::TradeHandler() { static const Uint16 _messages[] = { @@ -65,6 +68,7 @@ TradeHandler::TradeHandler() 0 }; handledMessages = _messages; + tradeHandler = this; } @@ -221,3 +225,48 @@ void TradeHandler::handleMessage(MessageIn &msg) break; } } + +void TradeHandler::request(Being *being) +{ + MessageOut outMsg(CMSG_TRADE_REQUEST); + outMsg.writeInt32(being->getId()); +} + +void TradeHandler::respond(bool accept) +{ + MessageOut outMsg(CMSG_TRADE_RESPONSE); + outMsg.writeInt8(accept ? 3 : 4); +} + +void TradeHandler::addItem(int slotNum, int amount) +{ + MessageOut outMsg(CMSG_TRADE_ITEM_ADD_REQUEST); + outMsg.writeInt16(slotNum + INVENTORY_OFFSET); + outMsg.writeInt32(amount); +} + +void TradeHandler::removeItem(int slotNum, int amount) +{ +} + +void TradeHandler::setMoney(int amount) +{ + MessageOut outMsg(CMSG_TRADE_ITEM_ADD_REQUEST); + outMsg.writeInt16(0); + outMsg.writeInt32(amount); +} + +void TradeHandler::confirm() +{ + MessageOut outMsg(CMSG_TRADE_ADD_COMPLETE); +} + +void TradeHandler::finish() +{ + MessageOut outMsg(CMSG_TRADE_OK); +} + +void TradeHandler::cancel() +{ + MessageOut outMsg(CMSG_TRADE_CANCEL_REQUEST); +} |