[Commands] Cleanup #aggrozone Command. (#1798)

- Cleanup message and logic.
- Add the ability to aggro the zone on your target if you have one.
This commit is contained in:
Kinglykrab 2021-11-21 10:12:02 -05:00 committed by GitHub
parent 446c5d90ec
commit 04fda24c8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,18 +2,30 @@
void command_aggrozone(Client *c, const Seperator *sep)
{
if (!c) {
return;
Mob *target = c;
if (c->GetTarget()) {
target = c->GetTarget();
}
Mob *m = c->CastToMob();
if (!m) {
return;
uint32 hate = 0;
if (sep->IsNumber(1)) {
hate = std::stoul(sep->arg[1]);
}
uint32 hate = atoi(sep->arg[1]); //should default to 0 if we don't enter anything
entity_list.AggroZone(m, hate);
c->Message(Chat::White, "Train to you! Last chance to go invulnerable...");
entity_list.AggroZone(target, hate);
c->Message(
Chat::White,
fmt::format(
"Aggroing zone on {}.",
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
)
).c_str()
);
}