summaryrefslogtreecommitdiff
path: root/src/net/eathena/buyingstorehandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-02-05 12:00:20 +0300
committerAndrei Karas <akaras@inbox.ru>2015-02-05 12:00:20 +0300
commit805299e4d653440c582f6c576bcd7de2e1b2c3d4 (patch)
treea85f217a0530e536cb1483360bea2df0cad0e213 /src/net/eathena/buyingstorehandler.cpp
parent527d9d1aea2b840e98dd0976f7bd3426703a886a (diff)
downloadmv-805299e4d653440c582f6c576bcd7de2e1b2c3d4.tar.gz
mv-805299e4d653440c582f6c576bcd7de2e1b2c3d4.tar.bz2
mv-805299e4d653440c582f6c576bcd7de2e1b2c3d4.tar.xz
mv-805299e4d653440c582f6c576bcd7de2e1b2c3d4.zip
eathena: add packet CMSG_BUYINGSTORE_CREATE 0x0815.
Diffstat (limited to 'src/net/eathena/buyingstorehandler.cpp')
-rw-r--r--src/net/eathena/buyingstorehandler.cpp25
1 files changed, 24 insertions, 1 deletions
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<ShopItem*> &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<ShopItem*>::const_iterator, it, items)
+ {
+ const ShopItem *const item = *it;
+ outMsg.writeInt16(static_cast<int16_t>(item->getId()), "item id");
+ outMsg.writeInt16(static_cast<int16_t>(item->getQuantity()), "amount");
+ outMsg.writeInt32(item->getPrice(), "price");
+ }
+}
+
} // namespace EAthena