mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-03 13:36:36 +00:00
[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.
This commit is contained in:
+12
-29
@@ -2,39 +2,22 @@
|
||||
|
||||
void command_repop(Client *c, const Seperator *sep)
|
||||
{
|
||||
int timearg = 1;
|
||||
int delay = 0;
|
||||
|
||||
if (sep->arg[1] && strcasecmp(sep->arg[1], "force") == 0) {
|
||||
timearg++;
|
||||
|
||||
LinkedListIterator<Spawn2 *> iterator(zone->spawn2_list);
|
||||
iterator.Reset();
|
||||
while (iterator.MoreElements()) {
|
||||
std::string query = StringFormat(
|
||||
"DELETE FROM respawn_times WHERE id = %lu AND instance_id = %lu",
|
||||
(unsigned long) iterator.GetData()->GetID(),
|
||||
(unsigned long) zone->GetInstanceID()
|
||||
);
|
||||
auto results = database.QueryDatabase(query);
|
||||
iterator.Advance();
|
||||
}
|
||||
c->Message(Chat::White, "Zone depop: Force resetting spawn timers.");
|
||||
}
|
||||
|
||||
if (!sep->IsNumber(timearg)) {
|
||||
c->Message(Chat::White, "Zone depopped - repopping now.");
|
||||
|
||||
zone->Repop();
|
||||
|
||||
/* Force a spawn2 timer trigger so we don't delay actually spawning the NPC's */
|
||||
zone->spawn2_timer.Trigger();
|
||||
int arguments = sep->argnum;
|
||||
if (!arguments) {
|
||||
c->Message(Chat::White, "Zone depopped, repopping now.");
|
||||
return;
|
||||
}
|
||||
|
||||
c->Message(Chat::White, "Zone depoped. Repop in %i seconds", atoi(sep->arg[timearg]));
|
||||
zone->Repop(atoi(sep->arg[timearg]) * 1000);
|
||||
bool is_force = !strcasecmp(sep->arg[1], "force");
|
||||
|
||||
if (is_force) {
|
||||
zone->ClearSpawnTimers();
|
||||
c->Message(Chat::White, "Zone depopped, forcefully repopping now.");
|
||||
} else {
|
||||
c->Message(Chat::White, "Zone depopped, repopping now.");
|
||||
}
|
||||
|
||||
zone->Repop();
|
||||
zone->spawn2_timer.Trigger();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user