summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-08-25 04:26:50 +0300
committerAndrei Karas <akaras@inbox.ru>2016-08-25 04:26:50 +0300
commit898d7acad948b253276b11aa215bb200323116c1 (patch)
tree96d221be8952500473aff052517d99008b0f7420 /src
parent1ad3e55c431b61e6fe6638ee0afc5e8f4c14496c (diff)
downloadmv-898d7acad948b253276b11aa215bb200323116c1.tar.gz
mv-898d7acad948b253276b11aa215bb200323116c1.tar.bz2
mv-898d7acad948b253276b11aa215bb200323116c1.tar.xz
mv-898d7acad948b253276b11aa215bb200323116c1.zip
Impliment packet SMSG_VENDING_REPORT.
Diffstat (limited to 'src')
-rw-r--r--src/enums/resources/notifytypes.h1
-rw-r--r--src/net/eathena/vendingrecv.cpp27
-rw-r--r--src/resources/notifications.h3
3 files changed, 28 insertions, 3 deletions
diff --git a/src/enums/resources/notifytypes.h b/src/enums/resources/notifytypes.h
index 06dd6e69a..cd5d1570b 100644
--- a/src/enums/resources/notifytypes.h
+++ b/src/enums/resources/notifytypes.h
@@ -229,6 +229,7 @@ namespace NotifyTypes
SKILL_MEMO_ERROR_LEVEL,
SKILL_MEMO_ERROR_SKILL,
BUY_TRADE_FAILED,
+ VENDING_SOLD_ITEM,
TYPE_END
};
diff --git a/src/net/eathena/vendingrecv.cpp b/src/net/eathena/vendingrecv.cpp
index d3b625159..f6668265f 100644
--- a/src/net/eathena/vendingrecv.cpp
+++ b/src/net/eathena/vendingrecv.cpp
@@ -27,6 +27,8 @@
#include "being/localplayer.h"
#include "being/playerinfo.h"
+#include "const/net/inventory.h"
+
#include "enums/resources/notifytypes.h"
#include "gui/windows/buydialog.h"
@@ -38,8 +40,15 @@
#include "net/messagein.h"
+#include "resources/iteminfo.h"
+
+#include "resources/inventory/inventory.h"
+
#include "resources/item/shopitem.h"
+#include "utils/gettext.h"
+#include "utils/stringutils.h"
+
#include "debug.h"
extern int packetVersion;
@@ -209,9 +218,21 @@ void VendingRecv::processOpen(Net::MessageIn &msg)
void VendingRecv::processReport(Net::MessageIn &msg)
{
- UNIMPLIMENTEDPACKET;
- msg.readInt16("inv index");
- msg.readInt16("amount");
+ const int index = msg.readInt16("inv index") - INVENTORY_OFFSET;
+ const int amount = msg.readInt16("amount");
+ const Inventory *const inventory = PlayerInfo::getCartInventory();
+ if (!inventory)
+ return;
+ const Item *const item = inventory->getItem(index);
+ if (!item)
+ return;
+
+ const ItemInfo &info = item->getInfo();
+ // TRANSLATORS: vending sold item message
+ const std::string str = strprintf(_("Sold item %s amount %d"),
+ info.getLink().c_str(),
+ amount);
+ NotifyManager::notify(NotifyTypes::VENDING_SOLD_ITEM, str);
}
void VendingRecv::processOpenStatus(Net::MessageIn &msg)
diff --git a/src/resources/notifications.h b/src/resources/notifications.h
index 58ae9e056..45a90460e 100644
--- a/src/resources/notifications.h
+++ b/src/resources/notifications.h
@@ -832,6 +832,9 @@ namespace NotifyManager
// TRANSLATORS: notification message
N_("Unable to buy while trading."),
NotifyFlags::EMPTY},
+ {"vending sold item",
+ ("%s"),
+ NotifyFlags::STRING},
};
} // namespace NotifyManager
#endif // RESOURCES_NOTIFICATIONS_H