From e59fc67ba665be08a9d9a3fa27139d31168d324a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 15 Feb 2015 13:32:56 +0300 Subject: eathena: impliment packets SMSG_BUYINGSTORE_SHOW_BOARD, SMSG_BUYINGSTORE_HIDE_BOARD. --- src/net/eathena/buyingstorehandler.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src/net/eathena/buyingstorehandler.cpp') diff --git a/src/net/eathena/buyingstorehandler.cpp b/src/net/eathena/buyingstorehandler.cpp index 18e933c56..33fd8a4ee 100644 --- a/src/net/eathena/buyingstorehandler.cpp +++ b/src/net/eathena/buyingstorehandler.cpp @@ -20,10 +20,12 @@ #include "net/eathena/buyingstorehandler.h" +#include "actormanager.h" #include "notifymanager.h" #include "shopitem.h" #include "being/being.h" +#include "being/localplayer.h" #include "being/playerinfo.h" #include "listeners/buyingstoremodelistener.h" @@ -157,13 +159,24 @@ void BuyingStoreHandler::processBuyingStoreOwnItems(Net::MessageIn &msg) void BuyingStoreHandler::processBuyingStoreShowBoard(Net::MessageIn &msg) { - msg.readInt32("account id"); - msg.readString(80, "board name"); + const int id = msg.readInt32("owner id"); + const std::string shopName = msg.readString(80, "shop name"); + Being *const dstBeing = actorManager->findBeing(id); + if (dstBeing) + dstBeing->setBuyBoard(shopName); } void BuyingStoreHandler::processBuyingStoreHideBoard(Net::MessageIn &msg) { - msg.readInt32("account id"); + const int id = msg.readInt32("owner id"); + Being *const dstBeing = actorManager->findBeing(id); + if (dstBeing) + dstBeing->setBuyBoard(std::string()); + if (dstBeing == localPlayer) + { + PlayerInfo::enableVending(false); + BuyingStoreModeListener::distributeEvent(false); + } } void BuyingStoreHandler::processBuyingStoreItemsList(Net::MessageIn &msg) -- cgit v1.2.3-60-g2f50