diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-04-06 22:46:15 +0200 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-04-06 22:46:15 +0200 |
commit | f0fd20fdd649eb61fa0d2444d910a2b0882e3580 (patch) | |
tree | ee879af37c773e8a40b353e6e1e714ab5e1f45b1 /src/net/tmwserv/npchandler.cpp | |
parent | 7ee2220427d8735c777f504517c24c49afda699f (diff) | |
download | mana-client-f0fd20fdd649eb61fa0d2444d910a2b0882e3580.tar.gz mana-client-f0fd20fdd649eb61fa0d2444d910a2b0882e3580.tar.bz2 mana-client-f0fd20fdd649eb61fa0d2444d910a2b0882e3580.tar.xz mana-client-f0fd20fdd649eb61fa0d2444d910a2b0882e3580.zip |
Moved many MessageOut constructions around
No real point in having these abstracted away twice. We're using network
interfaces now instead of functions structured in namespaces.
Diffstat (limited to 'src/net/tmwserv/npchandler.cpp')
-rw-r--r-- | src/net/tmwserv/npchandler.cpp | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/src/net/tmwserv/npchandler.cpp b/src/net/tmwserv/npchandler.cpp index 63d341d7..5670bd69 100644 --- a/src/net/tmwserv/npchandler.cpp +++ b/src/net/tmwserv/npchandler.cpp @@ -21,11 +21,14 @@ #include "net/tmwserv/npchandler.h" +#include "net/tmwserv/connection.h" #include "net/tmwserv/protocol.h" +#include "net/tmwserv/gameserver/internal.h" #include "net/tmwserv/gameserver/player.h" #include "net/messagein.h" +#include "net/messageout.h" #include "beingmanager.h" #include "npc.h" @@ -91,12 +94,16 @@ void NpcHandler::handleMessage(MessageIn &msg) void NpcHandler::talk(int npcId) { - Net::GameServer::Player::talkToNPC(npcId, true); + MessageOut msg(PGMSG_NPC_TALK); + msg.writeInt16(npcId); + Net::GameServer::connection->send(msg); } void NpcHandler::nextDialog(int npcId) { - Net::GameServer::Player::talkToNPC(npcId, false); + MessageOut msg(PGMSG_NPC_TALK_NEXT); + msg.writeInt16(npcId); + Net::GameServer::connection->send(msg); } void NpcHandler::closeDialog(int npcId) @@ -106,7 +113,10 @@ void NpcHandler::closeDialog(int npcId) void NpcHandler::listInput(int npcId, int value) { - Net::GameServer::Player::selectFromNPC(npcId, value); + MessageOut msg(PGMSG_NPC_SELECT); + msg.writeInt16(npcId); + msg.writeInt8(value); + Net::GameServer::connection->send(msg); } void NpcHandler::integerInput(int npcId, int value) @@ -120,9 +130,12 @@ void NpcHandler::stringInput(int npcId, const std::string &value) } void NpcHandler::sendLetter(int npcId, const std::string &recipient, - const std::string &text) + const std::string &text) { - Net::GameServer::Player::sendLetter(recipient, text); + MessageOut msg(PGMSG_NPC_POST_SEND); + msg.writeString(recipient); + msg.writeString(text); + Net::GameServer::connection->send(msg); } void NpcHandler::startShopping(int beingId) @@ -142,12 +155,18 @@ void NpcHandler::sell(int beingId) void NpcHandler::buyItem(int beingId, int itemId, int amount) { - Net::GameServer::Player::tradeWithNPC(itemId, amount); + MessageOut msg(PGMSG_NPC_BUYSELL); + msg.writeInt16(itemId); + msg.writeInt16(amount); + Net::GameServer::connection->send(msg); } void NpcHandler::sellItem(int beingId, int itemId, int amount) { - Net::GameServer::Player::tradeWithNPC(itemId, amount); + MessageOut msg(PGMSG_NPC_BUYSELL); + msg.writeInt16(itemId); + msg.writeInt16(amount); + Net::GameServer::connection->send(msg); } void NpcHandler::endShopping(int beingId) |