diff options
-rw-r--r-- | src/being/localplayer.cpp | 18 | ||||
-rw-r--r-- | src/being/localplayer.h | 4 | ||||
-rw-r--r-- | src/net/eathena/playerhandler.cpp | 15 |
3 files changed, 31 insertions, 6 deletions
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 9da05d898..dd06b87a1 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -1094,6 +1094,24 @@ void LocalPlayer::addXpMessage(const int change) } } +void LocalPlayer::addHpMessage(const int change) +{ + if (change != 0 && mMessages.size() < 20) + { + // TRANSLATORS: get hp message + addMessageToQueue(strprintf("%d %s", change, _("hp"))); + } +} + +void LocalPlayer::addSpMessage(const int change) +{ + if (change != 0 && mMessages.size() < 20) + { + // TRANSLATORS: get hp message + addMessageToQueue(strprintf("%d %s", change, _("mana"))); + } +} + void LocalPlayer::statChanged(const int id, const int oldVal1, const int oldVal2) diff --git a/src/being/localplayer.h b/src/being/localplayer.h index a0865baa9..02c092f69 100644 --- a/src/being/localplayer.h +++ b/src/being/localplayer.h @@ -370,6 +370,10 @@ class LocalPlayer final : public Being, void addJobMessage(const int change); + void addHpMessage(const int change); + + void addSpMessage(const int change); + static bool checAttackPermissions(const Being *const target) A_WARN_UNUSED; diff --git a/src/net/eathena/playerhandler.cpp b/src/net/eathena/playerhandler.cpp index c2f3e7ee1..23990ee2d 100644 --- a/src/net/eathena/playerhandler.cpp +++ b/src/net/eathena/playerhandler.cpp @@ -545,12 +545,15 @@ void PlayerHandler::setViewEquipment(const bool allow) const void PlayerHandler::processPlayerHeal(Net::MessageIn &msg) { - UNIMPLIMENTEDPACKET; - // +++ probably need show effect or adjust hp/sp? - // 5 - hp - // 7 - sp - msg.readInt16("var id"); - msg.readInt16("value"); + if (!localPlayer) + return; + + const int type = msg.readInt16("var id"); + const int amount = msg.readInt16("value"); + if (type == 5) + localPlayer->addHpMessage(amount); + else if (type == 7) + localPlayer->addSpMessage(amount); } void PlayerHandler::processPlayerSkillMessage(Net::MessageIn &msg) |