summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/net')
-rw-r--r--src/net/eathena/inventoryhandler.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp
index ff5871d93..d8a5a2a65 100644
--- a/src/net/eathena/inventoryhandler.cpp
+++ b/src/net/eathena/inventoryhandler.cpp
@@ -915,10 +915,24 @@ void InventoryHandler::processPlayerItemRentalTime(Net::MessageIn &msg)
void InventoryHandler::processPlayerItemRentalExpired(Net::MessageIn &msg)
{
- UNIMPLIMENTEDPACKET;
- // ++ need remove item from inventory
- msg.readInt16("index");
- msg.readInt16("item id");
+ Inventory *const inventory = localPlayer
+ ? PlayerInfo::getInventory() : nullptr;
+
+ const int index = msg.readInt16("index") - INVENTORY_OFFSET;
+ const int id = msg.readInt16("item id");
+ const ItemInfo &info = ItemDB::get(id);
+
+ NotifyManager::notify(NotifyTypes::RENTAL_TIME_EXPIRED,
+ info.getName());
+ if (inventory)
+ {
+ if (Item *const item = inventory->getItem(index))
+ {
+ item->increaseQuantity(-item->getQuantity());
+ inventory->removeItemAt(index);
+ ArrowsListener::distributeEvent();
+ }
+ }
}
int InventoryHandler::convertFromServerSlot(const int serverSlot) const