diff options
Diffstat (limited to 'src/net/tmwa')
-rw-r--r-- | src/net/tmwa/beinghandler.cpp | 42 | ||||
-rw-r--r-- | src/net/tmwa/beinghandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/network.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/network.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/protocol.h | 1 |
5 files changed, 47 insertions, 2 deletions
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index 678be6cc4..6bbdac2e9 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -29,6 +29,7 @@ #include "guild.h" #include "guildmanager.h" #include "party.h" +#include "position.h" #include "being/localplayer.h" #include "being/playerrelations.h" @@ -95,6 +96,7 @@ BeingHandler::BeingHandler(const bool enableSync) : SMSG_BEING_IP_RESPONSE, SMSG_PVP_MAP_MODE, SMSG_PVP_SET, + SMSG_BEING_MOVE3, 0 }; handledMessages = _messages; @@ -121,6 +123,10 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) processBeingMove2(msg); break; + case SMSG_BEING_MOVE3: + processBeingMove3(msg); + break; + case SMSG_BEING_SPAWN: processBeingSpawn(msg); break; @@ -658,4 +664,40 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, dstBeing->setMoveTime(); } +void BeingHandler::processBeingMove3(Net::MessageIn &msg) const +{ + if (serverVersion < 10) + return; + + const static int dirx[8] = {0, -1, -1, -1, 0, 1, 1, 1}; + const static int diry[8] = {1, 1, 0, -1, -1, -1, 0, 1}; + + const int len = msg.readInt16() - 14; + Being *const dstBeing = actorSpriteManager->findBeing(msg.readInt32()); + if (!dstBeing) + return; + const int16_t speed = msg.readInt16(); + dstBeing->setWalkSpeed(Vector(speed, speed, 0)); + int16_t x = msg.readInt16(); + int16_t y = msg.readInt16(); + const unsigned char *moves = msg.readBytes(len); + Path path; + for (int f = 0; f < len; f ++) + { + const unsigned char dir = moves[f]; + if (dir <= 7) + { + x += dirx[dir]; + y += diry[dir]; + path.push_back(Position(x, y)); + } + else + { + logger->log("bad move packet: %d", dir); + } + } + + dstBeing->setPath(path); +} + } // namespace TmwAthena diff --git a/src/net/tmwa/beinghandler.h b/src/net/tmwa/beinghandler.h index c008d12be..eea967168 100644 --- a/src/net/tmwa/beinghandler.h +++ b/src/net/tmwa/beinghandler.h @@ -54,6 +54,8 @@ class BeingHandler final : public MessageHandler, public Ea::BeingHandler virtual void processPlayerMoveUpdate(Net::MessageIn &msg, const int type) const; + + virtual void processBeingMove3(Net::MessageIn &msg) const; }; } // namespace TmwAthena diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index 417a3633e..a77fbbf7c 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -83,7 +83,7 @@ int16_t packet_lengths[] = // #0x0200 26, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 19, 10, 0, 0, 0, 2, -1, 16, 0, 8, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - -1, 122, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -1, 122, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static const int packet_lengths_size diff --git a/src/net/tmwa/network.h b/src/net/tmwa/network.h index 62104592b..29b9de002 100644 --- a/src/net/tmwa/network.h +++ b/src/net/tmwa/network.h @@ -32,7 +32,7 @@ * Protocol version, reported to the eAthena char and mapserver who can adjust * the protocol accordingly. */ -#define CLIENT_PROTOCOL_VERSION 9 +#define CLIENT_PROTOCOL_VERSION 10 #define CLIENT_TMW_PROTOCOL_VERSION 1 namespace TmwAthena diff --git a/src/net/tmwa/protocol.h b/src/net/tmwa/protocol.h index a2d68da7d..9a4e39b85 100644 --- a/src/net/tmwa/protocol.h +++ b/src/net/tmwa/protocol.h @@ -349,6 +349,7 @@ enum #define CMSG_SET_STATUS 0x0213 #define SMSG_QUEST_SET_VAR 0x0214 #define SMSG_QUEST_PLAYER_VARS 0x0215 +#define SMSG_BEING_MOVE3 0x0225 #define CMSG_SEND_CLIENT_INFO 0x7533 #define SMSG_UPDATE_HOST2 0x7534 |