diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-04-03 19:50:26 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-04-03 19:50:26 +0300 |
commit | f26d3df5feef535d3eede09f581a5cbc08cae2a1 (patch) | |
tree | 79a7776b5d22fd34a1f7e105a941a22de9ef9176 /src/net | |
parent | 74e3ec3edcae04931238c2e6be93c60c087571e9 (diff) | |
download | plus-f26d3df5feef535d3eede09f581a5cbc08cae2a1.tar.gz plus-f26d3df5feef535d3eede09f581a5cbc08cae2a1.tar.bz2 plus-f26d3df5feef535d3eede09f581a5cbc08cae2a1.tar.xz plus-f26d3df5feef535d3eede09f581a5cbc08cae2a1.zip |
Separate being and monster hp packets.
Diffstat (limited to 'src/net')
-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); |