From 898d7acad948b253276b11aa215bb200323116c1 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 25 Aug 2016 04:26:50 +0300 Subject: Impliment packet SMSG_VENDING_REPORT. --- src/net/eathena/vendingrecv.cpp | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'src/net/eathena/vendingrecv.cpp') 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) -- cgit v1.2.3-70-g09d2