summaryrefslogtreecommitdiff
path: root/src/net/eathena/beingrecv.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-07-26 03:02:37 +0300
committerAndrei Karas <akaras@inbox.ru>2018-07-26 22:01:35 +0300
commitde90520de303659fe639794544c2e19d462b3907 (patch)
tree36b306a26e2c9dd422aede36f2f9ca3158ffbae2 /src/net/eathena/beingrecv.cpp
parent45527f8597dfac68e914a798184282faeb1493f2 (diff)
downloadmv-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/beingrecv.cpp')
-rw-r--r--src/net/eathena/beingrecv.cpp36
1 files changed, 26 insertions, 10 deletions
diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp
index 440fb5971..20342f853 100644
--- a/src/net/eathena/beingrecv.cpp
+++ b/src/net/eathena/beingrecv.cpp
@@ -74,6 +74,7 @@ extern Window *deathNotice;
extern bool packets_re;
extern bool packets_main;
extern bool packets_zero;
+extern int itemIdLen;
namespace EAthena
{
@@ -202,12 +203,12 @@ void BeingRecv::processBeingChangeLook2(Net::MessageIn &msg)
msg.readBeingId("being id"));
const uint8_t type = msg.readUInt8("type");
- const int id = msg.readInt16("id1");
- unsigned int id2 = msg.readInt16("id2");
+ const int id = msg.readItemId("id1");
+ unsigned int id2 = msg.readItemId("id2");
if (type != 2)
id2 = 1;
- if ((localPlayer == nullptr) || (dstBeing == nullptr))
+ if (localPlayer == nullptr || dstBeing == nullptr)
return;
processBeingChangeLookContinue(msg, dstBeing, type, id, id2, nullptr);
@@ -248,7 +249,7 @@ void BeingRecv::processBeingChangeLookCards(Net::MessageIn &msg)
id2 = 1;
for (int f = 0; f < maxCards; f ++)
- cards[f] = msg.readUInt16("card");
+ cards[f] = msg.readUInt16("card"); // +++ probably need use int32
if (dstBeing == nullptr)
return;
@@ -500,9 +501,14 @@ void BeingRecv::processBeingVisible(Net::MessageIn &msg)
const int hairStyle = msg.readInt16("hair style");
uint32_t weapon;
if (msg.getVersion() >= 7)
- weapon = CAST_U32(msg.readInt32("weapon"));
+ {
+ weapon = msg.readItemId("weapon");
+ msg.readItemId("shield");
+ }
else
+ {
weapon = CAST_U32(msg.readInt16("weapon"));
+ }
const uint16_t headBottom = msg.readInt16("head bottom");
if (msg.getVersion() < 7)
msg.readInt16("shield");
@@ -689,9 +695,14 @@ void BeingRecv::processBeingMove(Net::MessageIn &msg)
const int hairStyle = msg.readInt16("hair style");
uint32_t weapon;
if (msg.getVersion() >= 7)
- weapon = CAST_U32(msg.readInt32("weapon"));
+ {
+ weapon = msg.readItemId("weapon");
+ msg.readItemId("shield");
+ }
else
+ {
weapon = CAST_U32(msg.readInt16("weapon"));
+ }
const uint16_t headBottom = msg.readInt16("head bottom");
msg.readInt32("tick");
if (msg.getVersion() < 7)
@@ -883,9 +894,14 @@ void BeingRecv::processBeingSpawn(Net::MessageIn &msg)
const int hairStyle = msg.readInt16("hair style");
uint32_t weapon;
if (msg.getVersion() >= 7)
- weapon = CAST_U32(msg.readInt32("weapon"));
+ {
+ weapon = msg.readItemId("weapon");
+ msg.readItemId("shield");
+ }
else
+ {
weapon = CAST_U32(msg.readInt16("weapon"));
+ }
const uint16_t headBottom = msg.readInt16("head bottom");
if (msg.getVersion() < 7)
msg.readInt16("shield");
@@ -1963,7 +1979,7 @@ void BeingRecv::processBeingViewEquipment(Net::MessageIn &msg)
{
UNIMPLEMENTEDPACKET;
- const int count = (msg.readInt16("len") - 45) / 31;
+ const int count = (msg.readInt16("len") - 45) / (21 + itemIdLen * 5);
msg.readString(24, "name");
msg.readInt16("job");
msg.readInt16("head");
@@ -1978,13 +1994,13 @@ void BeingRecv::processBeingViewEquipment(Net::MessageIn &msg)
for (int f = 0; f < count; f ++)
{
msg.readInt16("index");
- msg.readInt16("item id");
+ msg.readItemId("item id");
msg.readUInt8("item type");
msg.readInt32("location");
msg.readInt32("wear state");
msg.readInt8("refine");
for (int d = 0; d < maxCards; d ++)
- msg.readUInt16("card");
+ msg.readItemId("card");
msg.readInt32("hire expire date (?)");
msg.readInt16("equip type");
msg.readInt16("item sprite number");