From 8d519af0d6a5a7c3477e684269172b8163495a85 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 9 Sep 2015 17:40:06 +0300 Subject: Move processPlayerInventoryRemove from ea namespace into eathena and tmwa. --- src/net/eathena/inventoryrecv.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/net/eathena/inventoryrecv.cpp') diff --git a/src/net/eathena/inventoryrecv.cpp b/src/net/eathena/inventoryrecv.cpp index 6d44f3847..d3496a149 100644 --- a/src/net/eathena/inventoryrecv.cpp +++ b/src/net/eathena/inventoryrecv.cpp @@ -979,4 +979,25 @@ void InventoryRecv::processBindItem(Net::MessageIn &msg) } } +void InventoryRecv::processPlayerInventoryRemove(Net::MessageIn &msg) +{ + BLOCK_START("InventoryRecv::processPlayerInventoryRemove") + Inventory *const inventory = localPlayer + ? PlayerInfo::getInventory() : nullptr; + + const int index = msg.readInt16("index") - INVENTORY_OFFSET; + const int amount = msg.readInt16("amount"); + if (inventory) + { + if (Item *const item = inventory->getItem(index)) + { + item->increaseQuantity(-amount); + if (item->getQuantity() == 0) + inventory->removeItemAt(index); + ArrowsListener::distributeEvent(); + } + } + BLOCK_END("InventoryRecv::processPlayerInventoryRemove") +} + } // namespace EAthena -- cgit v1.2.3-70-g09d2