diff --git a/zone/command.cpp b/zone/command.cpp index c0b4c73eb..66641d69f 100755 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -305,7 +305,7 @@ int command_init(void) command_add("repop", "[delay] - Repop the zone with optional delay", AccountStatus::GMAdmin, command_repop) || command_add("resetaa", "- Resets a Player's AA in their profile and refunds spent AA's to unspent, may disconnect player.", AccountStatus::GMMgmt, command_resetaa) || command_add("resetaa_timer", "Command to reset AA cooldown timers.", AccountStatus::GMMgmt, command_resetaa_timer) || - command_add("resetdisc_timer", "Command to reset all discipline cooldown timers.", AccountStatus::GMMgmt, command_resetdisc_timer) || + command_add("resetdisc_timer", "[All|Timer ID] - Command to reset discipline timers.", AccountStatus::GMMgmt, command_resetdisc_timer) || command_add("revoke", "[charname] [1/0] - Makes charname unable to talk on OOC", AccountStatus::GMMgmt, command_revoke) || command_add("roambox", "[Remove|Set] [Box Size] [Delay (Milliseconds)] - Remove or set an NPC's roambox size and delay", AccountStatus::GMMgmt, command_roambox) || command_add("rules", "(subcommand) - Manage server rules", AccountStatus::GMImpossible, command_rules) || diff --git a/zone/gm_commands/resetdisc_timer.cpp b/zone/gm_commands/resetdisc_timer.cpp index 0c3cfe267..cf1fb0f57 100755 --- a/zone/gm_commands/resetdisc_timer.cpp +++ b/zone/gm_commands/resetdisc_timer.cpp @@ -2,22 +2,59 @@ void command_resetdisc_timer(Client *c, const Seperator *sep) { - Client *target = c->GetTarget()->CastToClient(); - if (!c->GetTarget() || !c->GetTarget()->IsClient()) { - target = c; + int arguments = sep->argnum; + if (!arguments) { + c->Message(Chat::White, "Usage: #resetdisc_timer all - Reset all Discipline timers"); + c->Message(Chat::White, "Usage: #resetdisc_timer [Timer ID] - Reset Discipline timer by ID"); + return; + } + + auto target = c; + if (c->GetTarget() && c->GetTarget()->IsClient()) { + target = c->GetTarget()->CastToClient(); + } + + bool is_all = !strcasecmp(sep->arg[1], "all"); + + if (is_all) { + c->Message( + Chat::White, + fmt::format( + "Reset all Discipline timers for {}.", + ( + c == target ? + "yourself" : + fmt::format( + "{} ({})", + target->GetCleanName(), + target->GetID() + ) + ) + ).c_str() + ); + target->ResetAllDisciplineTimers(); + return; } if (sep->IsNumber(1)) { - int timer_id = atoi(sep->arg[1]); - c->Message(Chat::White, "Reset of disc timer %i for %s", timer_id, c->GetName()); - c->ResetDisciplineTimer(timer_id); - } - else if (!strcasecmp(sep->arg[1], "all")) { - c->Message(Chat::White, "Reset all disc timers for %s", c->GetName()); - c->ResetAllDisciplineTimers(); - } - else { - c->Message(Chat::White, "usage: #resetdisc_timer [all | timer_id]"); + auto timer_id = std::stoul(sep->arg[1]); + c->Message( + Chat::White, + fmt::format( + "Reset Discipline timer {} for {}.", + timer_id, + ( + c == target ? + "yourself" : + fmt::format( + "{} ({})", + target->GetCleanName(), + target->GetID() + ) + ) + ).c_str() + ); + target->ResetDisciplineTimer(timer_id); } }