From 4ae0cd0b3838cc3354702af2ca6d669a91afdd8d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 9 Feb 2015 15:56:35 +0300 Subject: eathena: add packet CMSG_SEARCHSTORE_SEARCH 0x0819. --- src/CMakeLists.txt | 1 + src/Makefile.am | 1 + src/enums/net/storesearchtype.h | 33 +++++++++++++++++++++++++++++++++ src/net/eathena/protocol.h | 2 ++ src/net/eathena/searchstorehandler.cpp | 18 ++++++++++++++++++ src/net/eathena/searchstorehandler.h | 5 +++++ src/net/searchstorehandler.h | 7 +++++++ src/net/tmwa/searchstorehandler.cpp | 7 +++++++ src/net/tmwa/searchstorehandler.h | 5 +++++ 9 files changed, 79 insertions(+) create mode 100644 src/enums/net/storesearchtype.h (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 30aea08db..43b4b91ad 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -566,6 +566,7 @@ SET(SRCS net/partyhandler.h enums/net/partyshare.h enums/net/servertype.h + enums/net/storesearchtype.h net/pethandler.h net/playerhandler.h net/registrationoptions.h diff --git a/src/Makefile.am b/src/Makefile.am index ca8330f93..86662b0a8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -702,6 +702,7 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ net/partyhandler.h \ enums/net/partyshare.h \ enums/net/servertype.h \ + enums/net/storesearchtype.h \ net/pethandler.h \ net/playerhandler.h \ net/questhandler.h \ diff --git a/src/enums/net/storesearchtype.h b/src/enums/net/storesearchtype.h new file mode 100644 index 000000000..5e6185fae --- /dev/null +++ b/src/enums/net/storesearchtype.h @@ -0,0 +1,33 @@ +/* + * The ManaPlus Client + * Copyright (C) 2015 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef ENUMS_NET_STORESEARCHTYPE_H +#define ENUMS_NET_STORESEARCHTYPE_H + +namespace StoreSearchType +{ + enum Type + { + Vending = 0, + BuingStore = 1 + }; +} + +#endif // ENUMS_NET_STORESEARCHTYPE_H diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index 640db8a78..a214674ed 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -561,4 +561,6 @@ #define CMSG_BUYINGSTORE_OPEN 0x0360 #define CMSG_BUYINGSTORE_SELL 0x0811 +#define CMSG_SEARCHSTORE_SEARCH 0x0819 + #endif // NET_EATHENA_PROTOCOL_H diff --git a/src/net/eathena/searchstorehandler.cpp b/src/net/eathena/searchstorehandler.cpp index 38baadd6d..4ddad3148 100644 --- a/src/net/eathena/searchstorehandler.cpp +++ b/src/net/eathena/searchstorehandler.cpp @@ -20,6 +20,9 @@ #include "net/eathena/searchstorehandler.h" +#include "net/eathena/messageout.h" +#include "net/eathena/protocol.h" + #include "debug.h" extern Net::SearchStoreHandler *searchStoreHandler; @@ -47,4 +50,19 @@ void SearchStoreHandler::handleMessage(Net::MessageIn &msg) } } +void SearchStoreHandler::search(const StoreSearchType::Type type, + const int minPrice, + const int maxPrice, + const int itemId) const +{ + createOutPacket(CMSG_SEARCHSTORE_SEARCH); + outMsg.writeInt16(23, "len"); + outMsg.writeInt8(static_cast(type), "search type"); + outMsg.writeInt32(maxPrice, "max price"); + outMsg.writeInt32(minPrice, "min price"); + outMsg.writeInt32(1, "items count"); + outMsg.writeInt32(0, "cards count"); + outMsg.writeInt16(itemId, "item id"); +} + } // namespace EAthena diff --git a/src/net/eathena/searchstorehandler.h b/src/net/eathena/searchstorehandler.h index f9c486faf..56e44dd8b 100644 --- a/src/net/eathena/searchstorehandler.h +++ b/src/net/eathena/searchstorehandler.h @@ -36,6 +36,11 @@ class SearchStoreHandler final : public MessageHandler, A_DELETE_COPY(SearchStoreHandler) void handleMessage(Net::MessageIn &msg) override final; + + void search(const StoreSearchType::Type type, + const int minPrice, + const int maxPrice, + const int itemId) const override final; }; } // namespace EAthena diff --git a/src/net/searchstorehandler.h b/src/net/searchstorehandler.h index 30b5d0e88..dc775a7b6 100644 --- a/src/net/searchstorehandler.h +++ b/src/net/searchstorehandler.h @@ -23,6 +23,8 @@ #include +#include "enums/net/storesearchtype.h" + #include "localconsts.h" namespace Net @@ -33,6 +35,11 @@ class SearchStoreHandler notfinal public: virtual ~SearchStoreHandler() { } + + virtual void search(const StoreSearchType::Type type, + const int minPrice, + const int maxPrice, + const int itemId) const = 0; }; } // namespace Net diff --git a/src/net/tmwa/searchstorehandler.cpp b/src/net/tmwa/searchstorehandler.cpp index 26e35725f..ef70b3d27 100644 --- a/src/net/tmwa/searchstorehandler.cpp +++ b/src/net/tmwa/searchstorehandler.cpp @@ -47,4 +47,11 @@ void SearchStoreHandler::handleMessage(Net::MessageIn &msg) } } +void SearchStoreHandler::search(const StoreSearchType::Type type A_UNUSED, + const int minPrice A_UNUSED, + const int maxPrice A_UNUSED, + const int itemId A_UNUSED) const +{ +} + } // namespace TmwAthena diff --git a/src/net/tmwa/searchstorehandler.h b/src/net/tmwa/searchstorehandler.h index f5c00a6c1..7750758f5 100644 --- a/src/net/tmwa/searchstorehandler.h +++ b/src/net/tmwa/searchstorehandler.h @@ -36,6 +36,11 @@ class SearchStoreHandler final : public MessageHandler, A_DELETE_COPY(SearchStoreHandler) void handleMessage(Net::MessageIn &msg) override final; + + void search(const StoreSearchType::Type type, + const int minPrice, + const int maxPrice, + const int itemId) const override final; }; } // namespace TmwAthena -- cgit v1.2.3-70-g09d2