mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 13:16:39 +00:00
[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.
This commit is contained in:
@@ -2,26 +2,35 @@
|
||||
|
||||
void command_endurance(Client *c, const Seperator *sep)
|
||||
{
|
||||
auto target = c->GetTarget() ? c->GetTarget() : c;
|
||||
if (target->IsClient()) {
|
||||
target->CastToClient()->SetEndurance(target->CastToClient()->GetMaxEndurance());
|
||||
}
|
||||
else {
|
||||
target->SetEndurance(target->GetMaxEndurance());
|
||||
Mob* target = c;
|
||||
if (c->GetTarget()) {
|
||||
target = c->GetTarget();
|
||||
}
|
||||
|
||||
if (c != target) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Set {} ({}) to full Endurance.",
|
||||
target->GetCleanName(),
|
||||
target->GetID()
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
else {
|
||||
c->Message(Chat::White, "Restored your Endurance to full.");
|
||||
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()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user