From a7258e25d06f90b10dee8281a65d239c89e5094c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 7 Mar 2014 12:28:38 +0300 Subject: fix emote command in crazy moves A. --- src/being/localplayer.cpp | 4 ++-- src/net/pethandler.h | 2 +- src/net/tmwa/pethandler.cpp | 13 +++++++++---- src/net/tmwa/pethandler.h | 5 ++++- 4 files changed, 16 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 3d9d06bef..889f2b906 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -2430,9 +2430,9 @@ void LocalPlayer::crazyMoveA() else if (emo >= 'A' && emo <= 'Z') emoteId = static_cast(emo - 'A' + 37); } - if (mMoveProgram[mCrazyMoveState] == 'e') + if (mMoveProgram[mCrazyMoveState - 1] == 'e') emote(emoteId); - else + else if (client->limitPackets(PACKET_CHAT)) Net::getPetHandler()->emote(emoteId, 0); mCrazyMoveState ++; diff --git a/src/net/pethandler.h b/src/net/pethandler.h index 7b5666396..688eb3034 100644 --- a/src/net/pethandler.h +++ b/src/net/pethandler.h @@ -41,7 +41,7 @@ class PetHandler const int petId, const int x, const int y) const = 0; - virtual void emote(const uint8_t emoteId, const int petId) const = 0; + virtual void emote(const uint8_t emoteId, const int petId) = 0; }; } // namespace Net 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(emoteId)), GENERAL_CHANNEL); + mRandCounter ++; + if (mRandCounter > 10000) + mRandCounter = 1000; + + Net::getChatHandler()->talk(strprintf("\302\202\302e%dz%d", + static_cast(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 -- cgit v1.2.3-60-g2f50