mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +00:00
[Commands] Cleanup #invul Command. (#1780)
- Cleanup message and logic.
This commit is contained in:
parent
fb2f901539
commit
f1d9221b4c
@ -221,7 +221,7 @@ int command_init(void)
|
||||
command_add("interrogateinv", "- use [help] argument for available options", AccountStatus::Player, command_interrogateinv) ||
|
||||
command_add("interrupt", "[message id] [color] - Interrupt your casting. Arguments are optional.", AccountStatus::Guide, command_interrupt) ||
|
||||
command_add("invsnapshot", "- Manipulates inventory snapshots for your current target", AccountStatus::QuestTroupe, command_invsnapshot) ||
|
||||
command_add("invul", "[on/off] - Turn player target's or your invulnerable flag on or off", AccountStatus::QuestTroupe, command_invul) ||
|
||||
command_add("invul", "[On|Off]] - Turn player target's or your invulnerable flag on or off", AccountStatus::QuestTroupe, command_invul) ||
|
||||
command_add("ipban", "[IP address] - Ban IP by character name", AccountStatus::GMMgmt, command_ipban) ||
|
||||
command_add("iplookup", "[charname] - Look up IP address of charname", AccountStatus::GMMgmt, command_iplookup) ||
|
||||
command_add("iteminfo", "- Get information about the item on your cursor", AccountStatus::Steward, command_iteminfo) ||
|
||||
|
||||
@ -2,19 +2,27 @@
|
||||
|
||||
void command_invul(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: #invul [On|Off]");
|
||||
return;
|
||||
}
|
||||
|
||||
bool invul_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) {
|
||||
t->SetInvul(state);
|
||||
c->Message(Chat::White, "%s is %s invulnerable from attack.", t->GetName(), state ? "now" : "no longer");
|
||||
}
|
||||
else {
|
||||
c->Message(Chat::White, "Usage: #invulnerable [on/off]");
|
||||
}
|
||||
target->SetInvul(invul_flag);
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} {} now {}.",
|
||||
c == target ? "You" : target->GetCleanName(),
|
||||
c == target ? "are" : "is",
|
||||
invul_flag ? "invulnerable" : "vulnerable"
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user