summaryrefslogtreecommitdiff
path: root/src/net/eathena/inventoryrecv.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-09-09 17:18:49 +0300
committerAndrei Karas <akaras@inbox.ru>2015-09-09 17:18:49 +0300
commit1da80a3312ae865ed5d84271fc0cf53b82d87f15 (patch)
treefca0e8225d75d9999d9c05a04f43cf169bbba0b0 /src/net/eathena/inventoryrecv.cpp
parentddc0d60dc8ef13414b0425e6050e804f9d8ba51c (diff)
downloadplus-1da80a3312ae865ed5d84271fc0cf53b82d87f15.tar.gz
plus-1da80a3312ae865ed5d84271fc0cf53b82d87f15.tar.bz2
plus-1da80a3312ae865ed5d84271fc0cf53b82d87f15.tar.xz
plus-1da80a3312ae865ed5d84271fc0cf53b82d87f15.zip
Show reason for item removing.
Diffstat (limited to 'src/net/eathena/inventoryrecv.cpp')
-rw-r--r--src/net/eathena/inventoryrecv.cpp49
1 files changed, 46 insertions, 3 deletions
diff --git a/src/net/eathena/inventoryrecv.cpp b/src/net/eathena/inventoryrecv.cpp
index 602c6680f..6d44f3847 100644
--- a/src/net/eathena/inventoryrecv.cpp
+++ b/src/net/eathena/inventoryrecv.cpp
@@ -29,6 +29,8 @@
#include "enums/resources/notifytypes.h"
+#include "enums/net/deleteitemreason.h"
+
#include "gui/popups/itempopup.h"
#include "gui/widgets/createwidget.h"
@@ -377,15 +379,56 @@ void InventoryRecv::processPlayerInventoryRemove2(Net::MessageIn &msg)
Inventory *const inventory = localPlayer
? PlayerInfo::getInventory() : nullptr;
- // +++ here possible use particle or text/sound effects
- // for different reasons
- msg.readInt16("reason");
+ const DeleteItemReasonT reason = fromInt(msg.readInt16("reason"),
+ DeleteItemReasonT);
const int index = msg.readInt16("index") - INVENTORY_OFFSET;
const int amount = msg.readInt16("amount");
+
if (inventory)
{
if (Item *const item = inventory->getItem(index))
{
+ switch (reason)
+ {
+ case DeleteItemReason::Normal:
+ NotifyManager::notify(NotifyTypes::DELETE_ITEM_NORMAL,
+ item->getName());
+ break;
+ case DeleteItemReason::SkillUse:
+ NotifyManager::notify(NotifyTypes::DELETE_ITEM_SKILL_USE,
+ item->getName());
+ break;
+ case DeleteItemReason::FailRefine:
+ NotifyManager::notify(NotifyTypes::DELETE_ITEM_FAIL_REFINE,
+ item->getName());
+ break;
+ case DeleteItemReason::MaterialChange:
+ NotifyManager::notify(
+ NotifyTypes::DELETE_ITEM_MATERIAL_CHANGE,
+ item->getName());
+ break;
+ case DeleteItemReason::ToStorage:
+ NotifyManager::notify(NotifyTypes::DELETE_ITEM_TO_STORAGE,
+ item->getName());
+ break;
+ case DeleteItemReason::ToCart:
+ NotifyManager::notify(NotifyTypes::DELETE_ITEM_TO_CART,
+ item->getName());
+ break;
+ case DeleteItemReason::Sold:
+ NotifyManager::notify(NotifyTypes::DELETE_ITEM_SOLD,
+ item->getName());
+ break;
+ case DeleteItemReason::Analysis:
+ NotifyManager::notify(NotifyTypes::DELETE_ITEM_ANALYSIS,
+ item->getName());
+ break;
+ default:
+ NotifyManager::notify(NotifyTypes::DELETE_ITEM_UNKNOWN,
+ item->getName());
+ break;
+ }
+
item->increaseQuantity(-amount);
if (item->getQuantity() == 0)
inventory->removeItemAt(index);