diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/net/eathena/beingrecv.cpp | 17 | ||||
-rw-r--r-- | src/net/eathena/beingrecv.h | 1 | ||||
-rw-r--r-- | src/net/eathena/packetsin.inc | 4 |
3 files changed, 18 insertions, 4 deletions
diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp index 86786f1fa..c1dcdbd83 100644 --- a/src/net/eathena/beingrecv.cpp +++ b/src/net/eathena/beingrecv.cpp @@ -1066,10 +1066,10 @@ void BeingRecv::processBeingAction2(Net::MessageIn &msg) BLOCK_END("BeingRecv::processBeingAction2") } -void BeingRecv::processMonsterHp(Net::MessageIn &msg) +void BeingRecv::processBeingHp(Net::MessageIn &msg) { Being *const dstBeing = actorManager->findBeing( - msg.readBeingId("monster id")); + msg.readBeingId("being id")); int hp; int maxHP; if (msg.getVersion() >= 20100126) @@ -1089,6 +1089,19 @@ void BeingRecv::processMonsterHp(Net::MessageIn &msg) } } +void BeingRecv::processMonsterHp(Net::MessageIn &msg) +{ + Being *const dstBeing = actorManager->findBeing( + msg.readBeingId("monster id")); + const int hp = msg.readInt32("hp"); + const int maxHP = msg.readInt32("max hp"); + if (dstBeing) + { + dstBeing->setHP(hp); + dstBeing->setMaxHP(maxHP); + } +} + void BeingRecv::processSkillAutoCast(Net::MessageIn &msg) { const int id = msg.readInt16("skill id"); diff --git a/src/net/eathena/beingrecv.h b/src/net/eathena/beingrecv.h index c8f26d1fd..ea3e0bc2e 100644 --- a/src/net/eathena/beingrecv.h +++ b/src/net/eathena/beingrecv.h @@ -62,6 +62,7 @@ namespace EAthena void processBeingMove2(Net::MessageIn &msg); void processBeingAction2(Net::MessageIn &msg); void processMonsterHp(Net::MessageIn &msg); + void processBeingHp(Net::MessageIn &msg); void processSkillAutoCast(Net::MessageIn &msg); void processRanksList(Net::MessageIn &msg); void processBeingChangeDirection(Net::MessageIn &msg); diff --git a/src/net/eathena/packetsin.inc b/src/net/eathena/packetsin.inc index 34821a5b6..cc925ffec 100644 --- a/src/net/eathena/packetsin.inc +++ b/src/net/eathena/packetsin.inc @@ -46,7 +46,7 @@ packet(SMSG_BEING_VIEW_EQUIPMENT, 0x02d7, -1, &BeingRecv::processBeing packet(SMSG_BEING_MOVE, 0x007b, 60, &BeingRecv::processBeingMove, 1); packet(SMSG_PARTY_INVITED, 0x00fe, 30, &PartyRecv::processPartyInvited, 1); packet(SMSG_PARTY_SETTINGS, 0x0101, 6, &PartyRecv::processPartySettings, 1); -packet(SMSG_PLAYER_HP, 0x0106, 10, &BeingRecv::processMonsterHp, 1); +packet(SMSG_PLAYER_HP, 0x0106, 10, &BeingRecv::processBeingHp, 1); // fake packets for add packet name packet(SMSG_SELECT_CART, 0x0000, 0, nullptr, 0); @@ -580,7 +580,7 @@ if (packetVersion >= 20100105) } // 20100126 -packet(SMSG_PLAYER_HP, 0x080e, 14, &BeingRecv::processMonsterHp, 20100126); +packet(SMSG_PLAYER_HP, 0x080e, 14, &BeingRecv::processBeingHp, 20100126); // 20100223 packet(SMSG_TRADE_ITEM_ADD, 0x080f, 20, &TradeRecv::processTradeItemAdd, 20100223); |