diff options
Diffstat (limited to 'src/net/eathena')
-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 |
3 files changed, 29 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 |