diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-04-03 01:14:10 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-04-03 01:17:43 +0300 |
commit | 22c35aca82a7c3bdee4039f34914dc067fe5d8db (patch) | |
tree | 4411ed639b4ec69a58c7e46fb88625cbc22d4291 /src/net | |
parent | 04d36b4ef7abcc768472dad3f3fa2529714288ce (diff) | |
download | manaplus-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')
-rw-r--r-- | src/net/eathena/beingrecv.cpp | 56 | ||||
-rw-r--r-- | src/net/eathena/packetsin.inc | 35 |
2 files changed, 70 insertions, 21 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"); diff --git a/src/net/eathena/packetsin.inc b/src/net/eathena/packetsin.inc index 4ec165b88..2c0e78407 100644 --- a/src/net/eathena/packetsin.inc +++ b/src/net/eathena/packetsin.inc @@ -41,6 +41,7 @@ packet(SMSG_VENDING_OPEN, 0x0136, -1, &VendingRecv::processOpe packet(SMSG_SKILL_CASTING, 0x013e, 24, &BeingRecv::processSkillCasting, 1); packet(SMSG_BEING_STATUS_CHANGE, 0x0196, 9, &BeingRecv::processBeingStatusChange, 1); packet(SMSG_QUEST_LIST, 0x02b1, -1, &QuestRecv::processAddQuests, 1); +packet(SMSG_BEING_VIEW_EQUIPMENT, 0x02d7, -1, &BeingRecv::processBeingViewEquipment, 1); // login server, unknown version packet(SMSG_LOGIN_DATA, 0x0069, -1, &Ea::LoginRecv::processLoginData, 0); @@ -275,7 +276,11 @@ if (packetVersion >= 3) } // 4 -packet(SMSG_BEING_CHANGE_LOOKS2, 0x01d7, 11, &BeingRecv::processBeingChangeLook2, 4); +if (packetVersion >= 4) +{ + packet(SMSG_BEING_CHANGE_LOOKS2, 0x01d7, 11, &BeingRecv::processBeingChangeLook2, 4); + packet(SMSG_BEING_VISIBLE, 0x01d8, 54, &BeingRecv::processBeingVisible, 4); +} // 5 packet(SMSG_PLAYER_STORAGE_ADD, 0x01c4, 22, &InventoryRecv::processPlayerStorageAdd, 5); @@ -288,6 +293,11 @@ if (packetVersion >= 6) packet(SMSG_TRADE_RESPONSE, 0x01f5, 9, &TradeRecv::processTradeResponse, 6); } +if (packetVersion >= 7) +{ + packet(SMSG_BEING_VISIBLE, 0x022a, 58, &BeingRecv::processBeingVisible, 7); +} + // 20040816 packet(SMSG_ADMIN_ACCOUNT_STATS, 0x0214, 42, &AdminRecv::processAccountStats, 20040816); @@ -453,6 +463,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_VISIBLE, 0x02ee, 60, &BeingRecv::processBeingVisible, 20080102); packet(SMSG_BEING_FONT, 0x02ef, 8, &BeingRecv::processBeingFont, 20080102); } @@ -505,6 +516,11 @@ packet(SMSG_CHAR_CAPTCHA_NOT_SUPPORTED, 0x07e9, 5, &CharServerRecv::process // 20091027 packet(SMSG_PLAYER_GET_EXP, 0x07f6, 14, &PlayerRecv::processPlayerGetExp, 20091027); +if (packetVersion >= 20091103) +{ + packet(SMSG_BEING_VISIBLE, 0x07f9, -1, &BeingRecv::processBeingVisible, 20091103); +} + // 20091104 if (packetVersion >= 20091104) { @@ -581,7 +597,11 @@ if (packetVersion >= 20100701) packet(SMSG_GUILD_EXPULSION, 0x0839, 66, &GuildRecv::processGuildExpulsion, 20100803); // 20101124 -packet(SMSG_BEING_VIEW_EQUIPMENT, 0x0859, -1, &BeingRecv::processBeingViewEquipment, 20101124); +if (packetVersion >= 20101124) +{ + packet(SMSG_BEING_VISIBLE, 0x0857, -1, &BeingRecv::processBeingVisible, 20101124); + packet(SMSG_BEING_VIEW_EQUIPMENT, 0x0859, -1, &BeingRecv::processBeingViewEquipment, 20101124); +} // 20110718 if (packetVersion >= 20110718) @@ -596,9 +616,12 @@ packet(SMSG_SKILL_SNAP, 0x08d2, 10, &BeingRecv::processBeing packet(SMSG_LOGIN_ERROR2, 0x083e, 26, &LoginRecv::processLoginError2, 20120000); // 20120221 -packet(SMSG_BEING_VISIBLE, 0x0915, -1, &BeingRecv::processBeingVisible, 20120221); -packet(SMSG_BEING_MOVE, 0x0914, -1, &BeingRecv::processBeingMove, 20120221); -packet(SMSG_BEING_SPAWN, 0x090f, -1, &BeingRecv::processBeingSpawn, 20120221); +if (packetVersion >= 20120221) +{ + packet(SMSG_BEING_VISIBLE, 0x0915, -1, &BeingRecv::processBeingVisible, 20120221); + packet(SMSG_BEING_MOVE, 0x0914, -1, &BeingRecv::processBeingMove, 20120221); + packet(SMSG_BEING_SPAWN, 0x090f, -1, &BeingRecv::processBeingSpawn, 20120221); +} // 20120410 packet(SMSG_BEING_CHARM, 0x08cf, 10, &BeingRecv::processBeingCharm, 20120410); @@ -727,7 +750,7 @@ if ((serverVersion >= 8 || serverVersion == 0) && packetVersion >= 20150226) packet(SMSG_BEING_VIEW_EQUIPMENT, 0x0a2d, -1, &BeingRecv::processBeingViewEquipment, 20150226); } -// partial implimentation for future use +// 20150513 if (packetVersion >= 20150513) { packet(SMSG_DRESS_ROOM_OPEN, 0x0a02, 4, &PlayerRecv::processDressRoomOpen, 20150513); |