diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-07-26 03:02:37 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-07-26 22:01:35 +0300 |
commit | de90520de303659fe639794544c2e19d462b3907 (patch) | |
tree | 36b306a26e2c9dd422aede36f2f9ca3158ffbae2 /src/net/eathena/skillrecv.cpp | |
parent | 45527f8597dfac68e914a798184282faeb1493f2 (diff) | |
download | mv-de90520de303659fe639794544c2e19d462b3907.tar.gz mv-de90520de303659fe639794544c2e19d462b3907.tar.bz2 mv-de90520de303659fe639794544c2e19d462b3907.tar.xz mv-de90520de303659fe639794544c2e19d462b3907.zip |
Add support for changed item id size in packets.
From some packet version hercules support item id fields as int32.
Diffstat (limited to 'src/net/eathena/skillrecv.cpp')
-rw-r--r-- | src/net/eathena/skillrecv.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/net/eathena/skillrecv.cpp b/src/net/eathena/skillrecv.cpp index 2d7bb04a9..609f71250 100644 --- a/src/net/eathena/skillrecv.cpp +++ b/src/net/eathena/skillrecv.cpp @@ -60,6 +60,7 @@ static const unsigned int RFAIL_NEED_EQUIPMENT = 72; static const unsigned int RFAIL_SPIRITS = 74; extern int serverVersion; +extern int itemIdLen; namespace EAthena { @@ -273,7 +274,8 @@ void SkillRecv::processSkillFailed(Net::MessageIn &msg) // Action failed (ex. sit because you have not reached the // right level) const int skillId = msg.readInt16("skill id"); - const int bskill = msg.readInt32("btype"); + const int bskill = msg.readItemId("btype"); + const int itemId = msg.readItemId("item id"); const signed char success = msg.readUInt8("success"); const signed char reason = msg.readUInt8("reason"); if (success != CAST_S32(SKILL_FAILED) @@ -372,8 +374,7 @@ void SkillRecv::processSkillFailed(Net::MessageIn &msg) break; case RFAIL_NEED_EQUIPMENT: { - const int itemId = bskill >> 16U; - const int amount = bskill & 0xFFFFU; + const int amount = bskill; const ItemInfo &info = ItemDB::get(itemId); if (amount == 1) { @@ -392,8 +393,7 @@ void SkillRecv::processSkillFailed(Net::MessageIn &msg) } case RFAIL_NEED_ITEM: { - const int itemId = bskill >> 16U; - const int amount = bskill & 0xFFFFU; + const int amount = bskill; const ItemInfo &info = ItemDB::get(itemId); if (amount == 1) { @@ -466,12 +466,12 @@ void SkillRecv::processSkillProduceMixList(Net::MessageIn &msg) { UNIMPLEMENTEDPACKET; - const int count = (msg.readInt16("len") - 8) / 8; + const int count = (msg.readInt16("len") - 4) / 4 * itemIdLen; for (int f = 0; f < count; f ++) { - msg.readInt16("item id"); + msg.readItemId("item id"); for (int d = 0; d < 3; d ++) - msg.readInt16("material id"); + msg.readItemId("material id"); } } @@ -480,7 +480,7 @@ void SkillRecv::processSkillProduceEffect(Net::MessageIn &msg) UNIMPLEMENTEDPACKET; msg.readInt16("flag"); - msg.readInt16("item id"); + msg.readItemId("item id"); } void SkillRecv::processSkillUnitUpdate(Net::MessageIn &msg) @@ -494,9 +494,9 @@ void SkillRecv::processSkillArrowCreateList(Net::MessageIn &msg) { UNIMPLEMENTEDPACKET; - const int count = (msg.readInt16("len") - 4) / 2; + const int count = (msg.readInt16("len") - 4) / itemIdLen; for (int f = 0; f < count; f ++) - msg.readInt16("item id"); + msg.readItemId("item id"); } void SkillRecv::processSkillAutoSpells(Net::MessageIn &msg) |