From b70f77df7ef4bd06b35511e17aa74fc3493dfcd9 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 5 Feb 2015 12:36:17 +0300 Subject: eathena: add packet SMSG_BUYINGSTORE_CREATE_FAILED 0x0812. --- src/net/eathena/buyingstorehandler.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/net/eathena/buyingstorehandler.cpp') diff --git a/src/net/eathena/buyingstorehandler.cpp b/src/net/eathena/buyingstorehandler.cpp index 166512eca..135a866b4 100644 --- a/src/net/eathena/buyingstorehandler.cpp +++ b/src/net/eathena/buyingstorehandler.cpp @@ -20,6 +20,7 @@ #include "net/eathena/buyingstorehandler.h" +#include "notifymanager.h" #include "shopitem.h" #include "net/ea/eaprotocol.h" @@ -27,6 +28,8 @@ #include "net/eathena/messageout.h" #include "net/eathena/protocol.h" +#include "resources/notifytypes.h" + #include "debug.h" extern Net::BuyingStoreHandler *buyingStoreHandler; @@ -40,6 +43,7 @@ BuyingStoreHandler::BuyingStoreHandler() : static const uint16_t _messages[] = { SMSG_BUYINGSTORE_OPEN, + SMSG_BUYINGSTORE_CREATE_FAILED, 0 }; handledMessages = _messages; @@ -54,6 +58,10 @@ void BuyingStoreHandler::handleMessage(Net::MessageIn &msg) processBuyingStoreOpen(msg); break; + case SMSG_BUYINGSTORE_CREATE_FAILED: + processBuyingStoreCreateFailed(msg); + break; + default: break; } @@ -65,6 +73,27 @@ void BuyingStoreHandler::processBuyingStoreOpen(Net::MessageIn &msg) msg.readUInt8("slots"); } +void BuyingStoreHandler::processBuyingStoreCreateFailed(Net::MessageIn &msg) +{ + const int16_t result = msg.readInt16("result"); + const int weight = msg.readInt32("weight"); + switch (result) + { + case 0: + default: + NotifyManager::notify(NotifyTypes::BUYING_STORE_CREATE_FAILED); + break; + case 1: + NotifyManager::notify( + NotifyTypes::BUYING_STORE_CREATE_FAILED_WEIGHT, + weight); + break; + case 8: + NotifyManager::notify(NotifyTypes::BUYING_STORE_CREATE_EMPTY); + break; + } +} + void BuyingStoreHandler::create(const std::string &name, const int maxMoney, const bool flag, -- cgit v1.2.3-60-g2f50