summaryrefslogtreecommitdiff
path: root/src
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
parentddc0d60dc8ef13414b0425e6050e804f9d8ba51c (diff)
downloadmv-1da80a3312ae865ed5d84271fc0cf53b82d87f15.tar.gz
mv-1da80a3312ae865ed5d84271fc0cf53b82d87f15.tar.bz2
mv-1da80a3312ae865ed5d84271fc0cf53b82d87f15.tar.xz
mv-1da80a3312ae865ed5d84271fc0cf53b82d87f15.zip
Show reason for item removing.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/enums/net/deleteitemreason.h41
-rw-r--r--src/enums/resources/notifytypes.h9
-rw-r--r--src/net/eathena/inventoryrecv.cpp49
-rw-r--r--src/resources/notifications.h37
6 files changed, 134 insertions, 4 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 38e1ba83c..b722e9c8d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -535,6 +535,7 @@ SET(SRCS
net/download.h
enums/net/auctionsearchtype.h
enums/net/battlegroundtype.h
+ enums/net/deleteitemreason.h
enums/net/downloadstatus.h
enums/net/packettype.h
net/gamehandler.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 8465829ba..067ecc39b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -299,6 +299,7 @@ SRC += events/actionevent.h \
gui/windowmanager.h \
enums/net/auctionsearchtype.h \
enums/net/battlegroundtype.h \
+ enums/net/deleteitemreason.h \
enums/net/downloadstatus.h \
enums/net/packettype.h \
enums/net/partyshare.h \
diff --git a/src/enums/net/deleteitemreason.h b/src/enums/net/deleteitemreason.h
new file mode 100644
index 000000000..8916f9fcc
--- /dev/null
+++ b/src/enums/net/deleteitemreason.h
@@ -0,0 +1,41 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2015 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef ENUMS_NET_DELETEITEMREASON_H
+#define ENUMS_NET_DELETEITEMREASON_H
+#ifdef EATHENA_SUPPORT
+
+#include "enums/simpletypes/enumdefines.h"
+
+enumStart(DeleteItemReason)
+{
+ Normal = 0,
+ SkillUse = 1,
+ FailRefine = 2,
+ MaterialChange = 3,
+ ToStorage = 4,
+ ToCart = 5,
+ Sold = 6,
+ Analysis = 7
+}
+enumEnd(DeleteItemReason);
+
+#endif // EATHENA_SUPPORT
+#endif // ENUMS_NET_DELETEITEMREASON_H
diff --git a/src/enums/resources/notifytypes.h b/src/enums/resources/notifytypes.h
index d60ada2ce..998e45ae8 100644
--- a/src/enums/resources/notifytypes.h
+++ b/src/enums/resources/notifytypes.h
@@ -204,6 +204,15 @@ namespace NotifyTypes
UNIGNORE_PLAYER_UNKNOWN,
IGNORE_PLAYER_TYPE_UNKNOWN,
PET_CATCH_PROCESS,
+ DELETE_ITEM_NORMAL,
+ DELETE_ITEM_SKILL_USE,
+ DELETE_ITEM_FAIL_REFINE,
+ DELETE_ITEM_MATERIAL_CHANGE,
+ DELETE_ITEM_TO_STORAGE,
+ DELETE_ITEM_TO_CART,
+ DELETE_ITEM_SOLD,
+ DELETE_ITEM_ANALYSIS,
+ DELETE_ITEM_UNKNOWN,
TYPE_END
};
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);
diff --git a/src/resources/notifications.h b/src/resources/notifications.h
index 425605174..0be514081 100644
--- a/src/resources/notifications.h
+++ b/src/resources/notifications.h
@@ -657,7 +657,6 @@ namespace NotifyManager
// TRANSLATORS: notification message
N_("Item %s bound to you."),
NotifyFlags::STRING},
-
{"skill end all negative status",
// TRANSLATORS: notification message
N_("End all negative status."),
@@ -742,6 +741,42 @@ namespace NotifyManager
// TRANSLATORS: notification message
N_("Pet catch started."),
NotifyFlags::EMPTY},
+ {"delete item normal",
+ // TRANSLATORS: notification message
+ N_("Deleted item %s."),
+ NotifyFlags::STRING},
+ {"delete item skill use",
+ // TRANSLATORS: notification message
+ N_("Deleted item %s by skill usage."),
+ NotifyFlags::STRING},
+ {"delete item fail refine",
+ // TRANSLATORS: notification message
+ N_("Deleted item %s because refine failed."),
+ NotifyFlags::STRING},
+ {"delete item material change",
+ // TRANSLATORS: notification message
+ N_("Deleted item %s because changing material."),
+ NotifyFlags::STRING},
+ {"delete item to storage",
+ // TRANSLATORS: notification message
+ N_("Item %s moved to storage."),
+ NotifyFlags::STRING},
+ {"delete item to cart",
+ // TRANSLATORS: notification message
+ N_("Item %s moved to cart."),
+ NotifyFlags::STRING},
+ {"delete item sold",
+ // TRANSLATORS: notification message
+ N_("Item %s sold."),
+ NotifyFlags::STRING},
+ {"delete item analysis",
+ // TRANSLATORS: notification message
+ N_("Item %s deleted because analysis."),
+ NotifyFlags::STRING},
+ {"delete item unknown",
+ // TRANSLATORS: notification message
+ N_("Item %s deleted."),
+ NotifyFlags::STRING},
};
} // namespace NotifyManager
#endif // RESOURCES_NOTIFICATIONS_H