[Commands] Cleanup #wpinfo Command. (#1866)

- Cleanup message and logic.
- Only display grid/waypoints if NPC has a grid.
This commit is contained in:
Kinglykrab
2021-12-04 21:53:29 -05:00
committed by GitHub
parent aa4536e1ef
commit 8ec4afe721
6 changed files with 78 additions and 37 deletions
+45 -18
View File
@@ -76,26 +76,53 @@ void NPC::AI_SetRoambox(
roambox_min_delay = min_delay;
}
void NPC::DisplayWaypointInfo(Client *c) {
void NPC::DisplayWaypointInfo(Client *client) {
client->Message(
Chat::White,
fmt::format(
"Waypoint Info for {} ({}) | Grid: {} Waypoint: {} of {}",
GetCleanName(),
GetID(),
GetGrid(),
GetCurWp(),
GetMaxWp()
).c_str()
);
c->Message(Chat::White, "Mob is on grid %d, in spawn group %d, on waypoint %d/%d",
GetGrid(),
GetSpawnGroupId(),
GetCurWp(),
GetMaxWp());
client->Message(
Chat::White,
fmt::format(
"Waypoint Info for {} ({}) | Spawn Group: {} Spawn Point: {}",
GetCleanName(),
GetID(),
GetSpawnGroupId(),
GetSpawnPointID()
).c_str()
);
std::vector<wplist>::iterator cur, end;
cur = Waypoints.begin();
end = Waypoints.end();
for (; cur != end; ++cur) {
c->Message(Chat::White, "Waypoint %d: (%.2f,%.2f,%.2f,%.2f) pause %d",
cur->index,
cur->x,
cur->y,
cur->z,
cur->heading,
cur->pause);
for (const auto& current_waypoint : Waypoints) {
client->Message(
Chat::White,
fmt::format(
"Waypoint {}{} | XYZ: {:.2f}, {:.2f}, {:.2f} Heading: {:.2f}{}",
current_waypoint.index,
current_waypoint.centerpoint ? " (Center)" : "",
current_waypoint.x,
current_waypoint.y,
current_waypoint.z,
current_waypoint.heading,
(
current_waypoint.pause ?
fmt::format(
"{} ({})",
ConvertSecondsToTime(current_waypoint.pause),
current_waypoint.pause
) :
""
)
).c_str()
);
}
}