summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-02-05 12:36:17 +0300
committerAndrei Karas <akaras@inbox.ru>2015-02-05 12:36:17 +0300
commitb70f77df7ef4bd06b35511e17aa74fc3493dfcd9 (patch)
treea24b1b6c882faa9e4b1a31da3ef48c7f94eb3a17 /src
parent805299e4d653440c582f6c576bcd7de2e1b2c3d4 (diff)
downloadmv-b70f77df7ef4bd06b35511e17aa74fc3493dfcd9.tar.gz
mv-b70f77df7ef4bd06b35511e17aa74fc3493dfcd9.tar.bz2
mv-b70f77df7ef4bd06b35511e17aa74fc3493dfcd9.tar.xz
mv-b70f77df7ef4bd06b35511e17aa74fc3493dfcd9.zip
eathena: add packet SMSG_BUYINGSTORE_CREATE_FAILED 0x0812.
Diffstat (limited to 'src')
-rw-r--r--src/net/eathena/buyingstorehandler.cpp29
-rw-r--r--src/net/eathena/buyingstorehandler.h2
-rw-r--r--src/net/eathena/packets.h2
-rw-r--r--src/net/eathena/protocol.h1
-rw-r--r--src/resources/notifications.h12
-rw-r--r--src/resources/notifytypes.h3
6 files changed, 48 insertions, 1 deletions
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,
diff --git a/src/net/eathena/buyingstorehandler.h b/src/net/eathena/buyingstorehandler.h
index edafbc170..790ebd751 100644
--- a/src/net/eathena/buyingstorehandler.h
+++ b/src/net/eathena/buyingstorehandler.h
@@ -44,6 +44,8 @@ class BuyingStoreHandler final : public MessageHandler,
protected:
static void processBuyingStoreOpen(Net::MessageIn &msg);
+
+ static void processBuyingStoreCreateFailed(Net::MessageIn &msg);
};
} // namespace EAthena
diff --git a/src/net/eathena/packets.h b/src/net/eathena/packets.h
index 3755746e7..821484775 100644
--- a/src/net/eathena/packets.h
+++ b/src/net/eathena/packets.h
@@ -216,7 +216,7 @@ int16_t packet_lengths[] =
//0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
// #0x0800
-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 20,
- 3, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 22, 8, 0,
+ 3, 0, 8, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 22, 8, 0,
0, 0, 0, 0, 0, 0, 0, 0, 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
diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h
index b79baf82b..b8c6531b8 100644
--- a/src/net/eathena/protocol.h
+++ b/src/net/eathena/protocol.h
@@ -168,6 +168,7 @@
#define SMSG_WALK_RESPONSE 0x0087
#define SMSG_BUYINGSTORE_OPEN 0x0810
+#define SMSG_BUYINGSTORE_CREATE_FAILED 0x0812
// Receiving a request to trade
#define SMSG_TRADE_REQUEST 0x01f4
diff --git a/src/resources/notifications.h b/src/resources/notifications.h
index c5f8a12be..818f94512 100644
--- a/src/resources/notifications.h
+++ b/src/resources/notifications.h
@@ -424,6 +424,18 @@ namespace NotifyManager
// TRANSLATORS: notification message
N_("Withdraw failed. You probably don't have this "
"amount of money in the bank right now."),
+ NotifyFlags::EMPTY},
+ {"buying store create failed",
+ // TRANSLATORS: notification message
+ N_("Buying store create failed."),
+ NotifyFlags::EMPTY},
+ {"buying store create failed weight",
+ // TRANSLATORS: notification message
+ N_("Buying store create failed. Too many weight."),
+ NotifyFlags::INT},
+ {"buying store create empty",
+ // TRANSLATORS: notification message
+ N_("Buying store create failed. No items in store."),
NotifyFlags::EMPTY}
};
} // namespace NotifyManager
diff --git a/src/resources/notifytypes.h b/src/resources/notifytypes.h
index 3e17af3b5..a9c881887 100644
--- a/src/resources/notifytypes.h
+++ b/src/resources/notifytypes.h
@@ -125,6 +125,9 @@ namespace NotifyTypes
CARD_INSERT_SUCCESS,
BANK_DEPOSIT_FAILED,
BANK_WITHDRAW_FAILED,
+ BUYING_STORE_CREATE_FAILED,
+ BUYING_STORE_CREATE_FAILED_WEIGHT,
+ BUYING_STORE_CREATE_EMPTY,
TYPE_END
};