From f840d8133e7fe1e76c9e1401a39fc57fecc0b140 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 3 Oct 2014 19:01:07 +0300 Subject: eathena: add packet SMSG_PLAYER_INSERT_CARD 0x017d. --- src/net/eathena/inventoryhandler.cpp | 15 +++++++++++++++ src/net/eathena/inventoryhandler.h | 2 ++ src/net/eathena/protocol.h | 1 + src/resources/notifications.h | 10 +++++++++- src/resources/notifytypes.h | 2 ++ 5 files changed, 29 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp index 953242462..7605e9177 100644 --- a/src/net/eathena/inventoryhandler.cpp +++ b/src/net/eathena/inventoryhandler.cpp @@ -70,6 +70,7 @@ InventoryHandler::InventoryHandler() : SMSG_PLAYER_ARROW_EQUIP, SMSG_PLAYER_ATTACK_RANGE, SMSG_PLAYER_UNE_CARD, + SMSG_PLAYER_INSERT_CARD, 0 }; handledMessages = _messages; @@ -156,6 +157,10 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg) processPlayerUseCard(msg); break; + case SMSG_PLAYER_INSERT_CARD: + processPlayerInsertCard(msg); + break; + default: break; } @@ -604,6 +609,16 @@ void InventoryHandler::processPlayerUseCard(Net::MessageIn &msg) } } +void InventoryHandler::processPlayerInsertCard(Net::MessageIn &msg) +{ + msg.readInt16("item index"); + msg.readInt16("card index"); + if (msg.readUInt8("flag")) + NotifyManager::notify(NotifyTypes::CARD_INSERT_FAILED); + else + NotifyManager::notify(NotifyTypes::CARD_INSERT_SUCCESS); +} + void InventoryHandler::selectEgg(const Item *const item) const { createOutPacket(CMSG_PET_SELECT_EGG); diff --git a/src/net/eathena/inventoryhandler.h b/src/net/eathena/inventoryhandler.h index b00d7af51..b2f4db74b 100644 --- a/src/net/eathena/inventoryhandler.h +++ b/src/net/eathena/inventoryhandler.h @@ -88,6 +88,8 @@ class InventoryHandler final : public MessageHandler, void processPlayerStorageAdd(Net::MessageIn &msg); void processPlayerUseCard(Net::MessageIn &msg); + + void processPlayerInsertCard(Net::MessageIn &msg); }; } // namespace EAthena diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index 4d6370a69..03de8c3ad 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -75,6 +75,7 @@ #define SMSG_PLAYER_EQUIP 0x0999 #define SMSG_PLAYER_UNEQUIP 0x099a #define SMSG_PLAYER_UNE_CARD 0x017b +#define SMSG_PLAYER_INSERT_CARD 0x017d #define SMSG_PLAYER_ATTACK_RANGE 0x013a #define SMSG_PLAYER_ARROW_EQUIP 0x013c #define SMSG_PLAYER_ARROW_MESSAGE 0x013b diff --git a/src/resources/notifications.h b/src/resources/notifications.h index b5f1f88de..78d4e00dc 100644 --- a/src/resources/notifications.h +++ b/src/resources/notifications.h @@ -361,7 +361,15 @@ namespace NotifyManager {"homunculus feed failed", // TRANSLATORS: notification message N_("You cant feed homunculus, because not have %s."), - NotifyFlags::STRING} + NotifyFlags::STRING}, + {"card insert failed", + // TRANSLATORS: notification message + N_("Card insert failed."), + NotifyFlags::EMPTY}, + {"card insert success", + // TRANSLATORS: notification message + N_("Card inserted."), + NotifyFlags::EMPTY} }; } // namespace NotifyManager #endif // RESOURCES_NOTIFICATIONS_H diff --git a/src/resources/notifytypes.h b/src/resources/notifytypes.h index c1de1d201..eb2c2c776 100644 --- a/src/resources/notifytypes.h +++ b/src/resources/notifytypes.h @@ -110,6 +110,8 @@ namespace NotifyTypes MERCENARY_UNKNOWN, HOMUNCULUS_FEED_OK, HOMUNCULUS_FEED_FAIL, + CARD_INSERT_FAILED, + CARD_INSERT_SUCCESS, TYPE_END }; -- cgit v1.2.3-70-g09d2