summaryrefslogtreecommitdiff
path: root/src/net/eathena
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/eathena')
-rw-r--r--src/net/eathena/inventoryrecv.cpp21
-rw-r--r--src/net/eathena/inventoryrecv.h1
-rw-r--r--src/net/eathena/packetsin.inc2
3 files changed, 23 insertions, 1 deletions
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
diff --git a/src/net/eathena/inventoryrecv.h b/src/net/eathena/inventoryrecv.h
index b9dff5359..bb3dc3deb 100644
--- a/src/net/eathena/inventoryrecv.h
+++ b/src/net/eathena/inventoryrecv.h
@@ -69,6 +69,7 @@ namespace EAthena
void processFavoriteItem(Net::MessageIn &msg);
void processCartAddError(Net::MessageIn &msg);
void processBindItem(Net::MessageIn &msg);
+ void processPlayerInventoryRemove(Net::MessageIn &msg);
} // namespace InventoryRecv
} // namespace EAthena
diff --git a/src/net/eathena/packetsin.inc b/src/net/eathena/packetsin.inc
index eeb955fef..7d463d043 100644
--- a/src/net/eathena/packetsin.inc
+++ b/src/net/eathena/packetsin.inc
@@ -310,7 +310,7 @@ packet(SMSG_PLAYER_IDENTIFY_LIST, 0x0177, -1, &InventoryRecv::processP
packet(SMSG_PLAYER_INSERT_CARD, 0x017d, 7, &InventoryRecv::processPlayerInsertCard);
packet(SMSG_PLAYER_INVENTORY, 0x0991, -1, &InventoryRecv::processPlayerInventory);
packet(SMSG_PLAYER_INVENTORY_ADD, 0x0990, 31, &InventoryRecv::processPlayerInventoryAdd);
-packet(SMSG_PLAYER_INVENTORY_REMOVE, 0x00af, 6, &Ea::InventoryRecv::processPlayerInventoryRemove);
+packet(SMSG_PLAYER_INVENTORY_REMOVE, 0x00af, 6, &InventoryRecv::processPlayerInventoryRemove);
packet(SMSG_PLAYER_INVENTORY_REMOVE2, 0x07fa, 8, &InventoryRecv::processPlayerInventoryRemove2);
packet(SMSG_PLAYER_INVENTORY_USE, 0x01c8, 13, &Ea::InventoryRecv::processPlayerInventoryUse);
packet(SMSG_PLAYER_ITEM_RENTAL_EXPIRED, 0x0299, 6, &InventoryRecv::processPlayerItemRentalExpired);