[Commands] Cleanup #resetaa Command. (#2132)

* [Commands] Cleanup #resetaa Command.
- Cleanup messages and logic.

* Update resetaa.cpp
This commit is contained in:
Kinglykrab 2022-05-06 20:02:32 -04:00 committed by GitHub
parent 132c936c90
commit adfec15893
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,12 +2,28 @@
void command_resetaa(Client *c, const Seperator *sep) void command_resetaa(Client *c, const Seperator *sep)
{ {
if (c->GetTarget() && c->GetTarget()->IsClient()) { if (!c->GetTarget() || !c->GetTarget()->IsClient()) {
c->GetTarget()->CastToClient()->ResetAA(); c->Message(Chat::White, "You must target a player to use this command.");
c->Message(Chat::Red, "Successfully reset %s's AAs", c->GetTarget()->GetName()); return;
}
else {
c->Message(Chat::White, "Usage: Target a client and use #resetaa to reset the AA data in their Profile.");
} }
auto target = c->GetTarget()->CastToClient();
target->ResetAA();
c->Message(
Chat::White,
fmt::format(
"Successfully reset all Alternate Advancements for {}.",
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
)
).c_str()
);
} }