summaryrefslogtreecommitdiff
path: root/src/net/eathena/beinghandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-05 23:55:37 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-06 01:18:58 +0300
commit298e63668f6fc6944dde59dd82bc99cb8199887c (patch)
treef4d54e8c600b717f0b2952e48fc47bd3d77e815e /src/net/eathena/beinghandler.cpp
parent6207b391b9f7d58148572fc2e58a858d993ca525 (diff)
downloadmanaplus-298e63668f6fc6944dde59dd82bc99cb8199887c.tar.gz
manaplus-298e63668f6fc6944dde59dd82bc99cb8199887c.tar.bz2
manaplus-298e63668f6fc6944dde59dd82bc99cb8199887c.tar.xz
manaplus-298e63668f6fc6944dde59dd82bc99cb8199887c.zip
eathena: add packet SMSG_BEING_ACTION2 0x02e1.
Diffstat (limited to 'src/net/eathena/beinghandler.cpp')
-rw-r--r--src/net/eathena/beinghandler.cpp96
1 files changed, 96 insertions, 0 deletions
diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp
index d87455c81..b856bc575 100644
--- a/src/net/eathena/beinghandler.cpp
+++ b/src/net/eathena/beinghandler.cpp
@@ -67,6 +67,7 @@ BeingHandler::BeingHandler(const bool enableSync) :
SMSG_BEING_REMOVE,
SMSG_SKILL_DAMAGE,
SMSG_BEING_ACTION,
+ SMSG_BEING_ACTION2,
SMSG_BEING_SELFEFFECT,
SMSG_BEING_EMOTION,
SMSG_BEING_CHANGE_LOOKS,
@@ -134,6 +135,10 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
processBeingAction(msg);
break;
+ case SMSG_BEING_ACTION2:
+ processBeingAction2(msg);
+ break;
+
case SMSG_BEING_SELFEFFECT:
processBeingSelfEffect(msg);
break;
@@ -951,4 +956,95 @@ void BeingHandler::processBeingMove2(Net::MessageIn &msg) const
BLOCK_END("BeingHandler::processBeingMove2")
}
+void BeingHandler::processBeingAction2(Net::MessageIn &msg) const
+{
+ 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.readInt32("damage");
+ msg.readInt16("count");
+ const uint8_t type = msg.readUInt8("action");
+ msg.readInt32("left damage");
+
+ switch (type)
+ {
+ case Being::HIT: // Damage
+ case Being::CRITICAL: // Critical Damage
+ case Being::MULTI: // Critical Damage
+ case Being::REFLECT: // Reflected Damage
+ case Being::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<Being::AttackType>(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 EAthena