From 805299e4d653440c582f6c576bcd7de2e1b2c3d4 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 5 Feb 2015 12:00:20 +0300 Subject: eathena: add packet CMSG_BUYINGSTORE_CREATE 0x0815. --- src/net/eathena/buyingstorehandler.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src/net/eathena/buyingstorehandler.cpp') diff --git a/src/net/eathena/buyingstorehandler.cpp b/src/net/eathena/buyingstorehandler.cpp index 0067fa78b..166512eca 100644 --- a/src/net/eathena/buyingstorehandler.cpp +++ b/src/net/eathena/buyingstorehandler.cpp @@ -20,7 +20,12 @@ #include "net/eathena/buyingstorehandler.h" -#include "net/eathena/protocol.h" +#include "shopitem.h" + +#include "net/ea/eaprotocol.h" + +#include "net/eathena/messageout.h" +#include "net/eathena/protocol.h" #include "debug.h" @@ -60,4 +65,22 @@ void BuyingStoreHandler::processBuyingStoreOpen(Net::MessageIn &msg) msg.readUInt8("slots"); } +void BuyingStoreHandler::create(const std::string &name, + const int maxMoney, + const bool flag, + std::vector &items) const +{ + createOutPacket(CMSG_BUYINGSTORE_CREATE); + outMsg.writeInt32(maxMoney, "limit money"); + outMsg.writeInt8(flag, "flag"); + outMsg.writeString(name, 80, "store name"); + FOR_EACH (std::vector::const_iterator, it, items) + { + const ShopItem *const item = *it; + outMsg.writeInt16(static_cast(item->getId()), "item id"); + outMsg.writeInt16(static_cast(item->getQuantity()), "amount"); + outMsg.writeInt32(item->getPrice(), "price"); + } +} + } // namespace EAthena -- cgit v1.2.3-60-g2f50