[Commands] Cleanup #depopzone Command. (#2537)

* [Commands] Cleanup #depopzone Command.

- Cleanup messages and logic.
- Add optional `start_spawn_timers` parameter to start spawn timers of NPCs when depopped.

* Update depopzone.cpp
This commit is contained in:
Kinglykrab 2022-11-14 16:47:20 -05:00 committed by GitHub
parent f668949c24
commit fd2fc76706
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 3 deletions

2
zone/command.cpp Executable file → Normal file
View File

@ -121,7 +121,7 @@ int command_init(void)
command_add("delacct", "[accountname] - Delete an account", AccountStatus::GMLeadAdmin, command_delacct) ||
command_add("delpetition", "[petition number] - Delete a petition", AccountStatus::ApprenticeGuide, command_delpetition) ||
command_add("depop", "[Start Spawn Timer] - Depop your NPC target and optionally start their spawn timer (false by default)", AccountStatus::Guide, command_depop) ||
command_add("depopzone", "Depop the zone", AccountStatus::GMAdmin, command_depopzone) ||
command_add("depopzone", "[Start Spawn Timers] - Depop the zone and optionally start spawn timers (false by default)", AccountStatus::GMAdmin, command_depopzone) ||
command_add("devtools", "[Enable|Disable] - Manages Developer Tools (send no parameter for menu)", AccountStatus::GMMgmt, command_devtools) ||
command_add("disablerecipe", "[Recipe ID] - Disables a Recipe", AccountStatus::QuestTroupe, command_disablerecipe) ||
command_add("disarmtrap", "Analog for ldon disarm trap for the newer clients since we still don't have it working.", AccountStatus::QuestTroupe, command_disarmtrap) ||

View File

@ -2,7 +2,20 @@
void command_depopzone(Client *c, const Seperator *sep)
{
zone->Depop();
c->Message(Chat::White, "Zone depoped.");
auto start_spawn_timers = false;
if (sep->IsNumber(1)) {
start_spawn_timers = std::stoi(sep->arg[1]) ? true : false;
}
zone->Depop(start_spawn_timers);
c->Message(
Chat::White,
fmt::format(
"Zone depopped{}.",
start_spawn_timers ? " and spawn timers started" : ""
).c_str()
);
}