From 2814eb1240ad6fc2da0e6c617c8fc5b7c4380f1e Mon Sep 17 00:00:00 2001
From: Andrei Karas <akaras@inbox.ru>
Date: Sun, 17 Jul 2016 20:23:55 +0300
Subject: Add packet SMSG_SKILL_CASTING2.

Change net packet version to 18.
---
 src/net/eathena/beingrecv.cpp | 40 ++++++++++++++++++++++++++++++++++++++++
 src/net/eathena/beingrecv.h   |  1 +
 src/net/eathena/network.h     |  2 +-
 src/net/eathena/packetsin.inc |  1 +
 4 files changed, 43 insertions(+), 1 deletion(-)

(limited to 'src/net')

diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp
index 3a1bcfb06..db3a61b4c 100644
--- a/src/net/eathena/beingrecv.cpp
+++ b/src/net/eathena/beingrecv.cpp
@@ -947,6 +947,46 @@ void BeingRecv::processSkillCasting(Net::MessageIn &msg)
     }
 }
 
+void BeingRecv::processSkillCasting2(Net::MessageIn &msg)
+{
+    msg.readInt16("len");  // for now unused
+    const BeingId srcId = msg.readBeingId("src id");
+    const BeingId dstId = msg.readBeingId("dst id");
+    const int dstX = msg.readInt16("dst x");
+    const int dstY = msg.readInt16("dst y");
+    const int skillId = msg.readInt16("skill id");
+    msg.readInt32("property");  // can be used to trigger effect
+    const int castTime = msg.readInt32("cast time");
+    msg.readInt32("skill range");
+
+    if (!effectManager)
+        return;
+
+    if (srcId == BeingId_zero)
+    {
+        UNIMPLIMENTEDPACKETFIELD(0);
+        return;
+    }
+    else if (dstId != BeingId_zero)
+    {   // being to being
+        Being *const srcBeing = actorManager->findBeing(srcId);
+        Being *const dstBeing = actorManager->findBeing(dstId);
+        if (srcBeing)
+            srcBeing->setAction(BeingAction::CAST, skillId);
+        skillDialog->playCastingSrcEffect(skillId, srcBeing);
+        skillDialog->playCastingDstEffect(skillId, dstBeing);
+    }
+    else if (dstX != 0 || dstY != 0)
+    {   // being to position
+        Being *const srcBeing = actorManager->findBeing(srcId);
+        if (srcBeing)
+            srcBeing->setAction(BeingAction::CAST, skillId);
+        skillDialog->playCastingDstTileEffect(skillId,
+            dstX, dstY,
+            castTime);
+    }
+}
+
 void BeingRecv::processBeingStatusChange(Net::MessageIn &msg)
 {
     BLOCK_START("BeingRecv::processBeingStatusChange")
diff --git a/src/net/eathena/beingrecv.h b/src/net/eathena/beingrecv.h
index 4e7d63e9f..0f2b6fab7 100644
--- a/src/net/eathena/beingrecv.h
+++ b/src/net/eathena/beingrecv.h
@@ -54,6 +54,7 @@ namespace EAthena
         void processMapTypeProperty(Net::MessageIn &msg);
         void processMapType(Net::MessageIn &msg);
         void processSkillCasting(Net::MessageIn &msg);
+        void processSkillCasting2(Net::MessageIn &msg);
         void processBeingStatusChange(Net::MessageIn &msg);
         void processBeingMove2(Net::MessageIn &msg);
         void processBeingAction2(Net::MessageIn &msg);
diff --git a/src/net/eathena/network.h b/src/net/eathena/network.h
index 7b737bdec..402e9b053 100644
--- a/src/net/eathena/network.h
+++ b/src/net/eathena/network.h
@@ -29,7 +29,7 @@
  * Protocol version, reported to the eAthena char and mapserver who can adjust
  * the protocol accordingly.
  */
-#define CLIENT_PROTOCOL_VERSION      17
+#define CLIENT_PROTOCOL_VERSION      18
 
 namespace EAthena
 {
diff --git a/src/net/eathena/packetsin.inc b/src/net/eathena/packetsin.inc
index 621da23c8..f5b9d5885 100644
--- a/src/net/eathena/packetsin.inc
+++ b/src/net/eathena/packetsin.inc
@@ -805,6 +805,7 @@ if (serverVersion > 0)
     packet(SMSG_MAP_SET_TILES_TYPE,        0x0b1b,  34, &Ea::MapRecv::processSetTilesType,              0);
     packet(SMSG_NPC_SKIN,                  0x0b1c,  -1, &NpcRecv::processNpcSkin,                       0);
     packet(SMSG_PLAYER_KILLED_BY,          0x0b1d,   6, &PlayerRecv::processKilledBy,                   0);
+    packet(SMSG_SKILL_CASTING2,            0x0b1e,  -1, &BeingRecv::processSkillCasting2,               0);
 
     // char server
     packet(SMSG_CHAR_PASSWORD_RESPONSE,    0x0062,   3, &LoginRecv::processCharPasswordResponse,        0);
-- 
cgit v1.2.3-70-g09d2