From 9a3120e7c3d89c3d35d5032114b387e49d462154 Mon Sep 17 00:00:00 2001
From: Andrei Karas <akaras@inbox.ru>
Date: Sat, 2 Apr 2016 19:34:24 +0300
Subject: Sort more packets. Add version checks inside packets.

---
 src/net/tmwa/beingrecv.cpp | 28 ++++++++++++++++++++++++++++
 src/net/tmwa/beingrecv.h   |  1 +
 src/net/tmwa/packetsin.inc |  2 +-
 3 files changed, 30 insertions(+), 1 deletion(-)

(limited to 'src/net/tmwa')

diff --git a/src/net/tmwa/beingrecv.cpp b/src/net/tmwa/beingrecv.cpp
index d02e18393..f627616f6 100644
--- a/src/net/tmwa/beingrecv.cpp
+++ b/src/net/tmwa/beingrecv.cpp
@@ -1364,6 +1364,34 @@ void BeingRecv::applyPlayerAction(Net::MessageIn &msg,
     }
 }
 
+void BeingRecv::processSkillDamage(Net::MessageIn &msg)
+{
+    BLOCK_START("BeingRecv::processSkillDamage")
+    if (!actorManager)
+    {
+        BLOCK_END("BeingRecv::processSkillDamage")
+        return;
+    }
+
+    const int id = msg.readInt16("skill id");
+    Being *const srcBeing = actorManager->findBeing(
+        msg.readBeingId("src being id"));
+    Being *const dstBeing = actorManager->findBeing(
+        msg.readBeingId("dst being id"));
+    msg.readInt32("tick");
+    msg.readInt32("src speed");
+    msg.readInt32("dst speed");
+    const int param1 = msg.readInt32("damage");
+    const int level = msg.readInt16("skill level");
+    msg.readInt16("div");
+    msg.readUInt8("skill hit/type?");
+    if (srcBeing)
+        srcBeing->handleSkill(dstBeing, param1, id, level);
+    if (dstBeing)
+        dstBeing->takeDamage(srcBeing, param1, AttackType::SKILL, id, level);
+    BLOCK_END("BeingRecv::processSkillDamage")
+}
+
 void BeingRecv::setServerGender(Being *const being,
                                 const uint8_t gender)
 {
diff --git a/src/net/tmwa/beingrecv.h b/src/net/tmwa/beingrecv.h
index 437035562..dce980da5 100644
--- a/src/net/tmwa/beingrecv.h
+++ b/src/net/tmwa/beingrecv.h
@@ -70,6 +70,7 @@ namespace TmwAthena
         void processSkillCastCancel(Net::MessageIn &msg);
         void processIpResponse(Net::MessageIn &msg);
         void processPvpSet(Net::MessageIn &msg);
+        void processSkillDamage(Net::MessageIn &msg);
         void applyPlayerAction(Net::MessageIn &msg,
                                Being *const being,
                                const uint8_t type);
diff --git a/src/net/tmwa/packetsin.inc b/src/net/tmwa/packetsin.inc
index 08eaa4ce5..ab0ae1255 100644
--- a/src/net/tmwa/packetsin.inc
+++ b/src/net/tmwa/packetsin.inc
@@ -152,7 +152,7 @@ packet(SMSG_SERVER_PING,                   0x007f,   6, nullptr,
 packet(SMSG_SERVER_VERSION_RESPONSE,       0x7531,  10, &LoginRecv::processServerVersion,               0);
 packet(SMSG_SKILL_CASTING,                 0x013e,  24, &BeingRecv::processSkillCasting,                0);
 packet(SMSG_SKILL_CAST_CANCEL,             0x01b9,   6, &BeingRecv::processSkillCastCancel,             0);
-packet(SMSG_SKILL_DAMAGE,                  0x01de,  33, &Ea::BeingRecv::processSkillDamage,             0);
+packet(SMSG_SKILL_DAMAGE,                  0x01de,  33, &BeingRecv::processSkillDamage,                 0);
 packet(SMSG_SKILL_FAILED,                  0x0110,  10, &SkillRecv::processSkillFailed,                 0);
 packet(SMSG_SKILL_NO_DAMAGE,               0x011a,  15, &Ea::BeingRecv::processSkillNoDamage,           0);
 packet(SMSG_SOLVE_CHAR_NAME,               0x0194,  30, nullptr,                                        0);
-- 
cgit v1.2.3-70-g09d2