summaryrefslogtreecommitdiff
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
parent2ff57a846a44a84729c5f0a737bb53b8b6926a8e (diff)
downloadmv-3652f41912042501d55e7663315608e0cb8b3bf8.tar.gz
mv-3652f41912042501d55e7663315608e0cb8b3bf8.tar.bz2
mv-3652f41912042501d55e7663315608e0cb8b3bf8.tar.xz
mv-3652f41912042501d55e7663315608e0cb8b3bf8.zip
Impliment packet SMSG_PLAYER_REFINE.
-rw-r--r--src/enums/resources/notifytypes.h4
-rw-r--r--src/net/eathena/inventoryhandler.cpp42
-rw-r--r--src/resources/notifications.h16
3 files changed, 57 insertions, 5 deletions
diff --git a/src/enums/resources/notifytypes.h b/src/enums/resources/notifytypes.h
index 1ac1c4aac..19703fa75 100644
--- a/src/enums/resources/notifytypes.h
+++ b/src/enums/resources/notifytypes.h
@@ -175,6 +175,10 @@ namespace NotifyTypes
MAP_TYPE_BATTLEFIELD,
RENTAL_TIME_LEFT,
RENTAL_TIME_EXPIRED,
+ REFINE_SUCCESS,
+ REFINE_FAILURE,
+ REFINE_DOWNGRADE,
+ REFINE_UNKNOWN,
TYPE_END
};
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)
diff --git a/src/resources/notifications.h b/src/resources/notifications.h
index 66b72623c..40c377b4e 100644
--- a/src/resources/notifications.h
+++ b/src/resources/notifications.h
@@ -625,6 +625,22 @@ namespace NotifyManager
// TRANSLATORS: notification message
N_("Rental time for %s expired"),
NotifyFlags::STRING},
+ {"refine success",
+ // TRANSLATORS: notification message
+ N_("Refine success for item %s."),
+ NotifyFlags::STRING},
+ {"refine failure",
+ // TRANSLATORS: notification message
+ N_("Refine failure for item %s."),
+ NotifyFlags::STRING},
+ {"refine downgrade",
+ // TRANSLATORS: notification message
+ N_("Refine failure. Item %s downgraded."),
+ NotifyFlags::STRING},
+ {"refine unknown",
+ // TRANSLATORS: notification message
+ N_("Refine unknown for item %s."),
+ NotifyFlags::STRING},
};
} // namespace NotifyManager
#endif // RESOURCES_NOTIFICATIONS_H