mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 04:56:20 +00:00
[Commands] Cleanup #aggro Command. (#1799)
- Cleanup messages and logic. - Cleanup constant names and references. - Cleanup aggro description methods.
This commit is contained in:
+19
-12
@@ -2,20 +2,27 @@
|
||||
|
||||
void command_aggro(Client *c, const Seperator *sep)
|
||||
{
|
||||
if (c->GetTarget() == nullptr || !c->GetTarget()->IsNPC()) {
|
||||
c->Message(Chat::White, "Error: you must have an NPC target.");
|
||||
int arguments = sep->argnum;
|
||||
if (!arguments || !sep->IsNumber(1)) {
|
||||
c->Message(Chat::White, "Usage: #aggro [Distance] [-v] (-v is verbose Faction Information)");
|
||||
return;
|
||||
}
|
||||
float d = atof(sep->arg[1]);
|
||||
if (d == 0.0f) {
|
||||
c->Message(Chat::Red, "Error: distance argument required.");
|
||||
return;
|
||||
}
|
||||
bool verbose = false;
|
||||
if (sep->arg[2][0] == '-' && sep->arg[2][1] == 'v' && sep->arg[2][2] == '\0') {
|
||||
verbose = true;
|
||||
}
|
||||
|
||||
entity_list.DescribeAggro(c, c->GetTarget()->CastToNPC(), d, verbose);
|
||||
if (
|
||||
!c->GetTarget() ||
|
||||
(
|
||||
c->GetTarget() &&
|
||||
!c->GetTarget()->IsNPC()
|
||||
)
|
||||
) {
|
||||
c->Message(Chat::White, "You must target an NPC to use this command.");
|
||||
return;
|
||||
}
|
||||
|
||||
NPC* target = c->GetTarget()->CastToNPC();
|
||||
|
||||
float distance = std::stof(sep->arg[1]);
|
||||
bool verbose = !strcasecmp("-v", sep->arg[2]);
|
||||
entity_list.DescribeAggro(c, target, distance, verbose);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user