From f8c2e85f3eaa66e1cf291f58056ace482c51aee0 Mon Sep 17 00:00:00 2001 From: Kinglykrab <89047260+Kinglykrab@users.noreply.github.com> Date: Fri, 12 Nov 2021 08:10:43 -0500 Subject: [PATCH] [Commands] Cleanup #mana Command. (#1718) * [Commands] Cleanup #mana Command. - Add message. * Add self message. --- zone/command.cpp | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index b00033842..c679961b3 100755 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -3087,14 +3087,25 @@ void command_size(Client *c, const Seperator *sep) void command_mana(Client *c, const Seperator *sep) { - Mob *t; + auto target = c->GetTarget() ? c->GetTarget() : c; + if(target->IsClient()) { + target->CastToClient()->SetMana(target->CastToClient()->CalcMaxMana()); + } else { + target->SetMana(target->CalcMaxMana()); + } - t = c->GetTarget() ? c->GetTarget() : c; - - if(t->IsClient()) - t->CastToClient()->SetMana(t->CastToClient()->CalcMaxMana()); - else - t->SetMana(t->CalcMaxMana()); + if (c != target) { + c->Message( + Chat::White, + fmt::format( + "Set {} ({}) to full Mana.", + target->GetCleanName(), + target->GetID() + ).c_str() + ); + } else { + c->Message(Chat::White, "Restored your Mana to full."); + } } void command_flymode(Client *c, const Seperator *sep)