eqemu-server/world/cli/bots_enable.cpp
Chris Miles cf49b2fe49
[CLI] Add bots:enable and bots:disable commands (#3415)
* [CLI] Add `bots:enable` and `bots:disable` commands

* Add input warning
2023-06-17 18:48:47 -05:00

27 lines
752 B
C++

#include "../worlddb.h"
#include "../../common/rulesys.h"
void WorldserverCLI::BotsEnable(int argc, char **argv, argh::parser &cmd, std::string &description)
{
description = "Bootstraps bot tables and enables bots";
if (cmd[{"-h", "--help"}]) {
return;
}
// bootstrap bot tables if they don't exist
if (!database.DoesTableExist("bot_data")) {
LogInfo("Bootstrapping bot tables");
database.SourceSqlFromUrl(
"https://raw.githubusercontent.com/EQEmu/Server/master/utils/sql/bot_tables_bootstrap.sql"
);
}
else {
LogInfo("Bot tables already exist, skipping bootstrap");
}
LogInfo("Enabling bots");
LogInfo("Setting rule Bots:Enabled to true");
RuleManager::Instance()->SetRule("Bots:Enabled", "true", &database, true, true);
}