diff options
Diffstat (limited to 'src/net/tmwa')
-rw-r--r-- | src/net/tmwa/pethandler.cpp | 13 | ||||
-rw-r--r-- | src/net/tmwa/pethandler.h | 5 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/net/tmwa/pethandler.cpp b/src/net/tmwa/pethandler.cpp index 3293b7edd..77317a077 100644 --- a/src/net/tmwa/pethandler.cpp +++ b/src/net/tmwa/pethandler.cpp @@ -34,7 +34,8 @@ namespace TmwAthena { PetHandler::PetHandler() : - MessageHandler() + MessageHandler(), + mRandCounter(1000) { static const uint16_t _messages[] = { @@ -63,10 +64,14 @@ void PetHandler::spawn(const Being *const being A_UNUSED, { } -void PetHandler::emote(const uint8_t emoteId, const int petId A_UNUSED) const +void PetHandler::emote(const uint8_t emoteId, const int petId A_UNUSED) { - Net::getChatHandler()->talk("\302\202\302e" + toString( - static_cast<int>(emoteId)), GENERAL_CHANNEL); + mRandCounter ++; + if (mRandCounter > 10000) + mRandCounter = 1000; + + Net::getChatHandler()->talk(strprintf("\302\202\302e%dz%d", + static_cast<int>(emoteId), mRandCounter), GENERAL_CHANNEL); } } // namespace TmwAthena diff --git a/src/net/tmwa/pethandler.h b/src/net/tmwa/pethandler.h index 30eff59b8..bcfa6b1a6 100644 --- a/src/net/tmwa/pethandler.h +++ b/src/net/tmwa/pethandler.h @@ -47,7 +47,10 @@ class PetHandler final : public MessageHandler, public Net::PetHandler const int x, const int y) const override final; void emote(const uint8_t emoteId, - const int petId) const override final; + const int petId) override final; + + protected: + int mRandCounter; }; } // namespace TmwAthena |