From db37480e7d36bb58b10ee1a4671ec18880e2bda2 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 24 Jan 2015 18:36:28 +0300 Subject: eathena: impliment packet SMSG_CART_INFO. --- src/net/eathena/inventoryhandler.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/net/eathena') diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp index dc134e87f..f29638829 100644 --- a/src/net/eathena/inventoryhandler.cpp +++ b/src/net/eathena/inventoryhandler.cpp @@ -753,9 +753,33 @@ void InventoryHandler::processPlayerStorageRemove(Net::MessageIn &msg) void InventoryHandler::processCartInfo(Net::MessageIn &msg) { msg.readInt16("cart items used"); - msg.readInt16("max cart items"); + const int size = msg.readInt16("max cart items"); msg.readInt32("cart weight"); msg.readInt32("max cart weight"); + if (mCartItems.empty()) + return; + + Inventory *const inv = PlayerInfo::getCartInventory(); + if (!inv) + return; + + inv->resize(size); + + FOR_EACH (Ea::InventoryItems::const_iterator, it, mCartItems) + { + inv->setItem((*it).slot, + (*it).id, + (*it).type, + (*it).quantity, + (*it).refine, + (*it).color, + (*it).identified, + (*it).damaged, + (*it).favorite, + (*it).equip, + false); + } + mCartItems.clear(); } void InventoryHandler::processCartRemove(Net::MessageIn &msg A_UNUSED) -- cgit v1.2.3-70-g09d2