summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-04-02 19:34:24 +0300
committerAndrei Karas <akaras@inbox.ru>2016-04-02 19:34:51 +0300
commit9a3120e7c3d89c3d35d5032114b387e49d462154 (patch)
treed5e516b5f5b3e23071e10c957ee228d470d890a2
parent568c267f26da3e4b183c0190dd048102f4d933c9 (diff)
downloadplus-9a3120e7c3d89c3d35d5032114b387e49d462154.tar.gz
plus-9a3120e7c3d89c3d35d5032114b387e49d462154.tar.bz2
plus-9a3120e7c3d89c3d35d5032114b387e49d462154.tar.xz
plus-9a3120e7c3d89c3d35d5032114b387e49d462154.zip
Sort more packets. Add version checks inside packets.
-rw-r--r--src/net/ea/beingrecv.cpp28
-rw-r--r--src/net/ea/beingrecv.h1
-rw-r--r--src/net/eathena/beingrecv.cpp32
-rw-r--r--src/net/eathena/beingrecv.h1
-rw-r--r--src/net/eathena/packetsin.inc11
-rw-r--r--src/net/tmwa/beingrecv.cpp28
-rw-r--r--src/net/tmwa/beingrecv.h1
-rw-r--r--src/net/tmwa/packetsin.inc2
8 files changed, 70 insertions, 34 deletions
diff --git a/src/net/ea/beingrecv.cpp b/src/net/ea/beingrecv.cpp
index 9796af9ce..fa1f47c69 100644
--- a/src/net/ea/beingrecv.cpp
+++ b/src/net/ea/beingrecv.cpp
@@ -144,34 +144,6 @@ void BeingRecv::processBeingRemove(Net::MessageIn &msg)
BLOCK_END("BeingRecv::processBeingRemove")
}
-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::processBeingAction(Net::MessageIn &msg)
{
BLOCK_START("BeingRecv::processBeingAction")
diff --git a/src/net/ea/beingrecv.h b/src/net/ea/beingrecv.h
index d3b6a642d..9c98ba12e 100644
--- a/src/net/ea/beingrecv.h
+++ b/src/net/ea/beingrecv.h
@@ -43,7 +43,6 @@ namespace Ea
extern BeingId mSpawnId;
void processBeingRemove(Net::MessageIn &msg);
- void processSkillDamage(Net::MessageIn &msg);
void processBeingAction(Net::MessageIn &msg);
void processBeingEmotion(Net::MessageIn &msg);
void processNameResponse(Net::MessageIn &msg);
diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp
index 7eaf601e3..057617a1c 100644
--- a/src/net/eathena/beingrecv.cpp
+++ b/src/net/eathena/beingrecv.cpp
@@ -1761,6 +1761,38 @@ void BeingRecv::processGraffiti(Net::MessageIn &msg)
dstBeing->setCreatorId(creatorId);
}
+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");
+ int param1;
+ if (msg.getVersion() >= 3)
+ param1 = msg.readInt32("damage");
+ else
+ param1 = msg.readInt16("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::applyPlayerAction(Net::MessageIn &msg,
Being *const being,
const uint8_t type)
diff --git a/src/net/eathena/beingrecv.h b/src/net/eathena/beingrecv.h
index 4932232ba..c8f26d1fd 100644
--- a/src/net/eathena/beingrecv.h
+++ b/src/net/eathena/beingrecv.h
@@ -110,6 +110,7 @@ namespace EAthena
void processSkillCancel(Net::MessageIn &msg);
void processSolveCharName(Net::MessageIn &msg);
void processGraffiti(Net::MessageIn &msg);
+ void processSkillDamage(Net::MessageIn &msg);
Being *createBeing2(Net::MessageIn &msg,
const BeingId id,
const int16_t job,
diff --git a/src/net/eathena/packetsin.inc b/src/net/eathena/packetsin.inc
index 7f128eca2..0816a976f 100644
--- a/src/net/eathena/packetsin.inc
+++ b/src/net/eathena/packetsin.inc
@@ -28,9 +28,14 @@ packet(SMSG_PLAYER_STATUS_CHANGE, 0x0119, 13, &BeingRecv::processPlaye
packet(SMSG_PLAYER_STORAGE_ADD, 0x00f4, 21, &InventoryRecv::processPlayerStorageAdd, 1);
packet(SMSG_QUEST_LIST, 0x02b1, -1, &QuestRecv::processAddQuests, 1);
packet(SMSG_SKILL_CASTING, 0x013e, 24, &BeingRecv::processSkillCasting, 1);
+packet(SMSG_SKILL_DAMAGE, 0x0114, 31, &BeingRecv::processSkillDamage, 1);
// 3
-packet(SMSG_PLAYER_INVENTORY_USE, 0x01c8, 13, &Ea::InventoryRecv::processPlayerInventoryUse, 3);
+if (packetVersion >= 3)
+{
+ packet(SMSG_PLAYER_INVENTORY_USE, 0x01c8, 13, &Ea::InventoryRecv::processPlayerInventoryUse, 3);
+ packet(SMSG_SKILL_DAMAGE, 0x01de, 33, &BeingRecv::processSkillDamage, 3);
+}
// 4
packet(SMSG_BEING_CHANGE_LOOKS2, 0x01d7, 11, &BeingRecv::processBeingChangeLook2, 4);
@@ -578,11 +583,9 @@ packet(SMSG_SCRIPT_MESSAGE, 0x08b3, -1, &ChatRecv::processScript
packet(SMSG_SERVER_PING, 0x007f, 6, &GameRecv::processServerTick, 0);
packet(SMSG_SKILL_ARROW_CREATE_LIST, 0x01ad, -1, &SkillRecv::processSkillArrowCreateList, 0);
packet(SMSG_SKILL_AUTO_CAST, 0x0147, 39, &BeingRecv::processSkillAutoCast, 0);
+packet(SMSG_SKILL_CAST_CANCEL, 0x01b9, 6, &BeingRecv::processSkillCancel, 0);
// 20150000 or near
-packet(SMSG_SKILL_CAST_CANCEL, 0x01b9, 6, &BeingRecv::processSkillCancel, 0);
-packet(SMSG_SKILL_DAMAGE, 0x01de, 33, &Ea::BeingRecv::processSkillDamage, 0);
-packet(SMSG_SKILL_DAMAGE_OUTDATED, 0x0114, 31, nullptr, 0);
packet(SMSG_SKILL_DEVOTION_EFFECT, 0x01cf, 28, &SkillRecv::processSkillDevotionEffect, 0);
packet(SMSG_SKILL_ENTRY, 0x09ca, -1, &BeingRecv::processSkillEntry, 0);
packet(SMSG_SKILL_FAILED, 0x0110, 10, &SkillRecv::processSkillFailed, 0);
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);