Kinglykrab 7df9b2974b
[Commands] Cleanup #reloadzps Command. (#2129)
* [Commands] Cleanup #reloadzps Command.
- Cleanup messages and logic.
- Make reloading of zone points global instead of zone specific.

* Further cleanup.
- Add zone->GetZoneDescription().
- Add mob->GetTargetDescription(mob).

* Final cleanup.

* Typo.
2022-05-07 03:23:15 -04:00

41 lines
900 B
C++
Executable File

#include "../client.h"
void command_timers(Client *c, const Seperator *sep)
{
auto target = c;
if (c->GetTarget() && c->GetTarget()->IsClient()) {
target = c->GetTarget()->CastToClient();
}
std::vector<std::pair<pTimerType, PersistentTimer *>> timers;
target->GetPTimers().ToVector(timers);
std::string popup_title = fmt::format(
"Recast Timers for {}",
c->GetTargetDescription(target, TargetDescriptionType::UCSelf)
);
std::string popup_text = "<table>";
popup_text += "<tr><td>Timer ID</td><td>Remaining</td></tr>";
for (const auto& timer : timers) {
auto remaining_time = timer.second->GetRemainingTime();
if (remaining_time) {
popup_text += fmt::format(
"<tr><td>{}</td><td>{}</td></tr>",
timer.first,
ConvertSecondsToTime(remaining_time)
);
}
}
popup_text += "</table>";
c->SendPopupToClient(
popup_title.c_str(),
popup_text.c_str()
);
}