summaryrefslogtreecommitdiff
path: root/src/net/eathena
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-05 01:11:42 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-06 01:18:57 +0300
commit2549b4753c78726677583d046fc8841c8f3e3577 (patch)
treede419fee17b1dcac0523668c1edc7569b18d4b78 /src/net/eathena
parent8f8a9d2f1791754a1376ba9c7f010ee47d091598 (diff)
downloadplus-2549b4753c78726677583d046fc8841c8f3e3577.tar.gz
plus-2549b4753c78726677583d046fc8841c8f3e3577.tar.bz2
plus-2549b4753c78726677583d046fc8841c8f3e3577.tar.xz
plus-2549b4753c78726677583d046fc8841c8f3e3577.zip
eathena: fix packet SMSG_BEING_SPAWN 0x0858.
Also being direction if moved from outside to first visible tile.
Diffstat (limited to 'src/net/eathena')
-rw-r--r--src/net/eathena/beinghandler.cpp26
-rw-r--r--src/net/eathena/packets.h2
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