eqemu-server/zone/gm_commands/reloadtraps.cpp
Kinglykrab 0b3065d7a9
[Commands] Cleanup #reloadtraps Command. (#2126)
* [Commands] Cleanup #reloadtraps Command.
- Cleanup messages and logic.
- Allow the option to reload/repop traps globally for this command.

* Typos.
2022-05-06 22:39:21 -04:00

66 lines
1.1 KiB
C++
Executable File

#include "../client.h"
void command_reloadtraps(Client *c, const Seperator *sep)
{
int arguments = sep->argnum;
if (!arguments) {
entity_list.UpdateAllTraps(true, true);
c->Message(
Chat::Yellow,
fmt::format(
"Traps reloaded for {}{}.",
fmt::format(
"{} ({})",
zone->GetLongName(),
zone->GetZoneID()
),
(
zone->GetInstanceID() ?
fmt::format(
" (Instance ID {})",
zone->GetInstanceID()
) :
""
)
).c_str()
);
return;
}
bool global = false;
if (sep->IsNumber(1)) {
global = std::stoi(sep->arg[1]) ? true : false;
}
if (!global) {
entity_list.UpdateAllTraps(true, true);
c->Message(
Chat::Yellow,
fmt::format(
"Traps reloaded for {}{}.",
fmt::format(
"{} ({})",
zone->GetLongName(),
zone->GetZoneID()
),
(
zone->GetInstanceID() ?
fmt::format(
" (Instance ID {})",
zone->GetInstanceID()
) :
""
)
).c_str()
);
return;
}
c->Message(Chat::White, "Attempting to reload traps globally.");
auto pack = new ServerPacket(ServerOP_ReloadTraps, 0);
worldserver.SendPacket(pack);
safe_delete(pack);
}