eqemu-server/zone/gm_commands/endurance.cpp
Kinglykrab 225497337c
[Commands] Add #setendurance Command. (#1841)
- Add #setendurance [Endurance] command to set an NPC or player's endurance to a specified amount, or to max if the amount is greater than their max.
- Cleanup #endurance command message and logic.
2021-11-27 19:08:07 -05:00

37 lines
646 B
C++
Executable File

#include "../client.h"
void command_endurance(Client *c, const Seperator *sep)
{
Mob* target = c;
if (c->GetTarget()) {
target = c->GetTarget();
}
int endurance = 0;
if (target->IsClient()) {
endurance = target->CastToClient()->GetMaxEndurance();
target->CastToClient()->SetEndurance(endurance);
} else {
endurance = target->GetMaxEndurance();
target->SetEndurance(endurance);
}
c->Message(
Chat::White,
fmt::format(
"Set {} to full Endurance ({}).",
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
),
endurance
).c_str()
);
}