summaryrefslogtreecommitdiff
path: root/src/net/eathena/inventoryrecv.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/eathena/inventoryrecv.cpp')
-rw-r--r--src/net/eathena/inventoryrecv.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/net/eathena/inventoryrecv.cpp b/src/net/eathena/inventoryrecv.cpp
index d1351229c..17e79b4da 100644
--- a/src/net/eathena/inventoryrecv.cpp
+++ b/src/net/eathena/inventoryrecv.cpp
@@ -1449,4 +1449,29 @@ void InventoryRecv::processMergeItemResponse(Net::MessageIn &msg)
msg.readUInt8("result");
}
+void InventoryRecv::processPlayerInventoryUse(Net::MessageIn &msg)
+{
+ BLOCK_START("InventoryRecv::processPlayerInventoryUse")
+ Inventory *const inventory = localPlayer != nullptr
+ ? PlayerInfo::getInventory() : nullptr;
+
+ const int index = msg.readInt16("index") - INVENTORY_OFFSET;
+ msg.readItemId("item id");
+ msg.readInt32("id?");
+ const int amount = msg.readInt16("amount");
+ msg.readUInt8("type");
+
+ if (inventory != nullptr)
+ {
+ if (Item *const item = inventory->getItem(index))
+ {
+ if (amount != 0)
+ item->setQuantity(amount);
+ else
+ inventory->removeItemAt(index);
+ }
+ }
+ BLOCK_END("InventoryRecv::processPlayerInventoryUse")
+}
+
} // namespace EAthena