From fb8539e679d0b34c016cf42872e9fb9acc7248b0 Mon Sep 17 00:00:00 2001 From: Kinglykrab <89047260+Kinglykrab@users.noreply.github.com> Date: Fri, 12 Nov 2021 08:11:45 -0500 Subject: [PATCH] [Commands] Cleanup #endurance Command. (#1719) - Add message. --- zone/command.cpp | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index c679961b3..fe8b52d0f 100755 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -884,19 +884,30 @@ void command_worldwide(Client *c, const Seperator *sep) c->Message(Chat::White, "Usage: #worldwide moveinstance [Instance ID]"); } } + void command_endurance(Client *c, const Seperator *sep) { - Mob *t; + auto target = c->GetTarget() ? c->GetTarget() : c; + if (target->IsClient()) { + target->CastToClient()->SetEndurance(target->CastToClient()->GetMaxEndurance()); + } else { + target->SetEndurance(target->GetMaxEndurance()); + } - t = c->GetTarget() ? c->GetTarget() : c; - - if (t->IsClient()) - t->CastToClient()->SetEndurance(t->CastToClient()->GetMaxEndurance()); - else - t->SetEndurance(t->GetMaxEndurance()); - - t->Message(Chat::White, "Your endurance has been refilled."); + 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."); + } } + void command_setstat(Client* c, const Seperator* sep){ if(sep->arg[1][0] && sep->arg[2][0] && c->GetTarget()!=0 && c->GetTarget()->IsClient()){ c->GetTarget()->CastToClient()->SetStats(atoi(sep->arg[1]),atoi(sep->arg[2]));