summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-01-07 16:55:08 +0300
committerAndrei Karas <akaras@inbox.ru>2015-01-07 17:01:49 +0300
commit3b96653ddb43f1d02979ebb92fb3b08f39a5aa68 (patch)
tree5972d0f6431bb0078d769c8c19a6287de522cce8 /src/net
parent64ed5cd18dca0d5eb08302d552a09f03d9ceeb10 (diff)
downloadmanaverse-3b96653ddb43f1d02979ebb92fb3b08f39a5aa68.tar.gz
manaverse-3b96653ddb43f1d02979ebb92fb3b08f39a5aa68.tar.bz2
manaverse-3b96653ddb43f1d02979ebb92fb3b08f39a5aa68.tar.xz
manaverse-3b96653ddb43f1d02979ebb92fb3b08f39a5aa68.zip
eathena: add packet CMSG_VENDING_CREATE_SHOP 0x01b2.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/eathena/protocol.h1
-rw-r--r--src/net/eathena/vendinghandler.cpp22
-rw-r--r--src/net/eathena/vendinghandler.h4
-rw-r--r--src/net/tmwa/vendinghandler.cpp6
-rw-r--r--src/net/tmwa/vendinghandler.h4
-rw-r--r--src/net/vendinghandler.h6
6 files changed, 43 insertions, 0 deletions
diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h
index 61c8661ad..baf048c56 100644
--- a/src/net/eathena/protocol.h
+++ b/src/net/eathena/protocol.h
@@ -537,5 +537,6 @@
#define CMSG_VENDING_LIST_REQ 0x0130
#define CMSG_VENDING_BUY 0x0134
#define CMSG_VENDING_BUY2 0x0801
+#define CMSG_VENDING_CREATE_SHOP 0x01b2
#endif // NET_EATHENA_PROTOCOL_H
diff --git a/src/net/eathena/vendinghandler.cpp b/src/net/eathena/vendinghandler.cpp
index e01040055..47428a040 100644
--- a/src/net/eathena/vendinghandler.cpp
+++ b/src/net/eathena/vendinghandler.cpp
@@ -20,8 +20,12 @@
#include "net/eathena/vendinghandler.h"
+#include "shopitem.h"
+
#include "being/being.h"
+#include "net/ea/eaprotocol.h"
+
#include "net/eathena/messageout.h"
#include "net/eathena/protocol.h"
@@ -198,4 +202,22 @@ void VendingHandler::buy2(const Being *const being,
outMsg.writeInt16(index, "index");
}
+void VendingHandler::createShop(const std::string &name,
+ const bool flag,
+ std::vector<ShopItem*> &items) const
+{
+ createOutPacket(CMSG_VENDING_CREATE_SHOP);
+ outMsg.writeInt16(85 + items.size() * 8, "len");
+ outMsg.writeString(name, 80, "shop name");
+ outMsg.writeInt8(flag ? 1 : 0, "flag");
+ FOR_EACH (std::vector<ShopItem*>::const_iterator, it, items)
+ {
+ const ShopItem *const item = *it;
+ outMsg.writeInt16(static_cast<int16_t>(
+ item->getInvIndex() + INVENTORY_OFFSET), "index");
+ outMsg.writeInt16(static_cast<int16_t>(item->getQuantity()), "amount");
+ outMsg.writeInt32(item->getPrice(), "price");
+ }
+}
+
} // namespace EAthena
diff --git a/src/net/eathena/vendinghandler.h b/src/net/eathena/vendinghandler.h
index e14ca0596..30e9f50e2 100644
--- a/src/net/eathena/vendinghandler.h
+++ b/src/net/eathena/vendinghandler.h
@@ -50,6 +50,10 @@ class VendingHandler final : public MessageHandler,
const int index,
const int amount) const override final;
+ void createShop(const std::string &name,
+ const bool flag,
+ std::vector<ShopItem*> &items) const override final;
+
protected:
static void processOpenReq(Net::MessageIn &msg);
diff --git a/src/net/tmwa/vendinghandler.cpp b/src/net/tmwa/vendinghandler.cpp
index deff011ca..67e39fd6a 100644
--- a/src/net/tmwa/vendinghandler.cpp
+++ b/src/net/tmwa/vendinghandler.cpp
@@ -63,4 +63,10 @@ void VendingHandler::buy2(const Being *const being A_UNUSED,
{
}
+void VendingHandler::createShop(const std::string &name A_UNUSED,
+ const bool flag A_UNUSED,
+ std::vector<ShopItem*> &items A_UNUSED) const
+{
+}
+
} // namespace TmwAthena
diff --git a/src/net/tmwa/vendinghandler.h b/src/net/tmwa/vendinghandler.h
index f23e8276c..22629be1f 100644
--- a/src/net/tmwa/vendinghandler.h
+++ b/src/net/tmwa/vendinghandler.h
@@ -50,6 +50,10 @@ class VendingHandler final : public MessageHandler,
const int vendId,
const int index,
const int amount) const override final;
+
+ void createShop(const std::string &name,
+ const bool flag,
+ std::vector<ShopItem*> &items) const override final;
};
} // namespace TmwAthena
diff --git a/src/net/vendinghandler.h b/src/net/vendinghandler.h
index c8eed3bd3..797ef8340 100644
--- a/src/net/vendinghandler.h
+++ b/src/net/vendinghandler.h
@@ -22,10 +22,12 @@
#define NET_VENDINGHANDLER_H
#include <string>
+#include <vector>
#include "localconsts.h"
class Being;
+class ShopItem;
namespace Net
{
@@ -48,6 +50,10 @@ class VendingHandler notfinal
const int vendId,
const int index,
const int amount) const = 0;
+
+ virtual void createShop(const std::string &name,
+ const bool flag,
+ std::vector<ShopItem*> &items) const = 0;
};
} // namespace Net