diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-02-05 12:00:20 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-02-05 12:00:20 +0300 |
commit | 805299e4d653440c582f6c576bcd7de2e1b2c3d4 (patch) | |
tree | a85f217a0530e536cb1483360bea2df0cad0e213 | |
parent | 527d9d1aea2b840e98dd0976f7bd3426703a886a (diff) | |
download | manaplus-805299e4d653440c582f6c576bcd7de2e1b2c3d4.tar.gz manaplus-805299e4d653440c582f6c576bcd7de2e1b2c3d4.tar.bz2 manaplus-805299e4d653440c582f6c576bcd7de2e1b2c3d4.tar.xz manaplus-805299e4d653440c582f6c576bcd7de2e1b2c3d4.zip |
eathena: add packet CMSG_BUYINGSTORE_CREATE 0x0815.
-rw-r--r-- | src/net/buyingstorehandler.h | 8 | ||||
-rw-r--r-- | src/net/eathena/buyingstorehandler.cpp | 25 | ||||
-rw-r--r-- | src/net/eathena/buyingstorehandler.h | 5 | ||||
-rw-r--r-- | src/net/eathena/packets.h | 2 | ||||
-rw-r--r-- | src/net/eathena/protocol.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/buyingstorehandler.cpp | 7 | ||||
-rw-r--r-- | src/net/tmwa/buyingstorehandler.h | 5 |
7 files changed, 52 insertions, 2 deletions
diff --git a/src/net/buyingstorehandler.h b/src/net/buyingstorehandler.h index 8f78cab9a..bc7f6177c 100644 --- a/src/net/buyingstorehandler.h +++ b/src/net/buyingstorehandler.h @@ -22,9 +22,12 @@ #define NET_BUYINGSTOREHANDLER_H #include <string> +#include <vector> #include "localconsts.h" +class ShopItem; + namespace Net { @@ -33,6 +36,11 @@ class BuyingStoreHandler notfinal public: virtual ~BuyingStoreHandler() { } + + virtual void create(const std::string &name, + const int maxMoney, + const bool flag, + std::vector<ShopItem*> &items) const = 0; }; } // namespace Net 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 diff --git a/src/net/tmwa/buyingstorehandler.cpp b/src/net/tmwa/buyingstorehandler.cpp index a68208796..160a6b270 100644 --- a/src/net/tmwa/buyingstorehandler.cpp +++ b/src/net/tmwa/buyingstorehandler.cpp @@ -42,4 +42,11 @@ void BuyingStoreHandler::handleMessage(Net::MessageIn &msg A_UNUSED) { } +void BuyingStoreHandler::create(const std::string &name A_UNUSED, + const int maxMoney A_UNUSED, + const bool flag A_UNUSED, + std::vector<ShopItem*> &items A_UNUSED) const +{ +} + } // namespace TmwAthena diff --git a/src/net/tmwa/buyingstorehandler.h b/src/net/tmwa/buyingstorehandler.h index 29b5d3434..821bae865 100644 --- a/src/net/tmwa/buyingstorehandler.h +++ b/src/net/tmwa/buyingstorehandler.h @@ -37,6 +37,11 @@ class BuyingStoreHandler final : public MessageHandler, A_DELETE_COPY(BuyingStoreHandler) void handleMessage(Net::MessageIn &msg) override final; + + void create(const std::string &name, + const int maxMoney, + const bool flag, + std::vector<ShopItem*> &items) const; }; } // namespace TmwAthena |