diff options
author | David Athay <ko2fan@gmail.com> | 2008-10-15 15:45:14 +0000 |
---|---|---|
committer | David Athay <ko2fan@gmail.com> | 2008-10-15 15:45:14 +0000 |
commit | 438be47fa7078cd235bda7d2461024ddc222c026 (patch) | |
tree | 45afebcc356b7e77a8999ef1bda638c638522fae | |
parent | 61a5caef2951f7e0e3a660514eb5d778d787df8f (diff) | |
download | mana-client-438be47fa7078cd235bda7d2461024ddc222c026.tar.gz mana-client-438be47fa7078cd235bda7d2461024ddc222c026.tar.bz2 mana-client-438be47fa7078cd235bda7d2461024ddc222c026.tar.xz mana-client-438be47fa7078cd235bda7d2461024ddc222c026.zip |
src/localplayer.cpp
src/net/beinghandler.cpp
src/net/protocol.h
src/net/gameserver/player.h
src/net/gameserver/player.cpp
src/net/beinghandler.h
ChangeLog
tmw.cbp
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | src/commandhandler.cpp | 11 | ||||
-rw-r--r-- | src/localplayer.cpp | 2 | ||||
-rw-r--r-- | src/net/beinghandler.cpp | 10 | ||||
-rw-r--r-- | src/net/beinghandler.h | 1 | ||||
-rw-r--r-- | src/net/gameserver/player.cpp | 22 | ||||
-rw-r--r-- | src/net/gameserver/player.h | 3 | ||||
-rw-r--r-- | src/net/protocol.h | 8 | ||||
-rw-r--r-- | tmw.cbp | 4 |
9 files changed, 67 insertions, 1 deletions
@@ -1,3 +1,10 @@ +2008-10-15 David Athay <ko2fan@gmail.com> + + * src/localplayer.cpp, src/net/beinghandler.cpp, src/net/protocol.h, + src/net/gameserver/player.h, src/net/gameserver/player.cpp, + src/net/beinghandler.h, tmw.cbp: Added communicating change of + direction to server. + 2008-10-10 Bjørn Lindeijer <bjorn@lindeijer.nl> * src/gui/shop.cpp, src/gui/shop.h, src/resources/itemdb.cpp, diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp index 7ec48f46..58b8905d 100644 --- a/src/commandhandler.cpp +++ b/src/commandhandler.cpp @@ -93,6 +93,17 @@ void CommandHandler::handleCommand(const std::string &command) { handleOp(args); } + else if (type == "post") + { + std::string::size_type pos = args.find(' '); + std::string recipient(args, 0, pos); + std::string text(args, pos+1); + Net::GameServer::Player::sendLetter(recipient, text); + } + else if (type == "check") + { + Net::GameServer::Player::getLetters(); + } else { chatWindow->chatLog("Unknown command"); diff --git a/src/localplayer.cpp b/src/localplayer.cpp index f596a8d9..d272caaf 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -283,7 +283,7 @@ void LocalPlayer::walk(unsigned char dir) else if (dir) { // If the being can't move, just change direction - // TODO: Communicate this to the server (waiting on tmwserv) + Net::GameServer::Player::changeDir(dir); setDirection(dir); } } diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp index 7e37aa27..fc3c7d1e 100644 --- a/src/net/beinghandler.cpp +++ b/src/net/beinghandler.cpp @@ -55,6 +55,7 @@ BeingHandler::BeingHandler() GPMSG_BEINGS_DAMAGE, GPMSG_BEING_ACTION_CHANGE, GPMSG_BEING_LOOKS_CHANGE, + GPMSG_BEING_DIR_CHANGE, 0 }; handledMessages = _messages; @@ -85,6 +86,9 @@ void BeingHandler::handleMessage(MessageIn &msg) case GPMSG_BEING_LOOKS_CHANGE: handleBeingLooksChangeMessage(msg); break; + case GPMSG_BEING_DIR_CHANGE: + handleBeingDirChangeMessage(msg); + break; } } @@ -319,3 +323,9 @@ void BeingHandler::handleBeingLooksChangeMessage(MessageIn &msg) handleLooks(static_cast< Player * >(being), msg); } +void BeingHandler::handleBeingDirChangeMessage(MessageIn &msg) +{ + Being *being = beingManager->findBeing(msg.readInt16()); + if (!being) return; + being->setDirection(msg.readInt8()); +} diff --git a/src/net/beinghandler.h b/src/net/beinghandler.h index d2a332a8..8ac07017 100644 --- a/src/net/beinghandler.h +++ b/src/net/beinghandler.h @@ -41,6 +41,7 @@ class BeingHandler : public MessageHandler void handleBeingsDamageMessage(MessageIn &msg); void handleBeingActionChangeMessage(MessageIn &msg); void handleBeingLooksChangeMessage(MessageIn &msg); + void handleBeingDirChangeMessage(MessageIn &msg); }; #endif diff --git a/src/net/gameserver/player.cpp b/src/net/gameserver/player.cpp index d8050d2b..28fd954a 100644 --- a/src/net/gameserver/player.cpp +++ b/src/net/gameserver/player.cpp @@ -160,6 +160,21 @@ void Net::GameServer::Player::tradeWithNPC(int item, int amount) Net::GameServer::connection->send(msg); } +void Net::GameServer::Player::sendLetter(const std::string &player, + const std::string &text) +{ + MessageOut msg(PGMSG_SEND_POST); + msg.writeString(player); + msg.writeString(text); + Net::GameServer::connection->send(msg); +} + +void Net::GameServer::Player::getLetters() +{ + MessageOut msg(PGMSG_GET_POST); + Net::GameServer::connection->send(msg); +} + void Net::GameServer::Player::raiseAttribute(int attribute) { MessageOut msg(PGMSG_RAISE_ATTRIBUTE); @@ -179,3 +194,10 @@ void Net::GameServer::Player::respawn() MessageOut msg(PGMSG_RESPAWN); Net::GameServer::connection->send(msg); } + +void Net::GameServer::Player::changeDir(unsigned char dir) +{ + MessageOut msg(PGMSG_DIRECTION_CHANGE); + msg.writeInt8(dir); + Net::GameServer::connection->send(msg); +} diff --git a/src/net/gameserver/player.h b/src/net/gameserver/player.h index eea15c2b..fa8c1376 100644 --- a/src/net/gameserver/player.h +++ b/src/net/gameserver/player.h @@ -59,10 +59,13 @@ namespace Net void tradeItem(int slot, int amount); void tradeMoney(int amount); void tradeWithNPC(int item, int amount); + void sendLetter(const std::string &player, const std::string &text); + void getLetters(); void raiseAttribute(int attribute); void lowerAttribute(int attribute); void respawn(); static RespawnRequestListener respawnListener; + void changeDir(unsigned char dir); } } } diff --git a/src/net/protocol.h b/src/net/protocol.h index bd4eaa17..f766d2da 100644 --- a/src/net/protocol.h +++ b/src/net/protocol.h @@ -99,6 +99,8 @@ enum { PGMSG_WALK = 0x0260, // W*2 destination PGMSG_ACTION_CHANGE = 0x0270, // B Action GPMSG_BEING_ACTION_CHANGE = 0x0271, // W being id, B action + PGMSG_DIRECTION_CHANGE = 0x0272, // B Direction + GPMSG_BEING_DIR_CHANGE = 0x0273, // W being id, B direction GPMSG_BEINGS_MOVE = 0x0280, // { W being id, B flags [, C position, B speed] [, W*2 destination] }* GPMSG_ITEMS = 0x0281, // { W item id, W*2 position }* PGMSG_ATTACK = 0x0290, // B direction @@ -180,6 +182,12 @@ enum { PCMSG_USER_MODE = 0x0465, // W channel id, S name, B mode PCMSG_KICK_USER = 0x0466, // W channel id, S name + // Post + PGMSG_SEND_POST = 0x04A0, // S player, S letter, { W attachment id } + GPMSG_SEND_POST_RESPONSE = 0x04A1, // B error + PGMSG_GET_POST = 0x04A2, // + GPMSG_GET_POST_RESPONSE = 0x04A3, // { L sender id, S letter, { W attachment id } } + XXMSG_INVALID = 0x7FFF }; @@ -217,6 +217,8 @@ <Unit filename="src/gui/help.h"> <Option target="default" /> </Unit> + <Unit filename="src/gui/icon.cpp" /> + <Unit filename="src/gui/icon.h" /> <Unit filename="src/gui/inttextbox.cpp" /> <Unit filename="src/gui/inttextbox.h"> <Option target="default" /> @@ -621,6 +623,8 @@ <Unit filename="src/player.h"> <Option target="default" /> </Unit> + <Unit filename="src/position.cpp" /> + <Unit filename="src/position.h" /> <Unit filename="src/properties.h"> <Option target="default" /> </Unit> |