diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-05 23:55:37 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-06 01:18:58 +0300 |
commit | 298e63668f6fc6944dde59dd82bc99cb8199887c (patch) | |
tree | f4d54e8c600b717f0b2952e48fc47bd3d77e815e /src/net | |
parent | 6207b391b9f7d58148572fc2e58a858d993ca525 (diff) | |
download | plus-298e63668f6fc6944dde59dd82bc99cb8199887c.tar.gz plus-298e63668f6fc6944dde59dd82bc99cb8199887c.tar.bz2 plus-298e63668f6fc6944dde59dd82bc99cb8199887c.tar.xz plus-298e63668f6fc6944dde59dd82bc99cb8199887c.zip |
eathena: add packet SMSG_BEING_ACTION2 0x02e1.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/eathena/beinghandler.cpp | 96 | ||||
-rw-r--r-- | src/net/eathena/beinghandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/packets.h | 2 | ||||
-rw-r--r-- | src/net/eathena/protocol.h | 1 |
4 files changed, 100 insertions, 1 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 diff --git a/src/net/eathena/beinghandler.h b/src/net/eathena/beinghandler.h index 8838c007f..d3744ba78 100644 --- a/src/net/eathena/beinghandler.h +++ b/src/net/eathena/beinghandler.h @@ -59,6 +59,8 @@ class BeingHandler final : public MessageHandler, public Ea::BeingHandler void processBeingStatusChange(Net::MessageIn &msg) const; void processBeingMove2(Net::MessageIn &msg) const; + + void processBeingAction2(Net::MessageIn &msg) const; }; } // namespace EAthena diff --git a/src/net/eathena/packets.h b/src/net/eathena/packets.h index 00ec7628d..b84468d27 100644 --- a/src/net/eathena/packets.h +++ b/src/net/eathena/packets.h @@ -100,7 +100,7 @@ int16_t packet_lengths[] = // #0x02C0 0, -1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, + 0, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0 1 2 3 4 5 6 7 8 9 a b c d e f //0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index 5566ba125..d3426f19c 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -97,6 +97,7 @@ #define SMSG_BEING_SELFEFFECT 0x019b #define SMSG_BEING_EMOTION 0x00c0 #define SMSG_BEING_ACTION 0x008a /**< Attack, sit, stand up, ... */ +#define SMSG_BEING_ACTION2 0x02e1 #define SMSG_BEING_CHAT 0x008d /**< A being talks */ #define SMSG_COLOR_MESSAGE 0x02c1 #define SMSG_BEING_NAME_RESPONSE 0x0095 /**< Has to be requested */ |