summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/net/ea/beinghandler.cpp91
-rw-r--r--src/net/ea/beinghandler.h2
-rw-r--r--src/net/eathena/beinghandler.cpp13
-rw-r--r--src/net/eathena/beinghandler.h2
-rw-r--r--src/net/eathena/protocol.h3
-rw-r--r--src/net/tmwa/beinghandler.cpp91
-rw-r--r--src/net/tmwa/beinghandler.h2
7 files changed, 105 insertions, 99 deletions
diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp
index 58e7c334c..54f13472e 100644
--- a/src/net/ea/beinghandler.cpp
+++ b/src/net/ea/beinghandler.cpp
@@ -166,6 +166,97 @@ void BeingHandler::processSkillDamage(Net::MessageIn &msg)
BLOCK_END("BeingHandler::processSkillDamage")
}
+void BeingHandler::processBeingAction(Net::MessageIn &msg)
+{
+ BLOCK_START("BeingHandler::processBeingAction")
+ if (!actorManager)
+ {
+ BLOCK_END("BeingHandler::processBeingAction")
+ return;
+ }
+
+ Being *const srcBeing = actorManager->findBeing(
+ msg.readInt32("src being id"));
+ Being *const dstBeing = actorManager->findBeing(
+ msg.readInt32("dst being id"));
+
+ msg.readInt32("tick");
+ const int srcSpeed = msg.readInt32("src speed");
+ msg.readInt32("dst speed");
+ const int param1 = msg.readInt16("param1");
+ msg.readInt16("param 2");
+ const uint8_t type = msg.readUInt8("type");
+ msg.readInt16("param 3");
+
+ switch (type)
+ {
+ case AttackType::HIT: // Damage
+ case AttackType::CRITICAL: // Critical Damage
+ case AttackType::MULTI: // Critical Damage
+ case AttackType::REFLECT: // Reflected Damage
+ case AttackType::FLEE: // Lucky Dodge
+ if (srcBeing)
+ {
+ if (srcSpeed && srcBeing->getType() == ActorType::Player)
+ srcBeing->setAttackDelay(srcSpeed);
+ // attackid=1, type
+ srcBeing->handleAttack(dstBeing, param1, 1);
+ if (srcBeing->getType() == ActorType::Player)
+ srcBeing->setAttackTime();
+ }
+ if (dstBeing)
+ {
+ dstBeing->takeDamage(srcBeing, param1,
+ static_cast<AttackType::Type>(type));
+ }
+ break;
+
+ case 0x01: // dead or pickup?
+ break;
+ // tmw server can send here garbage?
+// if (srcBeing)
+// srcBeing->setAction(BeingAction::DEAD, 0);
+
+ case 0x02: // Sit
+ if (srcBeing)
+ {
+ srcBeing->setAction(BeingAction::SIT, 0);
+ if (srcBeing->getType() == ActorType::Player)
+ {
+ srcBeing->setMoveTime();
+ if (localPlayer)
+ localPlayer->imitateAction(srcBeing, BeingAction::SIT);
+ }
+ }
+ break;
+
+ case 0x03: // Stand up
+ if (srcBeing)
+ {
+ srcBeing->setAction(BeingAction::STAND, 0);
+ if (srcBeing->getType() == ActorType::Player)
+ {
+ srcBeing->setMoveTime();
+ if (localPlayer)
+ {
+ localPlayer->imitateAction(srcBeing,
+ BeingAction::STAND);
+ }
+ }
+ }
+ break;
+ default:
+ logger->log("QQQ1 SMSG_BEING_ACTION:");
+ if (srcBeing)
+ logger->log("srcBeing:" + toString(srcBeing->getId()));
+ if (dstBeing)
+ logger->log("dstBeing:" + toString(dstBeing->getId()));
+ logger->log("type: " + toString(type));
+ break;
+ }
+ BLOCK_END("BeingHandler::processBeingAction")
+}
+
void BeingHandler::processBeingEmotion(Net::MessageIn &msg)
{
BLOCK_START("BeingHandler::processBeingEmotion")
diff --git a/src/net/ea/beinghandler.h b/src/net/ea/beinghandler.h
index 5b43bbf32..f9d787e72 100644
--- a/src/net/ea/beinghandler.h
+++ b/src/net/ea/beinghandler.h
@@ -50,6 +50,8 @@ class BeingHandler notfinal : public Net::BeingHandler
static void processSkillDamage(Net::MessageIn &msg);
+ static void processBeingAction(Net::MessageIn &msg);
+
static void processBeingEmotion(Net::MessageIn &msg);
static void processNameResponse(Net::MessageIn &msg);
diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp
index 74dabe61a..d6ede2d36 100644
--- a/src/net/eathena/beinghandler.cpp
+++ b/src/net/eathena/beinghandler.cpp
@@ -77,6 +77,7 @@ BeingHandler::BeingHandler(const bool enableSync) :
SMSG_BEING_REMOVE_SKILL,
SMSG_SKILL_DAMAGE,
SMSG_BEING_ACTION,
+ SMSG_BEING_ACTION2,
SMSG_BEING_SELFEFFECT,
SMSG_BEING_SPECIAL_EFFECT,
SMSG_BEING_SPECIAL_EFFECT_NUM,
@@ -190,6 +191,10 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
processBeingAction(msg);
break;
+ case SMSG_BEING_ACTION2:
+ processBeingAction2(msg);
+ break;
+
case SMSG_BEING_SELFEFFECT:
processBeingSelfEffect(msg);
break;
@@ -1236,12 +1241,12 @@ void BeingHandler::processBeingMove2(Net::MessageIn &msg)
BLOCK_END("BeingHandler::processBeingMove2")
}
-void BeingHandler::processBeingAction(Net::MessageIn &msg)
+void BeingHandler::processBeingAction2(Net::MessageIn &msg)
{
- BLOCK_START("BeingHandler::processBeingAction")
+ BLOCK_START("BeingHandler::processBeingAction2")
if (!actorManager)
{
- BLOCK_END("BeingHandler::processBeingAction")
+ BLOCK_END("BeingHandler::processBeingAction2")
return;
}
@@ -1328,7 +1333,7 @@ void BeingHandler::processBeingAction(Net::MessageIn &msg)
logger->log("type: " + toString(type));
break;
}
- BLOCK_END("BeingHandler::processBeingAction")
+ BLOCK_END("BeingHandler::processBeingAction2")
}
void BeingHandler::processMonsterHp(Net::MessageIn &msg)
diff --git a/src/net/eathena/beinghandler.h b/src/net/eathena/beinghandler.h
index 6acafb931..78f12af80 100644
--- a/src/net/eathena/beinghandler.h
+++ b/src/net/eathena/beinghandler.h
@@ -71,7 +71,7 @@ class BeingHandler final : public MessageHandler, public Ea::BeingHandler
static void processBeingMove2(Net::MessageIn &msg);
- static void processBeingAction(Net::MessageIn &msg);
+ static void processBeingAction2(Net::MessageIn &msg);
static void processMonsterHp(Net::MessageIn &msg);
diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h
index 2cc614d3b..b8667be22 100644
--- a/src/net/eathena/protocol.h
+++ b/src/net/eathena/protocol.h
@@ -151,7 +151,8 @@
#define SMSG_BEING_SPECIAL_EFFECT_NUM 0x0284
#define SMSG_BEING_SOUND_EFFECT 0x01d3
#define SMSG_BEING_EMOTION 0x00c0
-#define SMSG_BEING_ACTION 0x02e1
+#define SMSG_BEING_ACTION 0x008a /**< Attack, sit, stand up, ... */
+#define SMSG_BEING_ACTION2 0x02e1
#define SMSG_BEING_CHAT 0x008d /**< A being talks */
#define SMSG_BEING_SLIDE 0x01ff
#define SMSG_BEING_CHARM 0x08cf
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index 0f9373d01..33c1db769 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -1619,95 +1619,4 @@ void BeingHandler::processIpResponse(Net::MessageIn &msg)
BLOCK_END("BeingHandler::processIpResponse")
}
-void BeingHandler::processBeingAction(Net::MessageIn &msg)
-{
- BLOCK_START("BeingHandler::processBeingAction")
- if (!actorManager)
- {
- BLOCK_END("BeingHandler::processBeingAction")
- return;
- }
-
- Being *const srcBeing = actorManager->findBeing(
- msg.readInt32("src being id"));
- Being *const dstBeing = actorManager->findBeing(
- msg.readInt32("dst being id"));
-
- msg.readInt32("tick");
- const int srcSpeed = msg.readInt32("src speed");
- msg.readInt32("dst speed");
- const int param1 = msg.readInt16("param1");
- msg.readInt16("param 2");
- const uint8_t type = msg.readUInt8("type");
- msg.readInt16("param 3");
-
- switch (type)
- {
- case AttackType::HIT: // Damage
- case AttackType::CRITICAL: // Critical Damage
- case AttackType::MULTI: // Critical Damage
- case AttackType::REFLECT: // Reflected Damage
- case AttackType::FLEE: // Lucky Dodge
- if (srcBeing)
- {
- if (srcSpeed && srcBeing->getType() == ActorType::Player)
- srcBeing->setAttackDelay(srcSpeed);
- // attackid=1, type
- srcBeing->handleAttack(dstBeing, param1, 1);
- if (srcBeing->getType() == ActorType::Player)
- srcBeing->setAttackTime();
- }
- if (dstBeing)
- {
- dstBeing->takeDamage(srcBeing, param1,
- static_cast<AttackType::Type>(type));
- }
- break;
-
- case 0x01: // dead or pickup?
- break;
- // tmw server can send here garbage?
-// if (srcBeing)
-// srcBeing->setAction(BeingAction::DEAD, 0);
-
- case 0x02: // Sit
- if (srcBeing)
- {
- srcBeing->setAction(BeingAction::SIT, 0);
- if (srcBeing->getType() == ActorType::Player)
- {
- srcBeing->setMoveTime();
- if (localPlayer)
- localPlayer->imitateAction(srcBeing, BeingAction::SIT);
- }
- }
- break;
-
- case 0x03: // Stand up
- if (srcBeing)
- {
- srcBeing->setAction(BeingAction::STAND, 0);
- if (srcBeing->getType() == ActorType::Player)
- {
- srcBeing->setMoveTime();
- if (localPlayer)
- {
- localPlayer->imitateAction(srcBeing,
- BeingAction::STAND);
- }
- }
- }
- break;
- default:
- logger->log("QQQ1 SMSG_BEING_ACTION:");
- if (srcBeing)
- logger->log("srcBeing:" + toString(srcBeing->getId()));
- if (dstBeing)
- logger->log("dstBeing:" + toString(dstBeing->getId()));
- logger->log("type: " + toString(type));
- break;
- }
- BLOCK_END("BeingHandler::processBeingAction")
-}
-
} // namespace TmwAthena
diff --git a/src/net/tmwa/beinghandler.h b/src/net/tmwa/beinghandler.h
index 4ce315446..f2117e2bc 100644
--- a/src/net/tmwa/beinghandler.h
+++ b/src/net/tmwa/beinghandler.h
@@ -94,8 +94,6 @@ class BeingHandler final : public MessageHandler, public Ea::BeingHandler
static void processSkillCastCancel(Net::MessageIn &msg);
static void processIpResponse(Net::MessageIn &msg);
-
- static void processBeingAction(Net::MessageIn &msg);
};
} // namespace TmwAthena