diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/net/eathena/pethandler.cpp | 26 | ||||
-rw-r--r-- | src/net/eathena/pethandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/protocol.h | 1 | ||||
-rw-r--r-- | src/resources/notifications.h | 12 | ||||
-rw-r--r-- | src/resources/notifytypes.h | 3 |
5 files changed, 44 insertions, 0 deletions
diff --git a/src/net/eathena/pethandler.cpp b/src/net/eathena/pethandler.cpp index 1485c1de0..d801c422c 100644 --- a/src/net/eathena/pethandler.cpp +++ b/src/net/eathena/pethandler.cpp @@ -20,6 +20,8 @@ #include "net/eathena/pethandler.h" +#include "notifymanager.h" + #include "gui/chatconsts.h" #include "net/chathandler.h" @@ -28,6 +30,8 @@ #include "net/eathena/messageout.h" #include "net/eathena/protocol.h" +#include "resources/notifytypes.h" + #include "debug.h" extern Net::PetHandler *petHandler; @@ -42,6 +46,7 @@ PetHandler::PetHandler() : static const uint16_t _messages[] = { SMSG_PET_MESSAGE, + SMSG_PET_ROULETTE, 0 }; handledMessages = _messages; @@ -57,6 +62,10 @@ void PetHandler::handleMessage(Net::MessageIn &msg) processPetMessage(msg); break; + case SMSG_PET_ROULETTE: + processPetRoulette(msg); + break; + default: break; } @@ -113,4 +122,21 @@ void PetHandler::processPetMessage(Net::MessageIn &msg) msg.readInt32("param"); } +void PetHandler::processPetRoulette(Net::MessageIn &msg) +{ + const uint8_t data = msg.readUInt8("data"); + switch (data) + { + case 0: + NotifyManager::notify(NotifyTypes::PET_CATCH_FAILED); + break; + case 1: + NotifyManager::notify(NotifyTypes::PET_CATCH_SUCCESS); + break; + default: + NotifyManager::notify(NotifyTypes::PET_CATCH_UNKNOWN, data); + break; + } +} + } // namespace EAthena diff --git a/src/net/eathena/pethandler.h b/src/net/eathena/pethandler.h index 4f8635dea..615139bad 100644 --- a/src/net/eathena/pethandler.h +++ b/src/net/eathena/pethandler.h @@ -58,6 +58,8 @@ class PetHandler final : public MessageHandler, public Net::PetHandler void setName(const std::string &name) const override final; protected: + void processPetRoulette(Net::MessageIn &msg); + int mRandCounter; }; diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index 4b860b2ce..5db622079 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -218,6 +218,7 @@ #define SMSG_ASK_FOR_CHILD 0x01f6 #define SMSG_PET_MESSAGE 0x01aa +#define SMSG_PET_ROULETTE 0x01a0 #define SMSG_BANK_STATUS 0x09a6 diff --git a/src/resources/notifications.h b/src/resources/notifications.h index 063235af7..952bc0a9e 100644 --- a/src/resources/notifications.h +++ b/src/resources/notifications.h @@ -322,6 +322,18 @@ namespace NotifyManager // TRANSLATORS: notification message N_("Char is not online!"), NotifyFlags::PARTY_STRING}, + {"pet catch failed", + // TRANSLATORS: notification message + N_("Pet catch failed."), + NotifyFlags::EMPTY}, + {"pet catch success", + // TRANSLATORS: notification message + N_("Pet catched."), + NotifyFlags::EMPTY}, + {"pet catch unknown error", + // TRANSLATORS: notification message + N_("Pet catch unkown error: %d."), + NotifyFlags::INT}, }; } // namespace NotifyManager #endif // RESOURCES_NOTIFICATIONS_H diff --git a/src/resources/notifytypes.h b/src/resources/notifytypes.h index 56f612a08..36b1f3047 100644 --- a/src/resources/notifytypes.h +++ b/src/resources/notifytypes.h @@ -100,6 +100,9 @@ namespace NotifyTypes PARTY_INVITE_PARTY_SAME_ACCOUNT, PARTY_INVITE_PARTY_BLOCKED_INVITE, PARTY_INVITE_PARTY_NOT_ONLINE, + PET_CATCH_FAILED, + PET_CATCH_SUCCESS, + PET_CATCH_UNKNOWN, TYPE_END }; |