diff options
Diffstat (limited to 'src/net/eathena')
-rw-r--r-- | src/net/eathena/beinghandler.cpp | 26 | ||||
-rw-r--r-- | src/net/eathena/packets.h | 2 |
2 files changed, 26 insertions, 2 deletions
diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp index 1d75bbe62..f06c9fc2c 100644 --- a/src/net/eathena/beinghandler.cpp +++ b/src/net/eathena/beinghandler.cpp @@ -528,6 +528,7 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg) const { uint16_t srcX, srcY, dstX, dstY; msg.readCoordinatePair(srcX, srcY, dstX, dstY, "move path"); + msg.readUInt8("(sx<<4) | (sy&0x0f)"); localPlayer->followMoveTo(dstBeing, srcX, srcY, dstX, dstY); @@ -737,7 +738,7 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg) const uint32_t weapon = static_cast<uint32_t>(msg.readInt32("weapon")); const uint16_t headBottom = msg.readInt16("head bottom"); - if (!visible) + if (!visible && !spawn) msg.readInt32("tick"); const uint16_t headTop = msg.readInt16("head top"); @@ -794,11 +795,34 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg) { uint16_t srcX, srcY, dstX, dstY; msg.readCoordinatePair(srcX, srcY, dstX, dstY, "move path"); + msg.readUInt8("(sx<<4) | (sy&0x0f)"); msg.readInt8("xs"); msg.readInt8("ys"); dstBeing->setAction(BeingAction::STAND, 0); dstBeing->setTileCoords(srcX, srcY); dstBeing->setDestination(dstX, dstY); + + // because server don't send direction in move packet, + // we fixing it + + int d = 0; + if (srcX == dstX && srcY == dstY) + { // if player did one step from invisible area to visible, + //move path is broken + int x2 = localPlayer->getTileX(); + int y2 = localPlayer->getTileY(); + if (abs(x2 - srcX) > abs(y2 - srcY)) + y2 = srcY; + else + x2 = srcX; + d = dstBeing->calcDirection(x2, y2); + } + else + { + d = dstBeing->calcDirection(dstX, dstY); + } + if (d && dstBeing->getDirection() != d) + dstBeing->setDirection(d); } else { diff --git a/src/net/eathena/packets.h b/src/net/eathena/packets.h index 6bffb0948..c04c66102 100644 --- a/src/net/eathena/packets.h +++ b/src/net/eathena/packets.h @@ -221,7 +221,7 @@ int16_t packet_lengths[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 0, // #0x0840 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // #0x0880 |