summaryrefslogtreecommitdiff
path: root/src/net/eathena
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-09-23 01:42:52 +0300
committerAndrei Karas <akaras@inbox.ru>2015-09-23 15:04:20 +0300
commita6cd6b2374c55ff4342137d197a43d4656427365 (patch)
tree7141b86ca1f9acd4d10985ad588120d2d53984ad /src/net/eathena
parent370771ff7a602498eac131f110b582ca4efbafef (diff)
downloadmanaplus-a6cd6b2374c55ff4342137d197a43d4656427365.tar.gz
manaplus-a6cd6b2374c55ff4342137d197a43d4656427365.tar.bz2
manaplus-a6cd6b2374c55ff4342137d197a43d4656427365.tar.xz
manaplus-a6cd6b2374c55ff4342137d197a43d4656427365.zip
Add support for packet version 20150226 (hercules)
Diffstat (limited to 'src/net/eathena')
-rw-r--r--src/net/eathena/inventoryrecv.cpp82
-rw-r--r--src/net/eathena/network.cpp3
-rw-r--r--src/net/eathena/packetsin.inc14
-rw-r--r--src/net/eathena/traderecv.cpp12
-rw-r--r--src/net/eathena/updateprotocol.cpp3
-rw-r--r--src/net/eathena/vendingrecv.cpp21
6 files changed, 133 insertions, 2 deletions
diff --git a/src/net/eathena/inventoryrecv.cpp b/src/net/eathena/inventoryrecv.cpp
index 15fe86a2a..33f98289a 100644
--- a/src/net/eathena/inventoryrecv.cpp
+++ b/src/net/eathena/inventoryrecv.cpp
@@ -57,6 +57,9 @@
#include "debug.h"
+extern int packetVersion;
+extern int serverVersion;
+
namespace EAthena
{
@@ -78,7 +81,13 @@ void InventoryRecv::processPlayerEquipment(Net::MessageIn &msg)
Ea::InventoryRecv::mEquips.clear();
equipment->setBackend(&Ea::InventoryRecv::mEquips);
}
- const int number = (msg.getLength() - 4) / 31;
+ int sz;
+ if (serverVersion >= 8 && packetVersion >= 20150226)
+ sz = 57;
+ else
+ sz = 31;
+
+ const int number = (msg.getLength() - 4) / sz;
for (int loop = 0; loop < number; loop++)
{
@@ -94,6 +103,16 @@ void InventoryRecv::processPlayerEquipment(Net::MessageIn &msg)
msg.readInt32("hire expire date (?)");
msg.readInt16("equip type");
msg.readInt16("item sprite number");
+ if (serverVersion >= 8 && packetVersion >= 20150226)
+ {
+ msg.readUInt8("rnd count");
+ for (int f = 0; f < 5; f ++)
+ {
+ msg.readInt16("rnd index");
+ msg.readInt16("rnd value");
+ msg.readUInt8("rnd param");
+ }
+ }
ItemFlags flags;
flags.byte = msg.readUInt8("flags");
if (inventory)
@@ -147,6 +166,15 @@ void InventoryRecv::processPlayerInventoryAdd(Net::MessageIn &msg)
const unsigned char err = msg.readUInt8("result");
msg.readInt32("hire expire date");
msg.readInt16("bind on equip");
+ if (serverVersion >= 8 && packetVersion >= 20150226)
+ {
+ for (int f = 0; f < 5; f ++)
+ {
+ msg.readInt16("rnd index");
+ msg.readInt16("rnd value");
+ msg.readUInt8("rnd param");
+ }
+ }
const ItemColor color = ItemColorManager::getColorFromCards(&cards[0]);
const ItemInfo &itemInfo = ItemDB::get(itemId);
@@ -442,6 +470,11 @@ void InventoryRecv::processPlayerStorageEquip(Net::MessageIn &msg)
{
BLOCK_START("InventoryRecv::processPlayerStorageEquip")
msg.readInt16("len");
+ int sz;
+ if (serverVersion >= 8 && packetVersion >= 20150226)
+ sz = 57;
+ else
+ sz = 31;
const int number = (msg.getLength() - 4 - 24) / 31;
msg.readString(24, "storage name");
@@ -460,6 +493,17 @@ void InventoryRecv::processPlayerStorageEquip(Net::MessageIn &msg)
msg.readInt32("hire expire date");
msg.readInt16("bind on equip");
msg.readInt16("sprite");
+ if (serverVersion >= 8 && packetVersion >= 20150226)
+ {
+ msg.readUInt8("rnd count");
+ for (int f = 0; f < 5; f ++)
+ {
+ msg.readInt16("rnd index");
+ msg.readInt16("rnd value");
+ msg.readUInt8("rnd param");
+ }
+ }
+
ItemFlags flags;
flags.byte = msg.readUInt8("flags");
@@ -493,6 +537,15 @@ void InventoryRecv::processPlayerStorageAdd(Net::MessageIn &msg)
int cards[4];
for (int f = 0; f < 4; f++)
cards[f] = msg.readInt16("card");
+ if (serverVersion >= 8 && packetVersion >= 20150226)
+ {
+ for (int f = 0; f < 5; f ++)
+ {
+ msg.readInt16("rnd index");
+ msg.readInt16("rnd value");
+ msg.readUInt8("rnd param");
+ }
+ }
const ItemColor color = ItemColorManager::getColorFromCards(&cards[0]);
if (Item *const item = Ea::InventoryRecv::mStorage->getItem(index))
@@ -685,6 +738,15 @@ void InventoryRecv::processPlayerCartAdd(Net::MessageIn &msg)
int cards[4];
for (int f = 0; f < 4; f++)
cards[f] = msg.readInt16("card");
+ if (serverVersion >= 8 && packetVersion >= 20150226)
+ {
+ for (int f = 0; f < 5; f ++)
+ {
+ msg.readInt16("rnd index");
+ msg.readInt16("rnd value");
+ msg.readUInt8("rnd param");
+ }
+ }
if (inventory)
{
@@ -713,7 +775,13 @@ void InventoryRecv::processPlayerCartEquip(Net::MessageIn &msg)
{
BLOCK_START("InventoryRecv::processPlayerCartEquip")
msg.readInt16("len");
- const int number = (msg.getLength() - 4) / 31;
+ int sz;
+ if (serverVersion >= 8 && packetVersion >= 20150226)
+ sz = 57;
+ else
+ sz = 31;
+
+ const int number = (msg.getLength() - 4) / sz;
for (int loop = 0; loop < number; loop++)
{
const int index = msg.readInt16("index") - INVENTORY_OFFSET;
@@ -729,6 +797,16 @@ void InventoryRecv::processPlayerCartEquip(Net::MessageIn &msg)
msg.readInt32("hire expire date");
msg.readInt16("bind on equip");
msg.readInt16("sprite");
+ if (serverVersion >= 8 && packetVersion >= 20150226)
+ {
+ msg.readUInt8("rnd count");
+ for (int f = 0; f < 5; f ++)
+ {
+ msg.readInt16("rnd index");
+ msg.readInt16("rnd value");
+ msg.readUInt8("rnd param");
+ }
+ }
ItemFlags flags;
flags.byte = msg.readUInt8("flags");
diff --git a/src/net/eathena/network.cpp b/src/net/eathena/network.cpp
index 1271f029c..3f339a6dc 100644
--- a/src/net/eathena/network.cpp
+++ b/src/net/eathena/network.cpp
@@ -81,6 +81,9 @@
#include "debug.h"
+extern int packetVersion;
+extern int serverVersion;
+
namespace EAthena
{
diff --git a/src/net/eathena/packetsin.inc b/src/net/eathena/packetsin.inc
index ea44d5a3f..4f027d3e6 100644
--- a/src/net/eathena/packetsin.inc
+++ b/src/net/eathena/packetsin.inc
@@ -428,3 +428,17 @@ packet(SMSG_WEDDING_EFFECT, 0x01ea, 6, &BeingRecv::processWddin
packet(SMSG_WHISPER, 0x0097, -1, &ChatRecv::processWhisper);
packet(SMSG_WHISPER_RESPONSE, 0x09df, 7, &ChatRecv::processWhisperResponse);
packet(SMSG_WHO_ANSWER, 0x00c2, 6, &Ea::GameRecv::processWhoAnswer);
+
+if (serverVersion >= 8 && packetVersion >= 20150226)
+{
+ packet(SMSG_VENDING_OPEN, 0x0136, -1, &VendingRecv::processOpen);
+ packet(SMSG_VENDING_ITEMS_LIST, 0x0800, -1, &VendingRecv::processItemsList);
+
+ packet(SMSG_TRADE_ITEM_ADD, 0x0a09, 45, &TradeRecv::processTradeItemAdd);
+ packet(SMSG_PLAYER_STORAGE_ADD, 0x0a0a, 47, &InventoryRecv::processPlayerStorageAdd);
+ packet(SMSG_PLAYER_CART_ADD, 0x0a0b, 47, &InventoryRecv::processPlayerCartAdd);
+ packet(SMSG_PLAYER_INVENTORY_ADD, 0x0a0c, 56, &InventoryRecv::processPlayerInventoryAdd);
+ packet(SMSG_PLAYER_EQUIPMENT, 0x0a0d, -1, &InventoryRecv::processPlayerEquipment);
+ packet(SMSG_PLAYER_CART_EQUIP, 0x0a0f, -1, &InventoryRecv::processPlayerCartEquip);
+ packet(SMSG_PLAYER_STORAGE_EQUIP, 0x0a10, -1, &InventoryRecv::processPlayerStorageEquip);
+}
diff --git a/src/net/eathena/traderecv.cpp b/src/net/eathena/traderecv.cpp
index 0c922f93b..bae158aa7 100644
--- a/src/net/eathena/traderecv.cpp
+++ b/src/net/eathena/traderecv.cpp
@@ -39,6 +39,9 @@
#include "debug.h"
+extern int packetVersion;
+extern int serverVersion;
+
namespace EAthena
{
@@ -75,6 +78,15 @@ void TradeRecv::processTradeItemAdd(Net::MessageIn &msg)
int cards[4];
for (int f = 0; f < 4; f++)
cards[f] = msg.readInt16("card");
+ if (serverVersion >= 8 && packetVersion >= 20150226)
+ {
+ for (int f = 0; f < 5; f ++)
+ {
+ msg.readInt16("rnd index");
+ msg.readInt16("rnd value");
+ msg.readUInt8("rnd param");
+ }
+ }
if (tradeWindow)
{
diff --git a/src/net/eathena/updateprotocol.cpp b/src/net/eathena/updateprotocol.cpp
index c9d2c07d7..1d704adfe 100644
--- a/src/net/eathena/updateprotocol.cpp
+++ b/src/net/eathena/updateprotocol.cpp
@@ -27,6 +27,9 @@
#include "debug.h"
+extern int packetVersion;
+extern int serverVersion;
+
namespace EAthena
{
diff --git a/src/net/eathena/vendingrecv.cpp b/src/net/eathena/vendingrecv.cpp
index 567cc8177..ad4635078 100644
--- a/src/net/eathena/vendingrecv.cpp
+++ b/src/net/eathena/vendingrecv.cpp
@@ -38,6 +38,9 @@
#include "debug.h"
+extern int packetVersion;
+extern int serverVersion;
+
namespace EAthena
{
@@ -96,6 +99,15 @@ void VendingRecv::processItemsList(Net::MessageIn &msg)
msg.readUInt8("refine");
for (int d = 0; d < 4; d ++)
cards[d] = msg.readInt16("card");
+ if (serverVersion >= 8 && packetVersion >= 20150226)
+ {
+ for (int f = 0; f < 5; f ++)
+ {
+ msg.readInt16("rnd index");
+ msg.readInt16("rnd value");
+ msg.readUInt8("rnd param");
+ }
+ }
const ItemColor color = ItemColorManager::getColorFromCards(&cards[0]);
ShopItem *const item = mBuyDialog->addItem(itemId, type,
@@ -130,6 +142,15 @@ void VendingRecv::processOpen(Net::MessageIn &msg)
msg.readUInt8("refine");
for (int d = 0; d < 4; d ++)
msg.readInt16("card");
+ if (serverVersion >= 8 && packetVersion >= 20150226)
+ {
+ for (int f = 0; f < 5; f ++)
+ {
+ msg.readInt16("rnd index");
+ msg.readInt16("rnd value");
+ msg.readUInt8("rnd param");
+ }
+ }
}
PlayerInfo::enableVending(true);
VendingModeListener::distributeEvent(true);