summaryrefslogtreecommitdiff
path: root/src/net/eathena/inventoryhandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-08-21 16:39:23 +0300
committerAndrei Karas <akaras@inbox.ru>2015-08-21 16:39:23 +0300
commit3652f41912042501d55e7663315608e0cb8b3bf8 (patch)
treebf6bf57ac70f107e64a0b0bc029c6ab5c7150ca7 /src/net/eathena/inventoryhandler.cpp
parent2ff57a846a44a84729c5f0a737bb53b8b6926a8e (diff)
downloadmanaverse-3652f41912042501d55e7663315608e0cb8b3bf8.tar.gz
manaverse-3652f41912042501d55e7663315608e0cb8b3bf8.tar.bz2
manaverse-3652f41912042501d55e7663315608e0cb8b3bf8.tar.xz
manaverse-3652f41912042501d55e7663315608e0cb8b3bf8.zip
Impliment packet SMSG_PLAYER_REFINE.
Diffstat (limited to 'src/net/eathena/inventoryhandler.cpp')
-rw-r--r--src/net/eathena/inventoryhandler.cpp42
1 files changed, 37 insertions, 5 deletions
diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp
index d8a5a2a65..423679711 100644
--- a/src/net/eathena/inventoryhandler.cpp
+++ b/src/net/eathena/inventoryhandler.cpp
@@ -909,6 +909,7 @@ void InventoryHandler::processPlayerItemRentalTime(Net::MessageIn &msg)
const ItemInfo &info = ItemDB::get(id);
const std::string timeStr = timeDiffToString(seconds);
NotifyManager::notify(NotifyTypes::RENTAL_TIME_LEFT,
+ // TRANSLATORS: notification message
strprintf(_("Left %s rental time for item %s."),
timeStr.c_str(), info.getName().c_str()));
}
@@ -1155,11 +1156,42 @@ void InventoryHandler::processPlayerIdentified(Net::MessageIn &msg)
void InventoryHandler::processPlayerRefine(Net::MessageIn &msg)
{
- UNIMPLIMENTEDPACKET;
-
- msg.readInt16("flag");
- msg.readInt16("inv index");
- msg.readInt16("val");
+ const int flag = msg.readInt16("flag");
+ const int index = msg.readInt16("inv index") - INVENTORY_OFFSET;
+ msg.readInt16("refine");
+ const Inventory *const inv = PlayerInfo::getInventory();
+ const Item *item = nullptr;
+ int notifyType;
+ std::string message;
+ std::string itemName;
+ if (inv)
+ item = inv->getItem(index);
+ if (item)
+ {
+ itemName = item->getName();
+ }
+ else
+ {
+ // TRANSLATORS: unknown item
+ itemName = _("Unknown item");
+ }
+ switch (flag)
+ {
+ case 0:
+ notifyType = NotifyTypes::REFINE_SUCCESS;
+ break;
+ case 1:
+ notifyType = NotifyTypes::REFINE_FAILURE;
+ break;
+ case 2:
+ notifyType = NotifyTypes::REFINE_DOWNGRADE;
+ break;
+ default:
+ UNIMPLIMENTEDPACKET;
+ notifyType = NotifyTypes::REFINE_UNKNOWN;
+ break;
+ }
+ NotifyManager::notify(notifyType, itemName);
}
void InventoryHandler::processPlayerRepairList(Net::MessageIn &msg)