From 7eaee2649eaef636626a26648c1f6fce5381683b Mon Sep 17 00:00:00 2001 From: nytmyr <53322305+nytmyr@users.noreply.github.com> Date: Fri, 4 Oct 2024 19:20:52 -0500 Subject: [PATCH] [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 --- zone/bot_commands/bot.cpp | 14 +++++++++++--- zone/bot_raid.cpp | 4 +++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/zone/bot_commands/bot.cpp b/zone/bot_commands/bot.cpp index 4faa96e1f..5d2bfe18e 100644 --- a/zone/bot_commands/bot.cpp +++ b/zone/bot_commands/bot.cpp @@ -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]); } } diff --git a/zone/bot_raid.cpp b/zone/bot_raid.cpp index ac15e2156..25d98ef86 100644 --- a/zone/bot_raid.cpp +++ b/zone/bot_raid.cpp @@ -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);