diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-03-08 20:24:01 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-03-08 20:24:01 +0300 |
commit | 850c4e74f8c5daf218beaa4f948df2c9c8ded42e (patch) | |
tree | 1d16962f5f26f6569a70d5d118ac7cd72edf5125 | |
parent | 91e4a003fdcaa21e7d375d3eaf92ea9f6166b841 (diff) | |
download | manaplus-850c4e74f8c5daf218beaa4f948df2c9c8ded42e.tar.gz manaplus-850c4e74f8c5daf218beaa4f948df2c9c8ded42e.tar.bz2 manaplus-850c4e74f8c5daf218beaa4f948df2c9c8ded42e.tar.xz manaplus-850c4e74f8c5daf218beaa4f948df2c9c8ded42e.zip |
Fix packet SMSG_PLAYER_HEAL. Now it also update hp/sp.
-rw-r--r-- | src/net/eathena/playerrecv.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/net/eathena/playerrecv.cpp b/src/net/eathena/playerrecv.cpp index af35c2248..e9dbeb74d 100644 --- a/src/net/eathena/playerrecv.cpp +++ b/src/net/eathena/playerrecv.cpp @@ -24,6 +24,7 @@ #include "configuration.h" #include "notifymanager.h" +#include "party.h" #include "being/beingflag.h" #include "being/localplayer.h" @@ -40,6 +41,8 @@ #include "net/messagein.h" +#include "net/ea/eaprotocol.h" + #include "debug.h" namespace EAthena @@ -231,10 +234,26 @@ void PlayerRecv::processPlayerHeal(Net::MessageIn &msg) const int type = msg.readInt16("var id"); const int amount = msg.readInt16("value"); - if (type == 5) + if (type == Ea::HP) + { + const int base = PlayerInfo::getAttribute(Attributes::HP) + amount; + PlayerInfo::setAttribute(Attributes::HP, base); + if (localPlayer->isInParty() && Party::getParty(1)) + { + PartyMember *const m = Party::getParty(1) + ->getMember(localPlayer->getId()); + if (m) + { + m->setHp(base); + m->setMaxHp(PlayerInfo::getAttribute(Attributes::MAX_HP)); + } + } localPlayer->addHpMessage(amount); - else if (type == 7) + } + else if (type == Ea::MP) + { localPlayer->addSpMessage(amount); + } } void PlayerRecv::processPlayerSkillMessage(Net::MessageIn &msg) |