summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-04-03 14:53:44 +0300
committerAndrei Karas <akaras@inbox.ru>2016-04-03 14:53:44 +0300
commit7f6df4082cce1c27ca2999b7c421fd0c8593cf86 (patch)
treeb1b1408fe43506a7d1aab425461a24e79970d01f /src
parent22c35aca82a7c3bdee4039f34914dc067fe5d8db (diff)
downloadManaVerse-7f6df4082cce1c27ca2999b7c421fd0c8593cf86.tar.gz
ManaVerse-7f6df4082cce1c27ca2999b7c421fd0c8593cf86.tar.bz2
ManaVerse-7f6df4082cce1c27ca2999b7c421fd0c8593cf86.tar.xz
ManaVerse-7f6df4082cce1c27ca2999b7c421fd0c8593cf86.zip
Sort more packets. Add version checks inside packets.
Diffstat (limited to 'src')
-rw-r--r--src/net/eathena/beingrecv.cpp61
-rw-r--r--src/net/eathena/packetsin.inc6
2 files changed, 49 insertions, 18 deletions
diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp
index c97cf6429..ef6ebf3d6 100644
--- a/src/net/eathena/beingrecv.cpp
+++ b/src/net/eathena/beingrecv.cpp
@@ -267,7 +267,7 @@ void BeingRecv::processBeingVisible(Net::MessageIn &msg)
if (msg.getVersion() >= 20091103)
{
msg.readInt16("len");
- const BeingType::BeingType type = static_cast<BeingType::BeingType>(
+ type = static_cast<BeingType::BeingType>(
msg.readUInt8("object type"));
}
@@ -623,21 +623,33 @@ void BeingRecv::processBeingSpawn(Net::MessageIn &msg)
if (!actorManager)
return;
- msg.readInt16("len");
- const BeingType::BeingType type = static_cast<BeingType::BeingType>(
- msg.readUInt8("object type"));
+ // need get type from id
+ BeingType::BeingType type = BeingType::MONSTER;
+ if (msg.getVersion() >= 20091103)
+ {
+ msg.readInt16("len");
+ 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");
+ }
Ea::BeingRecv::mSpawnId = id;
const BeingId spawnId = id;
int16_t speed = msg.readInt16("speed");
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);
@@ -682,9 +694,14 @@ void BeingRecv::processBeingSpawn(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(
@@ -692,11 +709,17 @@ void BeingRecv::processBeingSpawn(Net::MessageIn &msg)
const uint16_t shoes = msg.readInt16("shoes or clothes color?");
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);
@@ -748,14 +771,16 @@ void BeingRecv::processBeingSpawn(Net::MessageIn &msg)
const int level = CAST_S32(msg.readInt16("level"));
if (level)
dstBeing->setLevel(level);
- msg.readInt16("font");
-
- const int maxHP = msg.readInt32("max hp");
- const int hp = msg.readInt32("hp");
- dstBeing->setMaxHP(maxHP);
- dstBeing->setHP(hp);
-
- msg.readInt8("is boss");
+ if (msg.getVersion() >= 20080102)
+ msg.readInt16("font");
+ 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");
+ }
if (msg.getVersion() >= 20150513)
{
msg.readInt16("body2");
diff --git a/src/net/eathena/packetsin.inc b/src/net/eathena/packetsin.inc
index 2c0e78407..1febbe6da 100644
--- a/src/net/eathena/packetsin.inc
+++ b/src/net/eathena/packetsin.inc
@@ -22,6 +22,7 @@
// very outdated packets
packet(SMSG_BEING_FAKE_NAME, 0x0078, 54, &BeingRecv::processBeingFakeName, 1);
+packet(SMSG_BEING_SPAWN, 0x0079, 53, &BeingRecv::processBeingSpawn, 1);
packet(SMSG_WHISPER, 0x0097, -1, &ChatRecv::processWhisper, 1);
packet(SMSG_WHISPER_RESPONSE, 0x0098, 3, &ChatRecv::processWhisperResponse, 1);
packet(SMSG_PLAYER_EQUIPMENT, 0x00a4, -1, &InventoryRecv::processPlayerEquipment, 1);
@@ -280,6 +281,7 @@ if (packetVersion >= 4)
{
packet(SMSG_BEING_CHANGE_LOOKS2, 0x01d7, 11, &BeingRecv::processBeingChangeLook2, 4);
packet(SMSG_BEING_VISIBLE, 0x01d8, 54, &BeingRecv::processBeingVisible, 4);
+ packet(SMSG_BEING_SPAWN, 0x01d9, 53, &BeingRecv::processBeingSpawn, 4);
}
// 5
@@ -296,6 +298,7 @@ if (packetVersion >= 6)
if (packetVersion >= 7)
{
packet(SMSG_BEING_VISIBLE, 0x022a, 58, &BeingRecv::processBeingVisible, 7);
+ packet(SMSG_BEING_SPAWN, 0x022b, 57, &BeingRecv::processBeingSpawn, 7);
}
// 20040816
@@ -463,6 +466,7 @@ if (packetVersion >= 20080102)
packet(SMSG_PLAYER_CART_ITEMS, 0x02e9, -1, &InventoryRecv::processPlayerCartItems, 20080102);
packet(SMSG_PLAYER_STORAGE_ITEMS, 0x02ea, -1, &InventoryRecv::processPlayerStorage, 20080102);
packet(SMSG_MAP_LOGIN_SUCCESS, 0x02eb, 14, &GameRecv::processMapLogin, 20080102);
+ packet(SMSG_BEING_SPAWN, 0x02ed, 59, &BeingRecv::processBeingSpawn, 20080102);
packet(SMSG_BEING_VISIBLE, 0x02ee, 60, &BeingRecv::processBeingVisible, 20080102);
packet(SMSG_BEING_FONT, 0x02ef, 8, &BeingRecv::processBeingFont, 20080102);
}
@@ -518,6 +522,7 @@ packet(SMSG_PLAYER_GET_EXP, 0x07f6, 14, &PlayerRecv::processPlay
if (packetVersion >= 20091103)
{
+ packet(SMSG_BEING_SPAWN, 0x07f8, -1, &BeingRecv::processBeingSpawn, 20091103);
packet(SMSG_BEING_VISIBLE, 0x07f9, -1, &BeingRecv::processBeingVisible, 20091103);
}
@@ -600,6 +605,7 @@ packet(SMSG_GUILD_EXPULSION, 0x0839, 66, &GuildRecv::processGuild
if (packetVersion >= 20101124)
{
packet(SMSG_BEING_VISIBLE, 0x0857, -1, &BeingRecv::processBeingVisible, 20101124);
+ packet(SMSG_BEING_SPAWN, 0x0858, -1, &BeingRecv::processBeingSpawn, 20101124);
packet(SMSG_BEING_VIEW_EQUIPMENT, 0x0859, -1, &BeingRecv::processBeingViewEquipment, 20101124);
}