Kinglykrab 8ec4afe721
[Commands] Cleanup #wpinfo Command. (#1866)
- Cleanup message and logic.
- Only display grid/waypoints if NPC has a grid.
2021-12-04 21:53:29 -05:00

27 lines
495 B
C++
Executable File

#include "../client.h"
void command_wpinfo(Client *c, const Seperator *sep)
{
if (!c->GetTarget() || !c->GetTarget()->IsNPC()) {
c->Message(Chat::White, "You must target an NPC to use this command.");
return;
}
auto target = c->GetTarget()->CastToNPC();
if (!target->GetGrid()) {
c->Message(
Chat::White,
fmt::format(
"{} ({}) is not a part of any grid.",
target->GetCleanName(),
target->GetID()
).c_str()
);
return;
}
target->DisplayWaypointInfo(c);
}