summaryrefslogtreecommitdiff
path: root/src/net/eathena/cashshophandler.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/cashshophandler.cpp
parent45527f8597dfac68e914a798184282faeb1493f2 (diff)
downloadplus-de90520de303659fe639794544c2e19d462b3907.tar.gz
plus-de90520de303659fe639794544c2e19d462b3907.tar.bz2
plus-de90520de303659fe639794544c2e19d462b3907.tar.xz
plus-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/cashshophandler.cpp')
-rw-r--r--src/net/eathena/cashshophandler.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/net/eathena/cashshophandler.cpp b/src/net/eathena/cashshophandler.cpp
index f6292c818..3585c4903 100644
--- a/src/net/eathena/cashshophandler.cpp
+++ b/src/net/eathena/cashshophandler.cpp
@@ -31,6 +31,7 @@
#include "debug.h"
extern int packetVersion;
+extern int itemIdLen;
namespace EAthena
{
@@ -55,11 +56,11 @@ void CashShopHandler::buyItem(const int points,
if (packetVersion < 20101124)
return;
createOutPacket(CMSG_NPC_CASH_SHOP_BUY);
- outMsg.writeInt16(10 + 4, "len");
+ outMsg.writeInt16(10 + (2 + itemIdLen), "len");
outMsg.writeInt32(points, "points");
outMsg.writeInt16(1, "count");
outMsg.writeInt16(CAST_S16(amount), "amount");
- outMsg.writeInt16(CAST_S16(itemId), "item id");
+ outMsg.writeItemId(itemId, "item id");
}
void CashShopHandler::buyItems(const int points,
@@ -69,7 +70,7 @@ void CashShopHandler::buyItems(const int points,
return;
int cnt = 0;
- const int pairSize = 4;
+ const int pairSize = 2 + itemIdLen;
FOR_EACH (STD_VECTOR<ShopItem*>::const_iterator, it, items)
{
@@ -116,14 +117,14 @@ void CashShopHandler::buyItems(const int points,
for (int f = 0; f < usedQuantity; f ++)
{
outMsg.writeInt16(CAST_S16(1), "amount");
- outMsg.writeInt16(CAST_S16(item->getId()),
+ outMsg.writeItemId(item->getId(),
"item id");
}
}
else
{
outMsg.writeInt16(CAST_S16(usedQuantity), "amount");
- outMsg.writeInt16(CAST_S16(item->getId()), "item id");
+ outMsg.writeItemId(item->getId(), "item id");
}
}
}