diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-02-15 16:25:30 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-02-15 16:29:54 +0300 |
commit | d8da9ebe28dc38fa9c7e5bd859913faa4460a25d (patch) | |
tree | 4d9387a169ca56b86725fb4165e554ddeb817395 /src/net/eathena | |
parent | 77a52b24c88dd113a74ff55cecb63a7214193fdf (diff) | |
download | manaplus-d8da9ebe28dc38fa9c7e5bd859913faa4460a25d.tar.gz manaplus-d8da9ebe28dc38fa9c7e5bd859913faa4460a25d.tar.bz2 manaplus-d8da9ebe28dc38fa9c7e5bd859913faa4460a25d.tar.xz manaplus-d8da9ebe28dc38fa9c7e5bd859913faa4460a25d.zip |
eathena: impliment packet SMSG_BUYINGSTORE_ITEMS_LIST.
Diffstat (limited to 'src/net/eathena')
-rw-r--r-- | src/net/eathena/buyingstorehandler.cpp | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/src/net/eathena/buyingstorehandler.cpp b/src/net/eathena/buyingstorehandler.cpp index 33fd8a4ee..7f2627a29 100644 --- a/src/net/eathena/buyingstorehandler.cpp +++ b/src/net/eathena/buyingstorehandler.cpp @@ -21,6 +21,7 @@ #include "net/eathena/buyingstorehandler.h" #include "actormanager.h" +#include "inventory.h" #include "notifymanager.h" #include "shopitem.h" @@ -28,6 +29,10 @@ #include "being/localplayer.h" #include "being/playerinfo.h" +#include "enums/being/attributes.h" + +#include "gui/windows/buyingstoreselldialog.h" + #include "listeners/buyingstoremodelistener.h" #include "listeners/buyingstoreslotslistener.h" @@ -182,15 +187,33 @@ void BuyingStoreHandler::processBuyingStoreHideBoard(Net::MessageIn &msg) void BuyingStoreHandler::processBuyingStoreItemsList(Net::MessageIn &msg) { const int count = (msg.readInt16("len") - 16) / 9; - msg.readInt32("account id"); - msg.readInt32("store id"); + const int id = msg.readInt32("account id"); + const int storeId = msg.readInt32("store id"); + // +++ in future need use it too msg.readInt32("money limit"); + + Being *const dstBeing = actorManager->findBeing(id); + if (!dstBeing) + return; + + SellDialog *const dialog = new BuyingStoreSellDialog( + dstBeing->getId(), + storeId); + dialog->postInit(); + dialog->setMoney(PlayerInfo::getAttribute(Attributes::MONEY)); + Inventory *const inv = PlayerInfo::getInventory(); for (int f = 0; f < count; f ++) { - msg.readInt32("price"); - msg.readInt16("amount"); - msg.readUInt8("item type"); - msg.readInt16("item id"); + const int price = msg.readInt32("price"); + const int amount = msg.readInt16("amount"); + const int itemType = msg.readUInt8("item type"); + const int itemId = msg.readInt16("item id"); + + const Item *const item = inv->findItem(itemId, 1); + if (!item) + continue; + // +++ need add colors support + dialog->addItem(itemId, itemType, 1, amount, price); } } |