diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-02-01 23:48:15 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-02-02 22:48:03 +0300 |
commit | 6dc1f5e0b68cf390f7938329b50a9b28bd187862 (patch) | |
tree | 29e30e48cc03d95aeff278f6842f3a15de8f4106 /src/net/eathena/vendinghandler.cpp | |
parent | c8c51d7550adf9c952a4be54398df7e7a6f341a8 (diff) | |
download | ManaVerse-6dc1f5e0b68cf390f7938329b50a9b28bd187862.tar.gz ManaVerse-6dc1f5e0b68cf390f7938329b50a9b28bd187862.tar.bz2 ManaVerse-6dc1f5e0b68cf390f7938329b50a9b28bd187862.tar.xz ManaVerse-6dc1f5e0b68cf390f7938329b50a9b28bd187862.zip |
Set correct vending status to local player.
Allow buy from vending shop.
Diffstat (limited to 'src/net/eathena/vendinghandler.cpp')
-rw-r--r-- | src/net/eathena/vendinghandler.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/net/eathena/vendinghandler.cpp b/src/net/eathena/vendinghandler.cpp index 25bec7c68..823709b6f 100644 --- a/src/net/eathena/vendinghandler.cpp +++ b/src/net/eathena/vendinghandler.cpp @@ -26,10 +26,12 @@ #include "enums/being/attributes.h" #include "being/being.h" +#include "being/localplayer.h" #include "being/playerinfo.h" #include "gui/windows/buydialog.h" +#include "listeners/vendingmodelistener.h" #include "listeners/vendingslotslistener.h" #include "net/ea/eaprotocol.h" @@ -121,6 +123,8 @@ void VendingHandler::processHideBoard(Net::MessageIn &msg) Being *const dstBeing = actorManager->findBeing(id); if (dstBeing) dstBeing->setBoard(std::string()); + if (dstBeing == localPlayer) + VendingModeListener::distributeEvent(false); } void VendingHandler::processItemsList(Net::MessageIn &msg) @@ -138,7 +142,7 @@ void VendingHandler::processItemsList(Net::MessageIn &msg) { const int value = msg.readInt32("price"); const int amount = msg.readInt16("amount"); - msg.readInt16("inv index"); + const int index = msg.readInt16("inv index"); const int type = msg.readUInt8("item type"); const int itemId = msg.readInt16("item id"); msg.readUInt8("identify"); @@ -148,7 +152,10 @@ void VendingHandler::processItemsList(Net::MessageIn &msg) msg.readInt16("card"); const unsigned char color = 1; - mBuyDialog->addItem(itemId, type, color, amount, value); + ShopItem *const item = mBuyDialog->addItem(itemId, type, + color, amount, value); + if (item) + item->setInvIndex(index); } mBuyDialog->sort(); } @@ -177,6 +184,8 @@ void VendingHandler::processOpen(Net::MessageIn &msg) for (int d = 0; d < 4; d ++) msg.readInt16("card"); } + PlayerInfo::enableVending(true); + VendingModeListener::distributeEvent(true); } void VendingHandler::processReport(Net::MessageIn &msg) |