summaryrefslogtreecommitdiff
path: root/src/net/eathena/searchstorehandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/eathena/searchstorehandler.cpp')
-rw-r--r--src/net/eathena/searchstorehandler.cpp43
1 files changed, 42 insertions, 1 deletions
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