summaryrefslogtreecommitdiff
path: root/src/net/eathena/buyingstorerecv.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/buyingstorerecv.cpp
parent45527f8597dfac68e914a798184282faeb1493f2 (diff)
downloadManaVerse-de90520de303659fe639794544c2e19d462b3907.tar.gz
ManaVerse-de90520de303659fe639794544c2e19d462b3907.tar.bz2
ManaVerse-de90520de303659fe639794544c2e19d462b3907.tar.xz
ManaVerse-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/buyingstorerecv.cpp')
-rw-r--r--src/net/eathena/buyingstorerecv.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/net/eathena/buyingstorerecv.cpp b/src/net/eathena/buyingstorerecv.cpp
index 90766686a..5f35172e5 100644
--- a/src/net/eathena/buyingstorerecv.cpp
+++ b/src/net/eathena/buyingstorerecv.cpp
@@ -46,6 +46,8 @@
#include "debug.h"
+extern int itemIdLen;
+
namespace EAthena
{
@@ -77,7 +79,7 @@ void BuyingStoreRecv::processBuyingStoreCreateFailed(Net::MessageIn &msg)
void BuyingStoreRecv::processBuyingStoreOwnItems(Net::MessageIn &msg)
{
- const int count = (msg.readInt16("len") - 12) / 9;
+ const int count = (msg.readInt16("len") - 12) / (7 + itemIdLen);
msg.readBeingId("account id");
msg.readInt32("money limit");
for (int f = 0; f < count; f ++)
@@ -85,7 +87,7 @@ void BuyingStoreRecv::processBuyingStoreOwnItems(Net::MessageIn &msg)
msg.readInt32("price");
msg.readInt16("amount");
msg.readUInt8("item type");
- msg.readInt16("item id");
+ msg.readItemId("item id");
}
PlayerInfo::enableVending(true);
BuyingStoreModeListener::distributeEvent(true);
@@ -126,7 +128,7 @@ void BuyingStoreRecv::processBuyingStoreItemsList(Net::MessageIn &msg)
{
if (actorManager == nullptr)
return;
- const int count = (msg.readInt16("len") - 16) / 9;
+ const int count = (msg.readInt16("len") - 16) / (7 + itemIdLen);
const BeingId id = msg.readBeingId("account id");
const int storeId = msg.readInt32("store id");
// +++ in future need use it too
@@ -147,7 +149,7 @@ void BuyingStoreRecv::processBuyingStoreItemsList(Net::MessageIn &msg)
const int amount = msg.readInt16("amount");
const ItemTypeT itemType = static_cast<ItemTypeT>(
msg.readUInt8("item type"));
- const int itemId = msg.readInt16("item id");
+ const int itemId = msg.readItemId("item id");
if (inv == nullptr)
continue;
@@ -180,7 +182,7 @@ void BuyingStoreRecv::processBuyingStoreSellFailed(Net::MessageIn &msg)
void BuyingStoreRecv::processBuyingStoreSellerSellFailed(Net::MessageIn &msg)
{
const int16_t result = msg.readInt16("result");
- msg.readInt16("item id");
+ msg.readItemId("item id");
switch (result)
{
case 5:
@@ -205,7 +207,7 @@ void BuyingStoreRecv::processBuyingStoreSellerSellFailed(Net::MessageIn &msg)
void BuyingStoreRecv::processBuyingStoreReport(Net::MessageIn &msg)
{
UNIMPLEMENTEDPACKET;
- msg.readInt16("item id");
+ msg.readItemId("item id");
msg.readInt16("amount");
if (msg.getVersion() >= 20141016)
{