Kinglykrab a5348e207b
[Commands] Add #sethp Command. (#1840)
- Add #sethp [Health] command to set an NPC or player's health to a specified amount, or to max if the amount is greater than their max.
- Cleanup #heal command message and logic.
2021-11-27 19:08:00 -05:00

30 lines
421 B
C++
Executable File

#include "../client.h"
void command_heal(Client *c, const Seperator *sep)
{
Mob* target = c;
if (c->GetTarget()) {
target = c->GetTarget();
}
target->Heal();
c->Message(
Chat::White,
fmt::format(
"Set {} to full Health ({}).",
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
),
target->GetMaxHP()
).c_str()
);
}