summaryrefslogtreecommitdiff
path: root/src/net/eathena/beingrecv.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-04-03 01:14:10 +0300
committerAndrei Karas <akaras@inbox.ru>2016-04-03 01:17:43 +0300
commit22c35aca82a7c3bdee4039f34914dc067fe5d8db (patch)
tree4411ed639b4ec69a58c7e46fb88625cbc22d4291 /src/net/eathena/beingrecv.cpp
parent04d36b4ef7abcc768472dad3f3fa2529714288ce (diff)
downloadmanaplus-22c35aca82a7c3bdee4039f34914dc067fe5d8db.tar.gz
manaplus-22c35aca82a7c3bdee4039f34914dc067fe5d8db.tar.bz2
manaplus-22c35aca82a7c3bdee4039f34914dc067fe5d8db.tar.xz
manaplus-22c35aca82a7c3bdee4039f34914dc067fe5d8db.zip
Sort more packets. Add version checks inside packets.
Diffstat (limited to 'src/net/eathena/beingrecv.cpp')
-rw-r--r--src/net/eathena/beingrecv.cpp56
1 files changed, 41 insertions, 15 deletions
diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp
index 5d8056d0f..c97cf6429 100644
--- a/src/net/eathena/beingrecv.cpp
+++ b/src/net/eathena/beingrecv.cpp
@@ -262,14 +262,22 @@ void BeingRecv::processBeingVisible(Net::MessageIn &msg)
if (!actorManager)
return;
- msg.readInt16("len");
- const BeingType::BeingType type = static_cast<BeingType::BeingType>(
- msg.readUInt8("object type"));
+ // need set type based on id
+ BeingType::BeingType type = BeingType::MONSTER;
+ if (msg.getVersion() >= 20091103)
+ {
+ msg.readInt16("len");
+ const BeingType::BeingType type = static_cast<BeingType::BeingType>(
+ msg.readUInt8("object type"));
+ }
// Information about a being in range
const BeingId id = msg.readBeingId("being id");
- if (serverVersion == 0 || serverVersion >= 11)
+ if (msg.getVersion() >= 20131223 &&
+ (serverVersion == 0 || serverVersion >= 11))
+ {
msg.readBeingId("char id");
+ }
BeingId spawnId;
if (id == Ea::BeingRecv::mSpawnId)
spawnId = Ea::BeingRecv::mSpawnId;
@@ -281,7 +289,11 @@ void BeingRecv::processBeingVisible(Net::MessageIn &msg)
const uint32_t opt1 = msg.readInt16("opt1");
// probably wrong effect usage
const uint32_t opt2 = msg.readInt16("opt2");
- const uint32_t option = msg.readInt32("option");
+ uint32_t option;
+ if (msg.getVersion() >= 20080102)
+ option = msg.readInt32("option");
+ else
+ option = msg.readInt16("option");
const int16_t job = msg.readInt16("class");
Being *dstBeing = actorManager->findBeing(id);
@@ -334,9 +346,14 @@ void BeingRecv::processBeingVisible(Net::MessageIn &msg)
localPlayer->checkNewName(dstBeing);
const int hairStyle = msg.readInt16("hair style");
- const uint32_t weapon = CAST_U32(msg.readInt32("weapon"));
+ uint32_t weapon;
+ if (msg.getVersion() >= 7)
+ weapon = CAST_U32(msg.readInt32("weapon"));
+ else
+ weapon = CAST_U32(msg.readInt16("weapon"));
const uint16_t headBottom = msg.readInt16("head bottom");
-
+ if (msg.getVersion() < 7)
+ msg.readInt16("shield");
const uint16_t headTop = msg.readInt16("head top");
const uint16_t headMid = msg.readInt16("head mid");
const ItemColor hairColor = fromInt(msg.readInt16("hair color"),
@@ -345,11 +362,16 @@ void BeingRecv::processBeingVisible(Net::MessageIn &msg)
const uint16_t gloves = msg.readInt16("head dir / gloves");
// may be use robe as gloves?
- msg.readInt16("robe");
+ if (msg.getVersion() >= 20101124)
+ msg.readInt16("robe");
msg.readInt32("guild id");
msg.readInt16("guild emblem");
dstBeing->setManner(msg.readInt16("manner"));
- const uint32_t opt3 = msg.readInt32("opt3");
+ uint32_t opt3;
+ if (msg.getVersion() >= 7)
+ opt3 = msg.readInt32("opt3");
+ else
+ opt3 = msg.readInt16("opt3");
dstBeing->setKarma(msg.readUInt8("karma"));
const uint8_t gender = CAST_U8(msg.readUInt8("gender") & 3);
@@ -402,14 +424,18 @@ void BeingRecv::processBeingVisible(Net::MessageIn &msg)
const int level = CAST_S32(msg.readInt16("level"));
if (level)
dstBeing->setLevel(level);
- msg.readInt16("font");
+ if (msg.getVersion() >= 20080102)
+ msg.readInt16("font");
- const int maxHP = msg.readInt32("max hp");
- const int hp = msg.readInt32("hp");
- dstBeing->setMaxHP(maxHP);
- dstBeing->setHP(hp);
+ if (msg.getVersion() >= 20120221)
+ {
+ const int maxHP = msg.readInt32("max hp");
+ const int hp = msg.readInt32("hp");
+ dstBeing->setMaxHP(maxHP);
+ dstBeing->setHP(hp);
+ msg.readInt8("is boss");
+ }
- msg.readInt8("is boss");
if (msg.getVersion() >= 20150513)
{
msg.readInt16("body2");