From bf966d287a973ad9134c31d8c37cb471832088d2 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 25 Feb 2015 23:34:43 +0300 Subject: eathena: add packet CMSG_HOMMERC_DIRECTION 0x0b15. --- src/net/eathena/homunculushandler.cpp | 18 ++++++++++++++++++ src/net/eathena/homunculushandler.h | 2 ++ src/net/eathena/mercenaryhandler.cpp | 18 ++++++++++++++++++ src/net/eathena/mercenaryhandler.h | 2 ++ src/net/eathena/protocol.h | 1 + src/net/homunculushandler.h | 2 ++ src/net/mercenaryhandler.h | 2 ++ src/net/tmwa/homunculushandler.cpp | 4 ++++ src/net/tmwa/homunculushandler.h | 2 ++ src/net/tmwa/mercenaryhandler.cpp | 4 ++++ src/net/tmwa/mercenaryhandler.h | 2 ++ 11 files changed, 57 insertions(+) (limited to 'src') diff --git a/src/net/eathena/homunculushandler.cpp b/src/net/eathena/homunculushandler.cpp index 42426b57f..13ba7ebe8 100644 --- a/src/net/eathena/homunculushandler.cpp +++ b/src/net/eathena/homunculushandler.cpp @@ -28,6 +28,8 @@ #include "gui/windows/skilldialog.h" +#include "net/serverfeatures.h" + #include "net/eathena/messageout.h" #include "net/eathena/protocol.h" @@ -287,6 +289,8 @@ void HomunculusHandler::fire() const void HomunculusHandler::talk(const std::string &restrict text) const { + if (!serverFeatures->haveMovePet()) + return; if (text.empty()) return; std::string msg = text; @@ -302,8 +306,22 @@ void HomunculusHandler::talk(const std::string &restrict text) const void HomunculusHandler::emote(const uint8_t emoteId) const { + if (!serverFeatures->haveMovePet()) + return; createOutPacket(CMSG_HOMMERC_EMOTE); outMsg.writeInt8(emoteId, "emote id"); } +void HomunculusHandler::setDirection(const unsigned char type) const +{ + if (!serverFeatures->haveMovePet()) + return; + createOutPacket(CMSG_HOMMERC_DIRECTION); + outMsg.writeInt32(0, "pet id"); + outMsg.writeInt8(0, "head direction"); + outMsg.writeInt8(0, "unused"); + outMsg.writeInt8(MessageOut::toServerDirection(type), + "pet direction"); +} + } // namespace EAthena diff --git a/src/net/eathena/homunculushandler.h b/src/net/eathena/homunculushandler.h index f3c7a48aa..a8d80fc65 100644 --- a/src/net/eathena/homunculushandler.h +++ b/src/net/eathena/homunculushandler.h @@ -53,6 +53,8 @@ class HomunculusHandler final : public MessageHandler, void emote(const uint8_t emoteId) const override final; + void setDirection(const unsigned char type) const override final; + protected: static void processHomunculusSkills(Net::MessageIn &msg); diff --git a/src/net/eathena/mercenaryhandler.cpp b/src/net/eathena/mercenaryhandler.cpp index 857890bd7..0c3985f07 100644 --- a/src/net/eathena/mercenaryhandler.cpp +++ b/src/net/eathena/mercenaryhandler.cpp @@ -30,6 +30,8 @@ #include "gui/windows/skilldialog.h" +#include "net/serverfeatures.h" + #include "net/eathena/messageout.h" #include "net/eathena/protocol.h" @@ -217,6 +219,8 @@ void MercenaryHandler::attack(const int targetId, const bool keep) const void MercenaryHandler::talk(const std::string &restrict text) const { + if (!serverFeatures->haveMovePet()) + return; if (text.empty()) return; std::string msg = text; @@ -232,8 +236,22 @@ void MercenaryHandler::talk(const std::string &restrict text) const void MercenaryHandler::emote(const uint8_t emoteId) const { + if (!serverFeatures->haveMovePet()) + return; createOutPacket(CMSG_HOMMERC_EMOTE); outMsg.writeInt8(emoteId, "emote id"); } +void MercenaryHandler::setDirection(const unsigned char type) const +{ + if (!serverFeatures->haveMovePet()) + return; + createOutPacket(CMSG_HOMMERC_DIRECTION); + outMsg.writeInt32(0, "pet id"); + outMsg.writeInt8(0, "head direction"); + outMsg.writeInt8(0, "unused"); + outMsg.writeInt8(MessageOut::toServerDirection(type), + "pet direction"); +} + } // namespace EAthena diff --git a/src/net/eathena/mercenaryhandler.h b/src/net/eathena/mercenaryhandler.h index c2a1b18f1..c1a784c3b 100644 --- a/src/net/eathena/mercenaryhandler.h +++ b/src/net/eathena/mercenaryhandler.h @@ -51,6 +51,8 @@ class MercenaryHandler final : public MessageHandler, void emote(const uint8_t emoteId) const override final; + void setDirection(const unsigned char type) const override final; + protected: static void processMercenaryUpdate(Net::MessageIn &msg); diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index d42ec59fb..b9e0621b1 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -526,6 +526,7 @@ #define CMSG_HOMMERC_ATTACK 0x0233 #define CMSG_HOMMERC_TALK 0x0b13 #define CMSG_HOMMERC_EMOTE 0x0b14 +#define CMSG_HOMMERC_DIRECTION 0x0b15 #define CMSG_DORI_DORI 0x01e7 #define CMSG_EXPLOSION_SPIRITS 0x01ed diff --git a/src/net/homunculushandler.h b/src/net/homunculushandler.h index 41a82fc42..31fb65f08 100644 --- a/src/net/homunculushandler.h +++ b/src/net/homunculushandler.h @@ -49,6 +49,8 @@ class HomunculusHandler notfinal virtual void talk(const std::string &restrict text) const = 0; virtual void emote(const uint8_t emoteId) const = 0; + + virtual void setDirection(const unsigned char type) const = 0; }; } // namespace Net diff --git a/src/net/mercenaryhandler.h b/src/net/mercenaryhandler.h index 1330544ba..857ecd035 100644 --- a/src/net/mercenaryhandler.h +++ b/src/net/mercenaryhandler.h @@ -47,6 +47,8 @@ class MercenaryHandler notfinal virtual void talk(const std::string &restrict text) const = 0; virtual void emote(const uint8_t emoteId) const = 0; + + virtual void setDirection(const unsigned char type) const = 0; }; } // namespace Net diff --git a/src/net/tmwa/homunculushandler.cpp b/src/net/tmwa/homunculushandler.cpp index 419816f68..b851aef20 100644 --- a/src/net/tmwa/homunculushandler.cpp +++ b/src/net/tmwa/homunculushandler.cpp @@ -75,4 +75,8 @@ void HomunculusHandler::emote(const uint8_t emoteId A_UNUSED) const { } +void HomunculusHandler::setDirection(const unsigned char type A_UNUSED) const +{ +} + } // namespace TmwAthena diff --git a/src/net/tmwa/homunculushandler.h b/src/net/tmwa/homunculushandler.h index 52e484cc6..bd39b54bb 100644 --- a/src/net/tmwa/homunculushandler.h +++ b/src/net/tmwa/homunculushandler.h @@ -53,6 +53,8 @@ class HomunculusHandler final : public MessageHandler, void talk(const std::string &restrict text) const override final; void emote(const uint8_t emoteId) const override final; + + void setDirection(const unsigned char type) const override final; }; } // namespace TmwAthena diff --git a/src/net/tmwa/mercenaryhandler.cpp b/src/net/tmwa/mercenaryhandler.cpp index 9df31bc14..2dc3e388f 100644 --- a/src/net/tmwa/mercenaryhandler.cpp +++ b/src/net/tmwa/mercenaryhandler.cpp @@ -71,4 +71,8 @@ void MercenaryHandler::emote(const uint8_t emoteId A_UNUSED) const { } +void MercenaryHandler::setDirection(const unsigned char type A_UNUSED) const +{ +} + } // namespace TmwAthena diff --git a/src/net/tmwa/mercenaryhandler.h b/src/net/tmwa/mercenaryhandler.h index 24a926889..5833ab68c 100644 --- a/src/net/tmwa/mercenaryhandler.h +++ b/src/net/tmwa/mercenaryhandler.h @@ -51,6 +51,8 @@ class MercenaryHandler final : public MessageHandler, void talk(const std::string &restrict text) const override final; void emote(const uint8_t emoteId) const override final; + + void setDirection(const unsigned char type) const override final; }; } // namespace TmwAthena -- cgit v1.2.3-70-g09d2