From 1ec5a1847a7c226d6dfee2a5d46c121a9a037161 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 6 Sep 2014 00:09:11 +0300 Subject: eathena: add packet SMSG_MONSTER_HP 0x0977. --- src/net/eathena/beinghandler.cpp | 17 +++++++++++++++++ src/net/eathena/beinghandler.h | 2 ++ src/net/eathena/packets.h | 2 +- src/net/eathena/protocol.h | 1 + 4 files changed, 21 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp index b856bc575..baaa3eccc 100644 --- a/src/net/eathena/beinghandler.cpp +++ b/src/net/eathena/beinghandler.cpp @@ -221,6 +221,10 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) processMapTypeProperty(msg); break; + case SMSG_MONSTER_HP: + processMonsterHp(msg); + break; + default: break; } @@ -1047,4 +1051,17 @@ void BeingHandler::processBeingAction2(Net::MessageIn &msg) const BLOCK_END("BeingHandler::processBeingAction") } +void BeingHandler::processMonsterHp(Net::MessageIn &msg) const +{ + Being *const dstBeing = actorManager->findBeing( + msg.readInt32("monster id")); + const int hp = msg.readInt32("hp"); + const int maxHP = msg.readInt32("max hp"); + if (dstBeing) + { + dstBeing->setHP(hp); + dstBeing->setMaxHP(maxHP); + } +} + } // namespace EAthena diff --git a/src/net/eathena/beinghandler.h b/src/net/eathena/beinghandler.h index d3744ba78..2d4afd0d9 100644 --- a/src/net/eathena/beinghandler.h +++ b/src/net/eathena/beinghandler.h @@ -61,6 +61,8 @@ class BeingHandler final : public MessageHandler, public Ea::BeingHandler void processBeingMove2(Net::MessageIn &msg) const; void processBeingAction2(Net::MessageIn &msg) const; + + void processMonsterHp(Net::MessageIn &msg) const; }; } // namespace EAthena diff --git a/src/net/eathena/packets.h b/src/net/eathena/packets.h index b84468d27..6775691f1 100644 --- a/src/net/eathena/packets.h +++ b/src/net/eathena/packets.h @@ -245,7 +245,7 @@ int16_t packet_lengths[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 31, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, // #0x0980 0, 0, 0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, -1, -1, 0, 0, 0, 0, 0, 0, 11, 9, 8, 0, 0, 0, 0, diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index d3426f19c..aa1ed94c2 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -192,6 +192,7 @@ #define SMSG_QUEST_REMOVE 0x02b4 #define SMSG_MVP 0x010c +#define SMSG_MONSTER_HP 0x0977 /********************************** * Packets from client to server * -- cgit v1.2.3-70-g09d2