[Commands] Cleanup #resetaa Command (#4310)

* [Commands] Cleanup #resetaa Command

* Update resetaa.cpp
This commit is contained in:
Alex King authored and GitHub committed 2024-05-22 16:06:51 -05:00
1 parent ca69cc67e8
commit 7e40c5bac2
7 files changed
+49 -19

No files matched your search

+19 -5
View File
@@ -2,18 +2,32 @@
void command_resetaa(Client *c, const Seperator *sep)
{
if (!c->GetTarget() || !c->GetTarget()->IsClient()) {
c->Message(Chat::White, "You must target a player to use this command.");
Client* t = c;
if (c->GetTarget() && c->GetTarget()->IsClient()) {
t = c->GetTarget()->CastToClient();
}
const uint16 arguments = sep->argnum;
const bool is_aa = !strcasecmp(sep->arg[1], "aa");
const bool is_leadership = !strcasecmp(sep->arg[1], "leadership");
if (!arguments || (!is_aa && !is_leadership)) {
c->Message(Chat::White, "Usage: #resetaa aa - Resets and refunds a player's AAs");
c->Message(Chat::White, "Usage: #resetaa leadership - Resets a player's Leadership AAs");
return;
}
auto t = c->GetTarget()->CastToClient();
t->ResetAA();
if (is_aa) {
t->ResetAA();
} else if (is_leadership) {
t->ResetLeadershipAA();
}
c->Message(
Chat::White,
fmt::format(
"Successfully reset all Alternate Advancements for {}.",
"Successfully reset all{} AAs for {}.",
is_aa ? "" : " Leadership",
c->GetTargetDescription(t)
).c_str()
);