From 8f4d75cadd75e71daf5689a2d289bd2e0deea533 Mon Sep 17 00:00:00 2001
From: Jared Adams <jaxad0127@gmail.com>
Date: Mon, 6 Apr 2009 17:09:20 -0600
Subject: Add support for changing direction under eAthena

---
 src/net/ea/beinghandler.cpp  | 13 +++++++++++++
 src/net/ea/partyhandler.cpp  |  5 +++++
 src/net/ea/partyhandler.h    |  2 ++
 src/net/ea/playerhandler.cpp |  4 +++-
 src/net/ea/protocol.h        |  2 ++
 5 files changed, 25 insertions(+), 1 deletion(-)

(limited to 'src/net/ea')

diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp
index 7fc28f15..8ad15f76 100644
--- a/src/net/ea/beinghandler.cpp
+++ b/src/net/ea/beinghandler.cpp
@@ -57,6 +57,7 @@ BeingHandler::BeingHandler(bool enableSync):
         SMSG_BEING_CHANGE_LOOKS,
         SMSG_BEING_CHANGE_LOOKS2,
         SMSG_BEING_NAME_RESPONSE,
+        SMSG_BEING_CHANGE_DIRECTION,
         SMSG_PLAYER_UPDATE_1,
         SMSG_PLAYER_UPDATE_2,
         SMSG_PLAYER_MOVE,
@@ -414,6 +415,18 @@ void BeingHandler::handleMessage(MessageIn &msg)
             }
             break;
 
+        case SMSG_BEING_CHANGE_DIRECTION:
+            if (!(dstBeing = beingManager->findBeing(msg.readInt32())))
+            {
+                break;
+            }
+
+            msg.readInt16(); // unused
+
+            dstBeing->setDirection(msg.readInt8());
+
+            break;
+
         case SMSG_PLAYER_UPDATE_1:
         case SMSG_PLAYER_UPDATE_2:
         case SMSG_PLAYER_MOVE:
diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp
index a021c6d7..863765d5 100644
--- a/src/net/ea/partyhandler.cpp
+++ b/src/net/ea/partyhandler.cpp
@@ -225,6 +225,11 @@ void PartyHandler::invite(int playerId)
     outMsg.writeInt32(playerId);
 }
 
+void PartyHandler::invite(const std::string &name)
+{
+    // TODO
+}
+
 void PartyHandler::inviteResponse(bool accept)
 {
     MessageOut outMsg(CMSG_PARTY_INVITED);
diff --git a/src/net/ea/partyhandler.h b/src/net/ea/partyhandler.h
index df38bd6c..d156cdc1 100644
--- a/src/net/ea/partyhandler.h
+++ b/src/net/ea/partyhandler.h
@@ -41,6 +41,8 @@ class PartyHandler : public MessageHandler, public Net::PartyHandler
 
         void invite(int playerId);
 
+        void invite(const std::string &name);
+
         void inviteResponse(bool accept);
 
         void leave();
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp
index 8c9b6f5e..3b8b86af 100644
--- a/src/net/ea/playerhandler.cpp
+++ b/src/net/ea/playerhandler.cpp
@@ -491,7 +491,9 @@ void PlayerHandler::pickUp(FloorItem *floorItem)
 
 void PlayerHandler::setDirection(char direction)
 {
-    // TODO
+    MessageOut outMsg(CMSG_PLAYER_CHANGE_DIR);
+    outMsg.writeInt16(0);
+    outMsg.writeInt8(direction);
 }
 
 void PlayerHandler::setDestination(int x, int y, int direction)
diff --git a/src/net/ea/protocol.h b/src/net/ea/protocol.h
index 4dc7db36..a9028f7e 100644
--- a/src/net/ea/protocol.h
+++ b/src/net/ea/protocol.h
@@ -73,6 +73,7 @@ static const int STORAGE_OFFSET = 1;
 #define SMSG_BEING_ACTION            0x008a /**< Attack, sit, stand up, ... */
 #define SMSG_BEING_CHAT              0x008d /**< A being talks */
 #define SMSG_BEING_NAME_RESPONSE     0x0095 /**< Has to be requested */
+#define SMSG_BEING_CHANGE_DIRECTION  0x009c
 
 #define SMSG_NPC_MESSAGE             0x00b4
 #define SMSG_NPC_NEXT                0x00b5
@@ -147,6 +148,7 @@ static const int STORAGE_OFFSET = 1;
 #define CMSG_PLAYER_INVENTORY_DROP   0x00a2
 #define CMSG_PLAYER_EQUIP            0x00a9
 #define CMSG_PLAYER_UNEQUIP          0x00ab
+#define CMSG_PLAYER_CHANGE_DIR       0x009b
 
 #define CMSG_NPC_TALK                0x0090
 #define CMSG_NPC_NEXT_REQUEST        0x00b9
-- 
cgit v1.2.3-70-g09d2