From 514029a6bb98e6b46c76939b46bc02fa3dafe2bb Mon Sep 17 00:00:00 2001 From: Kinglykrab <89047260+Kinglykrab@users.noreply.github.com> Date: Fri, 26 Nov 2021 10:01:04 -0500 Subject: [PATCH] [Commands] Cleanup #bind Command. (#1829) - Add message and cleanup logic. --- zone/gm_commands/bind.cpp | 61 ++++++++++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 11 deletions(-) diff --git a/zone/gm_commands/bind.cpp b/zone/gm_commands/bind.cpp index 216985ae3..f9a68502e 100755 --- a/zone/gm_commands/bind.cpp +++ b/zone/gm_commands/bind.cpp @@ -2,16 +2,55 @@ void command_bind(Client *c, const Seperator *sep) { - if (c->GetTarget() != 0) { - if (c->GetTarget()->IsClient()) { - c->GetTarget()->CastToClient()->SetBindPoint(); - } - else { - c->Message(Chat::White, "Error: target not a Player"); - } + Client *target = c; + if (c->GetTarget() && c->GetTarget()->IsClient()) { + target = c->GetTarget()->CastToClient(); } - else { - c->SetBindPoint(); - } -} + target->SetBindPoint(); + + bool in_persistent_instance = ( + zone->GetInstanceID() != 0 && + zone->IsInstancePersistent() + ); + + auto target_string = ( + c == target ? + "Yourself" : + fmt::format( + "{} ({})", + target->GetCleanName(), + target->GetID() + ) + ); + + c->Message( + Chat::White, + fmt::format( + "Set Bind Point for {} | Zone: {} ({}) ID: {} {}", + target_string, + zone->GetLongName(), + zone->GetShortName(), + zone->GetZoneID(), + ( + in_persistent_instance ? + fmt::format( + " Instance ID: {}", + zone->GetInstanceID() + ) : + "" + ) + ).c_str() + ); + + c->Message( + Chat::White, + fmt::format( + "Set Bind Point for {} | XYZ: {:.2f}, {:.2f}, {:.2f}", + target_string, + target->GetX(), + target->GetY(), + target->GetZ() + ).c_str() + ); +}