mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-18 20:08:21 +00:00
[Commands] Cleanup #gmspeed Command. (#1831)
* [Commands] Cleanup #gmspeed Command. - Cleanup message and logic. * Update gmspeed.cpp * Update gmspeed.cpp
This commit is contained in:
@@ -2,19 +2,54 @@
|
||||
|
||||
void command_gmspeed(Client *c, const Seperator *sep)
|
||||
{
|
||||
bool state = atobool(sep->arg[1]);
|
||||
Client *t = c;
|
||||
int arguments = sep->argnum;
|
||||
if (!arguments) {
|
||||
c->Message(Chat::White, "Usage: #gmspeed [On|Off]");
|
||||
return;
|
||||
}
|
||||
|
||||
bool gm_speed_flag = atobool(sep->arg[1]);
|
||||
Client *target = c;
|
||||
if (c->GetTarget() && c->GetTarget()->IsClient()) {
|
||||
t = c->GetTarget()->CastToClient();
|
||||
target = c->GetTarget()->CastToClient();
|
||||
}
|
||||
|
||||
if (sep->arg[1][0] != 0) {
|
||||
database.SetGMSpeed(t->AccountID(), state ? 1 : 0);
|
||||
c->Message(Chat::White, "Turning GMSpeed %s for %s (zone to take effect)", state ? "On" : "Off", t->GetName());
|
||||
}
|
||||
else {
|
||||
c->Message(Chat::White, "Usage: #gmspeed [on/off]");
|
||||
}
|
||||
database.SetGMSpeed(
|
||||
target->AccountID(),
|
||||
gm_speed_flag ? 1 : 0
|
||||
);
|
||||
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Turning GM Speed {} for {}.",
|
||||
gm_speed_flag ? "on" : "off",
|
||||
(
|
||||
c == target ?
|
||||
"yourself" :
|
||||
fmt::format(
|
||||
"{} ({})",
|
||||
target->GetCleanName(),
|
||||
target->GetID()
|
||||
)
|
||||
)
|
||||
).c_str()
|
||||
);
|
||||
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Note: {} must zone for it to take effect.",
|
||||
(
|
||||
c == target ?
|
||||
"You" :
|
||||
fmt::format(
|
||||
"{} ({})",
|
||||
target->GetCleanName(),
|
||||
target->GetID()
|
||||
)
|
||||
)
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user