diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-08-25 04:26:50 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-08-25 04:26:50 +0300 |
commit | 898d7acad948b253276b11aa215bb200323116c1 (patch) | |
tree | 96d221be8952500473aff052517d99008b0f7420 /src/net/eathena/vendingrecv.cpp | |
parent | 1ad3e55c431b61e6fe6638ee0afc5e8f4c14496c (diff) | |
download | plus-898d7acad948b253276b11aa215bb200323116c1.tar.gz plus-898d7acad948b253276b11aa215bb200323116c1.tar.bz2 plus-898d7acad948b253276b11aa215bb200323116c1.tar.xz plus-898d7acad948b253276b11aa215bb200323116c1.zip |
Impliment packet SMSG_VENDING_REPORT.
Diffstat (limited to 'src/net/eathena/vendingrecv.cpp')
-rw-r--r-- | src/net/eathena/vendingrecv.cpp | 27 |
1 files changed, 24 insertions, 3 deletions
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) |