From 97a8156a1252806f8789fb6d4ae333b0e4cf88f6 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 6 Feb 2015 19:59:04 +0300 Subject: eathena: add packet SMSG_BUYINGSTORE_SELL_FAILED 0x081a. --- src/net/eathena/buyingstorehandler.cpp | 23 +++++++++++++++++++++++ src/net/eathena/buyingstorehandler.h | 2 ++ src/net/eathena/packets.h | 2 +- src/net/eathena/protocol.h | 1 + src/resources/notifications.h | 12 ++++++++++++ src/resources/notifytypes.h | 3 +++ 6 files changed, 42 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/net/eathena/buyingstorehandler.cpp b/src/net/eathena/buyingstorehandler.cpp index 3e3451db2..4ce4378bc 100644 --- a/src/net/eathena/buyingstorehandler.cpp +++ b/src/net/eathena/buyingstorehandler.cpp @@ -50,6 +50,7 @@ BuyingStoreHandler::BuyingStoreHandler() : SMSG_BUYINGSTORE_SHOW_BOARD, SMSG_BUYINGSTORE_HIDE_BOARD, SMSG_BUYINGSTORE_ITEMS_LIST, + SMSG_BUYINGSTORE_SELL_FAILED, 0 }; handledMessages = _messages; @@ -84,6 +85,10 @@ void BuyingStoreHandler::handleMessage(Net::MessageIn &msg) processBuyingStoreItemsList(msg); break; + case SMSG_BUYINGSTORE_SELL_FAILED: + processBuyingStoreSellFailed(msg); + break; + default: break; } @@ -156,6 +161,24 @@ void BuyingStoreHandler::processBuyingStoreItemsList(Net::MessageIn &msg) } } +void BuyingStoreHandler::processBuyingStoreSellFailed(Net::MessageIn &msg) +{ + const int16_t result = msg.readInt16("result"); + switch (result) + { + case 3: + NotifyManager::notify( + NotifyTypes::BUYING_STORE_SELL_FAILED_MONEY_LIMIT); + break; + case 4: + NotifyManager::notify(NotifyTypes::BUYING_STORE_SELL_FAILED_EMPTY); + break; + default: + NotifyManager::notify(NotifyTypes::BUYING_STORE_SELL_FAILED); + 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 e13ed5731..906b68bf2 100644 --- a/src/net/eathena/buyingstorehandler.h +++ b/src/net/eathena/buyingstorehandler.h @@ -64,6 +64,8 @@ class BuyingStoreHandler final : public MessageHandler, static void processBuyingStoreHideBoard(Net::MessageIn &msg); static void processBuyingStoreItemsList(Net::MessageIn &msg); + + static void processBuyingStoreSellFailed(Net::MessageIn &msg); }; } // namespace EAthena diff --git a/src/net/eathena/packets.h b/src/net/eathena/packets.h index 54e5b21f1..e5f085949 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, 8, -1, 86, -1, 0, 0, -1, 0, 0, 0, 0, 22, 8, 0, + 3, 0, 8, -1, 86, -1, 0, 0, -1, 0, 4, 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 4b2e2ae03..abf18a2f3 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -173,6 +173,7 @@ #define SMSG_BUYINGSTORE_SHOW_BOARD 0x0814 #define SMSG_BUYINGSTORE_HIDE_BOARD 0x0816 #define SMSG_BUYINGSTORE_ITEMS_LIST 0x0818 +#define SMSG_BUYINGSTORE_SELL_FAILED 0x081a // Receiving a request to trade #define SMSG_TRADE_REQUEST 0x01f4 diff --git a/src/resources/notifications.h b/src/resources/notifications.h index 818f94512..60e2cefad 100644 --- a/src/resources/notifications.h +++ b/src/resources/notifications.h @@ -436,6 +436,18 @@ namespace NotifyManager {"buying store create empty", // TRANSLATORS: notification message N_("Buying store create failed. No items in store."), + NotifyFlags::EMPTY}, + {"buying store sell failed money limit", + // TRANSLATORS: notification message + N_("All items within the buy limit were purchased."), + NotifyFlags::EMPTY}, + {"buying store sell failed empty", + // TRANSLATORS: notification message + N_("All items were purchased."), + NotifyFlags::EMPTY}, + {"buying store sell failed", + // TRANSLATORS: notification message + N_("Buying item failed."), NotifyFlags::EMPTY} }; } // namespace NotifyManager diff --git a/src/resources/notifytypes.h b/src/resources/notifytypes.h index a9c881887..f8c2f737c 100644 --- a/src/resources/notifytypes.h +++ b/src/resources/notifytypes.h @@ -128,6 +128,9 @@ namespace NotifyTypes BUYING_STORE_CREATE_FAILED, BUYING_STORE_CREATE_FAILED_WEIGHT, BUYING_STORE_CREATE_EMPTY, + BUYING_STORE_SELL_FAILED_MONEY_LIMIT, + BUYING_STORE_SELL_FAILED_EMPTY, + BUYING_STORE_SELL_FAILED, TYPE_END }; -- cgit v1.2.3-60-g2f50