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 ++++++++++++++++--- src/net/eathena/packets.h | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) (limited to 'src') 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) diff --git a/src/net/eathena/packets.h b/src/net/eathena/packets.h index 6bff795cc..af745449c 100644 --- a/src/net/eathena/packets.h +++ b/src/net/eathena/packets.h @@ -216,7 +216,7 @@ int16_t packet_lengths[] = //0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // #0x0800 -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 20, - 3, 0, 8, -1, 86, -1, 0, 0, -1, 0, 4, 10, 10, 22, 8, 0, + 3, 0, 8, -1, 86, -1, 6, 0, -1, 0, 4, 10, 10, 22, 8, 0, 0, 0, 0, 0, 6, 0, -1, 3, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 5, 0, 0, 6, 26, 0, // #0x0840 -- cgit v1.2.3-60-g2f50