diff --git a/conf/playerbots.conf.dist b/conf/playerbots.conf.dist index 3e72a5058..41ca0b6b4 100644 --- a/conf/playerbots.conf.dist +++ b/conf/playerbots.conf.dist @@ -2240,6 +2240,14 @@ AiPlayerbot.CommandPrefix = "" # Separator for bot chat commands AiPlayerbot.CommandSeparator = "\\\\" +# Enable automatic item count/trade trigger when a chat message contains +# item-related keywords. When enabled (1), mentioning items in chat +# (e.g. "food", "potion", "ammo") will automatically show inventory and +# open a trade window with the bot. Explicit "c" and "t" commands still +# work regardless of this setting. +# Default: 1 (enabled) +AiPlayerbot.EnableAutoTradeOnItemMention = 1 + # Enable bots talking (say / yell / general chatting / lfg) AiPlayerbot.RandomBotTalk = 1 # Enable bots emoting diff --git a/src/Bot/Engine/ExternalEventHelper.cpp b/src/Bot/Engine/ExternalEventHelper.cpp index 3a62fbda9..912f65877 100644 --- a/src/Bot/Engine/ExternalEventHelper.cpp +++ b/src/Bot/Engine/ExternalEventHelper.cpp @@ -33,8 +33,11 @@ bool ExternalEventHelper::ParseChatCommand(std::string const command, Player* ow if (!ChatHelper::parseableItem(command)) return false; - HandleCommand("c", command, owner); - HandleCommand("t", command, owner); + if (sPlayerbotAIConfig.enableAutoTradeOnItemMention) + { + HandleCommand("c", command, owner); + HandleCommand("t", command, owner); + } return true; } diff --git a/src/PlayerbotAIConfig.cpp b/src/PlayerbotAIConfig.cpp index 242febd17..8a0c6b0a0 100644 --- a/src/PlayerbotAIConfig.cpp +++ b/src/PlayerbotAIConfig.cpp @@ -519,6 +519,7 @@ bool PlayerbotAIConfig::Initialize() LoadListString>(sConfigMgr->GetOption("AiPlayerbot.AllowedLogFiles", ""), allowedLogFiles); + enableAutoTradeOnItemMention = sConfigMgr->GetOption("AiPlayerbot.EnableAutoTradeOnItemMention", true); LoadListString>(sConfigMgr->GetOption("AiPlayerbot.TradeActionExcludedPrefixes", ""), tradeActionExcludedPrefixes); diff --git a/src/PlayerbotAIConfig.h b/src/PlayerbotAIConfig.h index 210e03ef9..1a343db4d 100644 --- a/src/PlayerbotAIConfig.h +++ b/src/PlayerbotAIConfig.h @@ -306,6 +306,7 @@ public: uint32 iterationsPerTick; std::mutex m_logMtx; + bool enableAutoTradeOnItemMention; std::vector tradeActionExcludedPrefixes; std::vector allowedLogFiles; std::unordered_map> logFiles;