diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-08-21 15:48:46 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-08-21 16:37:24 +0300 |
commit | 2ff57a846a44a84729c5f0a737bb53b8b6926a8e (patch) | |
tree | 1654872f9dca08ee07eacc43461cb8ad97386bcc /src | |
parent | 76087008664d96b492fde077bb8b8e632ea30ba8 (diff) | |
download | plus-2ff57a846a44a84729c5f0a737bb53b8b6926a8e.tar.gz plus-2ff57a846a44a84729c5f0a737bb53b8b6926a8e.tar.bz2 plus-2ff57a846a44a84729c5f0a737bb53b8b6926a8e.tar.xz plus-2ff57a846a44a84729c5f0a737bb53b8b6926a8e.zip |
Impliment packet SMSG_PLAYER_ITEM_RENTAL_EXPIRED.
Diffstat (limited to 'src')
-rw-r--r-- | src/enums/resources/notifytypes.h | 1 | ||||
-rw-r--r-- | src/net/eathena/inventoryhandler.cpp | 22 | ||||
-rw-r--r-- | src/resources/notifications.h | 4 |
3 files changed, 23 insertions, 4 deletions
diff --git a/src/enums/resources/notifytypes.h b/src/enums/resources/notifytypes.h index 5e354f9fc..1ac1c4aac 100644 --- a/src/enums/resources/notifytypes.h +++ b/src/enums/resources/notifytypes.h @@ -174,6 +174,7 @@ namespace NotifyTypes NEW_MAIL, MAP_TYPE_BATTLEFIELD, RENTAL_TIME_LEFT, + RENTAL_TIME_EXPIRED, TYPE_END }; 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 diff --git a/src/resources/notifications.h b/src/resources/notifications.h index 4dd8a585f..66b72623c 100644 --- a/src/resources/notifications.h +++ b/src/resources/notifications.h @@ -621,6 +621,10 @@ namespace NotifyManager {"rental time left", "%s", NotifyFlags::STRING}, + {"rental time expired", + // TRANSLATORS: notification message + N_("Rental time for %s expired"), + NotifyFlags::STRING}, }; } // namespace NotifyManager #endif // RESOURCES_NOTIFICATIONS_H |