summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2019-03-03 04:48:04 +0300
committerAndrei Karas <akaras@inbox.ru>2019-03-03 04:48:04 +0300
commit56f4420c4f5689cb84a119193fda57dab51c8428 (patch)
tree17318f4e8a497793e483c4c52b31be9156a66dc9 /src
parentc2f54527e2a7047b5ef89f1b765efb51744d235e (diff)
downloadmv-56f4420c4f5689cb84a119193fda57dab51c8428.tar.gz
mv-56f4420c4f5689cb84a119193fda57dab51c8428.tar.bz2
mv-56f4420c4f5689cb84a119193fda57dab51c8428.tar.xz
mv-56f4420c4f5689cb84a119193fda57dab51c8428.zip
Impliment packet SMSG_INVENTORY_END 0x0b0b
Diffstat (limited to 'src')
-rw-r--r--src/net/eathena/inventoryrecv.cpp80
-rw-r--r--src/net/eathena/inventoryrecv.h1
2 files changed, 74 insertions, 7 deletions
diff --git a/src/net/eathena/inventoryrecv.cpp b/src/net/eathena/inventoryrecv.cpp
index 8e713ae9b..bb2a129b3 100644
--- a/src/net/eathena/inventoryrecv.cpp
+++ b/src/net/eathena/inventoryrecv.cpp
@@ -455,7 +455,7 @@ void InventoryRecv::processPlayerInventory(Net::MessageIn &msg)
void InventoryRecv::processPlayerStorage(Net::MessageIn &msg)
{
BLOCK_START("InventoryRecv::processPlayerInventory")
- Ea::InventoryRecv::mStorageItems.clear();
+// Ea::InventoryRecv::mStorageItems.clear();
msg.readInt16("len");
@@ -1127,7 +1127,7 @@ void InventoryRecv::processPlayerCartEquip(Net::MessageIn &msg)
void InventoryRecv::processPlayerCartItems(Net::MessageIn &msg)
{
BLOCK_START("InventoryRecv::processPlayerCartItems")
- Ea::InventoryRecv::mStorageItems.clear();
+// Ea::InventoryRecv::mStorageItems.clear();
msg.readInt16("len");
@@ -1581,15 +1581,81 @@ void InventoryRecv::processInventoryStartContinue(const NetInventoryTypeT type,
void InventoryRecv::processInventoryEnd1(Net::MessageIn &msg)
{
- UNIMPLEMENTEDPACKET;
- msg.readUInt8("flag");
+ const uint8_t flag = msg.readUInt8("flag");
+ if (flag != 0)
+ {
+ UNIMPLEMENTEDPACKET;
+ return;
+ }
+ processInventoryEndContinue(NetInventoryType::Storage);
}
void InventoryRecv::processInventoryEnd2(Net::MessageIn &msg)
{
- UNIMPLEMENTEDPACKET;
- msg.readUInt8("type");
- msg.readUInt8("flag");
+ const NetInventoryTypeT invType = static_cast<NetInventoryTypeT>(
+ msg.readUInt8("type"));
+ const uint8_t flag = msg.readUInt8("flag");
+ if (flag != 0)
+ {
+ UNIMPLEMENTEDPACKET;
+ return;
+ }
+ processInventoryEndContinue(invType);
+}
+
+void InventoryRecv::processInventoryEndContinue(const NetInventoryTypeT invType)
+{
+ switch (invType)
+ {
+ case NetInventoryType::Inventory:
+ break;
+ case NetInventoryType::Cart:
+ // insert data in handler processCartInfo
+ return;
+ case NetInventoryType::Storage:
+ case NetInventoryType::GuildStorage:
+ // insert data in processPlayerStorageStatus
+ return;
+ default:
+ return;
+ }
+ Inventory *inventory = PlayerInfo::getInventory();
+ if (PlayerInfo::getEquipment() != nullptr)
+ {
+ Ea::InventoryRecv::mEquips.clear();
+ PlayerInfo::getEquipment()->setBackend(
+ &Ea::InventoryRecv::mEquips);
+ }
+ if (inventory == nullptr)
+ return;
+
+ inventory->clear();
+ FOR_EACH (Ea::InventoryItems::const_iterator, it, mInventoryItems)
+ {
+ const int index = (*it).slot;
+ const int equipIndex = (*it).equipIndex;
+ inventory->setItem(index,
+ (*it).id,
+ (*it).type,
+ (*it).quantity,
+ (*it).refine,
+ (*it).color,
+ (*it).identified,
+ (*it).damaged,
+ (*it).favorite,
+ (*it).equip,
+ Equipped_false);
+ inventory->setCards(index, (*it).cards, maxCards);
+ if ((*it).options)
+ inventory->setOptions(index, (*it).options);
+ if (equipIndex > 0)
+ {
+ Ea::InventoryRecv::mEquips.setEquipment(
+ InventoryRecv::getSlot(equipIndex),
+ index);
+ }
+ }
+ mInventoryItems.clear();
}
void InventoryRecv::processPlayerCombinedInventory1(Net::MessageIn &msg)
diff --git a/src/net/eathena/inventoryrecv.h b/src/net/eathena/inventoryrecv.h
index 9d1bbb819..a7af54a75 100644
--- a/src/net/eathena/inventoryrecv.h
+++ b/src/net/eathena/inventoryrecv.h
@@ -108,6 +108,7 @@ namespace EAthena
void processInventoryStartContinue(const NetInventoryTypeT type,
const std::string &name);
+ void processInventoryEndContinue(const NetInventoryTypeT invType);
} // namespace InventoryRecv
} // namespace EAthena