summaryrefslogtreecommitdiff
path: root/src/net/eathena
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
parent527d9d1aea2b840e98dd0976f7bd3426703a886a (diff)
downloadplus-805299e4d653440c582f6c576bcd7de2e1b2c3d4.tar.gz
plus-805299e4d653440c582f6c576bcd7de2e1b2c3d4.tar.bz2
plus-805299e4d653440c582f6c576bcd7de2e1b2c3d4.tar.xz
plus-805299e4d653440c582f6c576bcd7de2e1b2c3d4.zip
eathena: add packet CMSG_BUYINGSTORE_CREATE 0x0815.
Diffstat (limited to 'src/net/eathena')
-rw-r--r--src/net/eathena/buyingstorehandler.cpp25
-rw-r--r--src/net/eathena/buyingstorehandler.h5
-rw-r--r--src/net/eathena/packets.h2
-rw-r--r--src/net/eathena/protocol.h2
4 files changed, 32 insertions, 2 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
diff --git a/src/net/eathena/buyingstorehandler.h b/src/net/eathena/buyingstorehandler.h
index a5e0a85b5..edafbc170 100644
--- a/src/net/eathena/buyingstorehandler.h
+++ b/src/net/eathena/buyingstorehandler.h
@@ -37,6 +37,11 @@ class BuyingStoreHandler final : public MessageHandler,
void handleMessage(Net::MessageIn &msg) override final;
+ void create(const std::string &name,
+ const int maxMoney,
+ const bool flag,
+ std::vector<ShopItem*> &items) const override final;
+
protected:
static void processBuyingStoreOpen(Net::MessageIn &msg);
};
diff --git a/src/net/eathena/packets.h b/src/net/eathena/packets.h
index 1f5e6211d..3755746e7 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 8, 0,
+ 3, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 22, 8, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 26, 0,
// #0x0840
diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h
index b17531c9d..b79baf82b 100644
--- a/src/net/eathena/protocol.h
+++ b/src/net/eathena/protocol.h
@@ -547,4 +547,6 @@
#define CMSG_VENDING_BUY2 0x0801
#define CMSG_VENDING_CREATE_SHOP 0x01b2
+#define CMSG_BUYINGSTORE_CREATE 0x0815
+
#endif // NET_EATHENA_PROTOCOL_H