diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-02-09 16:49:57 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-02-09 16:49:57 +0300 |
commit | 23ea6f137e33ba1158ec3e6783fe31435fcffe1f (patch) | |
tree | 245421bca38fad9ac728cccb77d7ff153826faa1 | |
parent | 2aef4c43560203a41ee2866245732fbfa2639a6d (diff) | |
download | mv-23ea6f137e33ba1158ec3e6783fe31435fcffe1f.tar.gz mv-23ea6f137e33ba1158ec3e6783fe31435fcffe1f.tar.bz2 mv-23ea6f137e33ba1158ec3e6783fe31435fcffe1f.tar.xz mv-23ea6f137e33ba1158ec3e6783fe31435fcffe1f.zip |
eathena: add packet SMSG_SEARCHSTORE_SEARCH_FAILED 0x0837.
-rw-r--r-- | src/net/eathena/packets.h | 2 | ||||
-rw-r--r-- | src/net/eathena/protocol.h | 1 | ||||
-rw-r--r-- | src/net/eathena/searchstorehandler.cpp | 43 | ||||
-rw-r--r-- | src/net/eathena/searchstorehandler.h | 2 | ||||
-rw-r--r-- | src/resources/notifications.h | 26 | ||||
-rw-r--r-- | src/resources/notifytypes.h | 6 |
6 files changed, 78 insertions, 2 deletions
diff --git a/src/net/eathena/packets.h b/src/net/eathena/packets.h index 2f0a79cb9..14b15ed2e 100644 --- a/src/net/eathena/packets.h +++ b/src/net/eathena/packets.h @@ -217,7 +217,7 @@ int16_t packet_lengths[] = // #0x0800 -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 20, 3, 0, 8, -1, 86, -1, 0, 0, -1, 0, 4, 10, 10, 22, 8, 0, - 0, 0, 0, 0, 6, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, + 0, 0, 0, 0, 6, 0, -1, 3, 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 -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index cdff5a705..f58f4ff93 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -344,6 +344,7 @@ #define SMSG_CART_REMOVE 0x012b #define SMSG_SEARCHSTORE_SEARCH_ACK 0x0836 +#define SMSG_SEARCHSTORE_SEARCH_FAILED 0x0837 /********************************** * Packets from client to server * diff --git a/src/net/eathena/searchstorehandler.cpp b/src/net/eathena/searchstorehandler.cpp index 22f892a8a..6d6a7e1b8 100644 --- a/src/net/eathena/searchstorehandler.cpp +++ b/src/net/eathena/searchstorehandler.cpp @@ -20,9 +20,13 @@ #include "net/eathena/searchstorehandler.h" +#include "notifymanager.h" + #include "net/eathena/messageout.h" #include "net/eathena/protocol.h" +#include "resources/notifytypes.h" + #include "debug.h" extern Net::SearchStoreHandler *searchStoreHandler; @@ -36,6 +40,7 @@ SearchStoreHandler::SearchStoreHandler() : static const uint16_t _messages[] = { SMSG_SEARCHSTORE_SEARCH_ACK, + SMSG_SEARCHSTORE_SEARCH_FAILED, 0 }; handledMessages = _messages; @@ -50,6 +55,10 @@ void SearchStoreHandler::handleMessage(Net::MessageIn &msg) processSearchAck(msg); break; + case SMSG_SEARCHSTORE_SEARCH_FAILED: + processSearchFailed(msg); + break; + default: break; } @@ -86,9 +95,41 @@ void SearchStoreHandler::processSearchAck(Net::MessageIn &msg) msg.readInt32("price"); msg.readInt16("amount"); msg.readUInt8("refine"); - for (int f = 0; f < 4; f++) + for (int d = 0; d < 4; d++) msg.readInt16("card"); } } +void SearchStoreHandler::processSearchFailed(Net::MessageIn &msg) +{ + const int result = msg.readUInt8("result"); + switch (result) + { + case 0: + NotifyManager::notify( + NotifyTypes::SEARCH_STORE_FAILED_NO_STORES); + break; + case 1: + NotifyManager::notify( + NotifyTypes::SEARCH_STORE_FAILED_MANY_RESULTS); + break; + case 2: + NotifyManager::notify( + NotifyTypes::SEARCH_STORE_FAILED_CANT_SEARCH_ANYMORE); + break; + case 3: + NotifyManager::notify( + NotifyTypes::SEARCH_STORE_FAILED_CANT_SEARCH_YET); + break; + case 4: + NotifyManager::notify( + NotifyTypes::SEARCH_STORE_FAILED_NO_INFORMATION); + break; + default: + NotifyManager::notify( + NotifyTypes::SEARCH_STORE_FAILED); + break; + } +} + } // namespace EAthena diff --git a/src/net/eathena/searchstorehandler.h b/src/net/eathena/searchstorehandler.h index bd2cf80c7..8412f17dc 100644 --- a/src/net/eathena/searchstorehandler.h +++ b/src/net/eathena/searchstorehandler.h @@ -44,6 +44,8 @@ class SearchStoreHandler final : public MessageHandler, protected: static void processSearchAck(Net::MessageIn &msg); + + static void processSearchFailed(Net::MessageIn &msg); }; } // namespace EAthena diff --git a/src/resources/notifications.h b/src/resources/notifications.h index c0f75aae4..8bb14291a 100644 --- a/src/resources/notifications.h +++ b/src/resources/notifications.h @@ -467,6 +467,32 @@ namespace NotifyManager // TRANSLATORS: notification message N_("Selling item failed."), NotifyFlags::EMPTY}, + + {"search store failed", + // TRANSLATORS: notification message + N_("Items searching failed."), + NotifyFlags::EMPTY}, + {"search store failed no stores", + // TRANSLATORS: notification message + N_("No matching stores were found."), + NotifyFlags::EMPTY}, + {"search store failed many results", + // TRANSLATORS: notification message + N_("There are too many results. Please enter more " + "detailed search term."), + NotifyFlags::EMPTY}, + {"search store failed cant search anymore", + // TRANSLATORS: notification message + N_("You cannot search anymore."), + NotifyFlags::EMPTY}, + {"search store failed cant search yet", + // TRANSLATORS: notification message + N_("You cannot search yet."), + NotifyFlags::EMPTY}, + {"search store failed no information", + // TRANSLATORS: notification message + N_("No store information available."), + NotifyFlags::EMPTY}, }; } // namespace NotifyManager #endif // RESOURCES_NOTIFICATIONS_H diff --git a/src/resources/notifytypes.h b/src/resources/notifytypes.h index a0730f829..776c9793f 100644 --- a/src/resources/notifytypes.h +++ b/src/resources/notifytypes.h @@ -135,6 +135,12 @@ namespace NotifyTypes BUYING_STORE_SELLER_SELL_FAILED_AMOUNT, BUYING_STORE_SELLER_SELL_FAILED_BALANCE, BUYING_STORE_SELLER_SELL_FAILED, + SEARCH_STORE_FAILED, + SEARCH_STORE_FAILED_NO_STORES, + SEARCH_STORE_FAILED_MANY_RESULTS, + SEARCH_STORE_FAILED_CANT_SEARCH_ANYMORE, + SEARCH_STORE_FAILED_CANT_SEARCH_YET, + SEARCH_STORE_FAILED_NO_INFORMATION, TYPE_END }; |