From 0779cc7854ac04b87aecc3d4bc64f2a9f12833c8 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 26 Sep 2018 21:39:01 +0300 Subject: Add packet SMSG_PLAYER_COMBINED_INVENTORY 0x0b09. --- src/CMakeLists.txt | 2 +- src/Makefile.am | 2 +- src/enums/net/inventorytype.h | 35 -------------------------------- src/enums/net/netinventorytype.h | 35 ++++++++++++++++++++++++++++++++ src/net/eathena/inventoryrecv.cpp | 42 +++++++++++++++++++++++++++++++++++++++ src/net/eathena/inventoryrecv.h | 7 +++++++ src/net/eathena/packetsin.inc | 3 +++ 7 files changed, 89 insertions(+), 37 deletions(-) delete mode 100644 src/enums/net/inventorytype.h create mode 100644 src/enums/net/netinventorytype.h (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2a002c192..e3be548f9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -574,7 +574,7 @@ SET(SRCS enums/net/battlegroundtype.h enums/net/deleteitemreason.h enums/net/downloadstatus.h - enums/net/inventorytype.h + enums/net/netinventorytype.h enums/net/mailmessagetype.h enums/net/mailopentype.h enums/net/npcaction.h diff --git a/src/Makefile.am b/src/Makefile.am index 7ffdd108b..1dff63e68 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -441,7 +441,7 @@ BASE_SRC += client.h \ enums/net/battlegroundtype.h \ enums/net/deleteitemreason.h \ enums/net/downloadstatus.h \ - enums/net/inventorytype.h \ + enums/net/netinventorytype.h \ enums/net/mailmessagetype.h \ enums/net/mailopentype.h \ enums/net/npcaction.h \ diff --git a/src/enums/net/inventorytype.h b/src/enums/net/inventorytype.h deleted file mode 100644 index 1e15f6efc..000000000 --- a/src/enums/net/inventorytype.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2014-2018 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef ENUMS_NET_INVENTORYTYPE_H -#define ENUMS_NET_INVENTORYTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(InventoryType) -{ - Inventory = 0, - Cart = 1, - Storage = 2, - GuildStorage = 3 -} -enumEnd(InventoryType); - -#endif // ENUMS_NET_INVENTORYTYPE_H diff --git a/src/enums/net/netinventorytype.h b/src/enums/net/netinventorytype.h new file mode 100644 index 000000000..f1c791509 --- /dev/null +++ b/src/enums/net/netinventorytype.h @@ -0,0 +1,35 @@ +/* + * The ManaPlus Client + * Copyright (C) 2014-2018 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef ENUMS_NET_NETINVENTORYTYPE_H +#define ENUMS_NET_NETINVENTORYTYPE_H + +#include "enums/simpletypes/enumdefines.h" + +enumStart(NetInventoryType) +{ + Inventory = 0, + Cart = 1, + Storage = 2, + GuildStorage = 3 +} +enumEnd(NetInventoryType); + +#endif // ENUMS_NET_NETINVENTORYTYPE_H diff --git a/src/net/eathena/inventoryrecv.cpp b/src/net/eathena/inventoryrecv.cpp index 358aa2234..2ca1f11c8 100644 --- a/src/net/eathena/inventoryrecv.cpp +++ b/src/net/eathena/inventoryrecv.cpp @@ -1547,4 +1547,46 @@ void InventoryRecv::processInventoryEnd2(Net::MessageIn &msg) msg.readUInt8("flag"); } +void InventoryRecv::processPlayerCombinedInventory1(Net::MessageIn &msg) +{ + UNIMPLEMENTEDPACKET; + const int dataLen = msg.readInt32("len") - 4; + processInventoryContinue(msg, + dataLen, + NetInventoryType::Storage); +} + +void InventoryRecv::processPlayerCombinedInventory2(Net::MessageIn &msg) +{ + UNIMPLEMENTEDPACKET; + const int dataLen = msg.readInt32("len") - 5; + const NetInventoryTypeT invType = static_cast( + msg.readUInt8("type")); + processInventoryContinue(msg, + dataLen, + invType); +} + +void InventoryRecv::processInventoryContinue(Net::MessageIn &msg, + const int len, + const NetInventoryTypeT invType + A_UNUSED) +{ + const int packetLen = 14 + itemIdLen * 5; + const int number = len / packetLen; + + for (int loop = 0; loop < number; loop++) + { + msg.readInt16("item index"); + msg.readItemId("item id"); + msg.readUInt8("item type"); + msg.readInt16("amount"); + msg.readInt32("wear state / equip"); + for (int f = 0; f < maxCards; f++) + msg.readItemId("card"); + msg.readInt32("hire expire date"); + msg.readUInt8("flags"); + } +} + } // namespace EAthena diff --git a/src/net/eathena/inventoryrecv.h b/src/net/eathena/inventoryrecv.h index 9e4c3ce03..37e52a8fe 100644 --- a/src/net/eathena/inventoryrecv.h +++ b/src/net/eathena/inventoryrecv.h @@ -25,6 +25,8 @@ #include "net/ea/inventoryitem.h" +#include "enums/net/netinventorytype.h" + namespace Net { class MessageIn; @@ -81,8 +83,13 @@ namespace EAthena void processInventoryStart3(Net::MessageIn &msg); void processInventoryEnd1(Net::MessageIn &msg); void processInventoryEnd2(Net::MessageIn &msg); + void processPlayerCombinedInventory1(Net::MessageIn &msg); + void processPlayerCombinedInventory2(Net::MessageIn &msg); int getSlot(const int eAthenaSlot) A_WARN_UNUSED; + void processInventoryContinue(Net::MessageIn &msg, + const int len, + const NetInventoryTypeT invType); } // namespace InventoryRecv } // namespace EAthena diff --git a/src/net/eathena/packetsin.inc b/src/net/eathena/packetsin.inc index aef5536f6..e8901a7b1 100644 --- a/src/net/eathena/packetsin.inc +++ b/src/net/eathena/packetsin.inc @@ -1310,6 +1310,7 @@ if (packetVersionRe >= 20180829) { packet(SMSG_INVENTORY_START1, 0x0b08, 26, &InventoryRecv::processInventoryStart1, 20180829); packet(SMSG_INVENTORY_END1, 0x0b0b, 3, &InventoryRecv::processInventoryEnd1, 20180829); + packet(SMSG_PLAYER_COMBINED_INVENTORY1, 0x0b09, -1, &InventoryRecv::processPlayerCombinedInventory1, 20180829); } // 20180912 re @@ -1317,6 +1318,7 @@ if (packetVersionRe >= 20180912) { packet(SMSG_INVENTORY_START2, 0x0b08, 27, &InventoryRecv::processInventoryStart2, 20180912); packet(SMSG_INVENTORY_END2, 0x0b0b, 4, &InventoryRecv::processInventoryEnd2, 20180912); + packet(SMSG_PLAYER_COMBINED_INVENTORY2, 0x0b09, -1, &InventoryRecv::processPlayerCombinedInventory2, 20180912); } // 20180919 re @@ -1330,6 +1332,7 @@ if (packetVersionZero >= 20180919) { packet(SMSG_INVENTORY_START3, 0x0b08, -1, &InventoryRecv::processInventoryStart3, 20180919); packet(SMSG_INVENTORY_END2, 0x0b0b, 4, &InventoryRecv::processInventoryEnd2, 20180919); + packet(SMSG_PLAYER_COMBINED_INVENTORY2, 0x0b09, -1, &InventoryRecv::processPlayerCombinedInventory2, 20180919); } // 0 -- cgit v1.2.3-60-g2f50