summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-08-21 15:37:42 +0300
committerAndrei Karas <akaras@inbox.ru>2015-08-21 16:37:24 +0300
commit76087008664d96b492fde077bb8b8e632ea30ba8 (patch)
tree07c3b951bc919ca7a98558474617d5abb12fe01f
parent1b9e74d6c00033b2103f70162c96e9bf5ce6f2b7 (diff)
downloadmanaplus-76087008664d96b492fde077bb8b8e632ea30ba8.tar.gz
manaplus-76087008664d96b492fde077bb8b8e632ea30ba8.tar.bz2
manaplus-76087008664d96b492fde077bb8b8e632ea30ba8.tar.xz
manaplus-76087008664d96b492fde077bb8b8e632ea30ba8.zip
Impliment packet SMSG_PLAYER_ITEM_RENTAL_TIME (hercules).
-rw-r--r--src/enums/resources/notifytypes.h1
-rw-r--r--src/net/eathena/inventoryhandler.cpp16
-rw-r--r--src/resources/notifications.h4
3 files changed, 16 insertions, 5 deletions
diff --git a/src/enums/resources/notifytypes.h b/src/enums/resources/notifytypes.h
index c542de3d7..5e354f9fc 100644
--- a/src/enums/resources/notifytypes.h
+++ b/src/enums/resources/notifytypes.h
@@ -173,6 +173,7 @@ namespace NotifyTypes
MAIL_GET_ATTACH_TOO_MANY_ITEMS,
NEW_MAIL,
MAP_TYPE_BATTLEFIELD,
+ RENTAL_TIME_LEFT,
TYPE_END
};
diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp
index 61d081434..ff5871d93 100644
--- a/src/net/eathena/inventoryhandler.cpp
+++ b/src/net/eathena/inventoryhandler.cpp
@@ -47,6 +47,11 @@
#include "net/ea/eaprotocol.h"
#include "net/ea/equipbackend.h"
+#include "resources/iteminfo.h"
+
+#include "utils/gettext.h"
+#include "utils/stringutils.h"
+
#include "debug.h"
extern Net::InventoryHandler *inventoryHandler;
@@ -899,10 +904,13 @@ void InventoryHandler::selectEgg(const Item *const item) const
void InventoryHandler::processPlayerItemRentalTime(Net::MessageIn &msg)
{
- UNIMPLIMENTEDPACKET;
- // +++ need update item rental time
- msg.readInt16("item id");
- msg.readInt32("seconds");
+ const int id = msg.readInt16("item id");
+ const int seconds = msg.readInt32("seconds");
+ const ItemInfo &info = ItemDB::get(id);
+ const std::string timeStr = timeDiffToString(seconds);
+ NotifyManager::notify(NotifyTypes::RENTAL_TIME_LEFT,
+ strprintf(_("Left %s rental time for item %s."),
+ timeStr.c_str(), info.getName().c_str()));
}
void InventoryHandler::processPlayerItemRentalExpired(Net::MessageIn &msg)
diff --git a/src/resources/notifications.h b/src/resources/notifications.h
index c90e6edff..4dd8a585f 100644
--- a/src/resources/notifications.h
+++ b/src/resources/notifications.h
@@ -612,13 +612,15 @@ namespace NotifyManager
N_("Can't get attach. Too many items."),
NotifyFlags::EMPTY},
{"new mail",
- // TRANSLATORS: notification message
"%s",
NotifyFlags::STRING},
{"mail type battle field",
// TRANSLATORS: notification message
N_("You enter battle field."),
NotifyFlags::EMPTY},
+ {"rental time left",
+ "%s",
+ NotifyFlags::STRING},
};
} // namespace NotifyManager
#endif // RESOURCES_NOTIFICATIONS_H