eqemu-server/zone/gm_commands/reloadworld.cpp
Kinglykrab 3091a84540
[Commands] Cleanup #reloadworld and #repop Command. (#2127)
* [Commands] Cleanup #reloadworld Command.
- Cleanup messages and logic.

* [Commands] Cleanup #reloadworld and #repop Command.
- Cleanup messages and logic.
- Add #reloadworld 2 option to forcefully repop all mobs globally as well as reset quest timers and reload quests.
- Remove delay argument from #repop as it isn't used for anything.

* Typos.
2022-05-06 20:06:51 -04:00

41 lines
869 B
C++
Executable File

#include "../client.h"
#include "../worldserver.h"
extern WorldServer worldserver;
void command_reloadworld(Client *c, const Seperator *sep)
{
uint8 global_repop = ReloadWorld::NoRepop;
if (sep->IsNumber(1)) {
global_repop = static_cast<uint8>(std::stoul(sep->arg[1]));
if (global_repop > ReloadWorld::ForceRepop) {
global_repop = ReloadWorld::ForceRepop;
}
}
c->Message(
Chat::White,
fmt::format(
"Attempting to reload quests {}worldwide.",
(
global_repop ?
(
global_repop == ReloadWorld::Repop ?
"and repop NPCs " :
"and forcefully repop NPCs "
) :
""
)
).c_str()
);
auto pack = new ServerPacket(ServerOP_ReloadWorld, sizeof(ReloadWorld_Struct));
ReloadWorld_Struct *RW = (ReloadWorld_Struct *) pack->pBuffer;
RW->global_repop = global_repop;
worldserver.SendPacket(pack);
safe_delete(pack);
}