[Bots] Add "silent" option to ^spawn and mute raid spawn (#4494)

When zoning or forming a raid, bots would spam their spawn message. They will now be muted.

Adds an optional argument "silent" to the ^spawn command. This will bypass ^oo spawnmessage settings and not send a spawn message. Example: ^spawn Warbot silent
This commit is contained in:
nytmyr 2024-10-04 19:20:52 -05:00 committed by GitHub
parent a17f467b98
commit 7eaee2649e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 4 deletions

View File

@ -857,7 +857,7 @@ void bot_command_spawn(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"Usage: {} [bot_name]",
"Usage: {} [bot_name] [optional: silent]",
sep->arg[0]
).c_str()
);
@ -1045,9 +1045,17 @@ void bot_command_spawn(Client *c, const Seperator *sep)
message_index = VALIDATECLASSID(my_bot->GetClass());
}
if (c->GetBotOption(Client::booSpawnMessageSay)) {
std::string silent_confirm = sep->arg[2];
bool silentTell = false;
if (!silent_confirm.compare("silent")) {
silentTell = true;
}
if (!silentTell && c->GetBotOption(Client::booSpawnMessageSay)) {
Bot::BotGroupSay(my_bot, bot_spawn_message[message_index].c_str());
} else if (c->GetBotOption(Client::booSpawnMessageTell)) {
}
else if (!silentTell && c->GetBotOption(Client::booSpawnMessageTell)) {
my_bot->OwnerMessage(bot_spawn_message[message_index]);
}
}

View File

@ -312,10 +312,12 @@ void Client::SpawnRaidBotsOnConnect(Raid* raid) {
for (const auto& m: r_members) {
if (strlen(m.member_name) != 0) {
for (const auto& b: bots_list) {
for (const auto& b : bots_list) {
if (strcmp(m.member_name, b.bot_name) == 0) {
std::string buffer = "^spawn ";
buffer.append(m.member_name);
std::string silent = " silent";
buffer.append(silent);
bot_command_real_dispatch(this, buffer.c_str());
auto bot = entity_list.GetBotByBotName(m.member_name);