From d15ec7925271c5f542f99989c78a9ae2c91aec5a Mon Sep 17 00:00:00 2001 From: Jelly Date: Sun, 8 Jun 2025 09:22:06 -0500 Subject: [PATCH] Addresses #1110 - Add a system to blacklist GameObject GUID's (#1365) * Addresses #1110 * Addresses #1110 --- conf/playerbots.conf.dist | 8 ++++++++ src/PlayerbotAIConfig.cpp | 4 +++- src/PlayerbotAIConfig.h | 1 + src/strategy/actions/LootAction.cpp | 15 ++++++++++++--- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/conf/playerbots.conf.dist b/conf/playerbots.conf.dist index 489659d6..8ec3c48e 100644 --- a/conf/playerbots.conf.dist +++ b/conf/playerbots.conf.dist @@ -1808,6 +1808,14 @@ AiPlayerbot.AllowedLogFiles = "" # #################################################################################################### +#################################################################################################### +# A list of gameObject GUID's that are not allowed for bots to interact with. +# Example: 176213 = Blood of Heroes +# Example: 17155 = Defias Gunpowder +AiPlayerbot.DisallowedGameObjects = 176213,17155 +# +#################################################################################################### + ############################################## # Deprecated Settings (yet still in use) # ############################################## diff --git a/src/PlayerbotAIConfig.cpp b/src/PlayerbotAIConfig.cpp index 65c86eb3..326e2f5c 100644 --- a/src/PlayerbotAIConfig.cpp +++ b/src/PlayerbotAIConfig.cpp @@ -156,7 +156,9 @@ bool PlayerbotAIConfig::Initialize() LoadList>( sConfigMgr->GetOption("AiPlayerbot.RandomBotQuestIds", "7848,3802,5505,6502,7761"), randomBotQuestIds); - + + LoadSet>(sConfigMgr->GetOption("AiPlayerbot.DisallowedGameObjects", "176213,17155"), + disallowedGameObjects); botAutologin = sConfigMgr->GetOption("AiPlayerbot.BotAutologin", false); randomBotAutologin = sConfigMgr->GetOption("AiPlayerbot.RandomBotAutologin", true); minRandomBots = sConfigMgr->GetOption("AiPlayerbot.MinRandomBots", 50); diff --git a/src/PlayerbotAIConfig.h b/src/PlayerbotAIConfig.h index a6dc9666..0045d69e 100644 --- a/src/PlayerbotAIConfig.h +++ b/src/PlayerbotAIConfig.h @@ -72,6 +72,7 @@ public: float maxAoeAvoidRadius; std::set aoeAvoidSpellWhitelist; bool tellWhenAvoidAoe; + std::set disallowedGameObjects; uint32 openGoSpell; bool randomBotAutologin; diff --git a/src/strategy/actions/LootAction.cpp b/src/strategy/actions/LootAction.cpp index ee5f50c2..0d5ed73e 100644 --- a/src/strategy/actions/LootAction.cpp +++ b/src/strategy/actions/LootAction.cpp @@ -35,8 +35,17 @@ bool LootAction::Execute(Event /*event*/) // bot->GetSession()->HandleLootReleaseOpcode(packet); } - context->GetValue("loot target")->Set(lootObject); - return true; + // Provide a system to check if the game object id is disallowed in the user configurable list or not. + // Check if the game object id is disallowed in the user configurable list or not. + if (sPlayerbotAIConfig->disallowedGameObjects.find(lootObject.guid.GetEntry()) != sPlayerbotAIConfig->disallowedGameObjects.end()) + { + return false; // Game object ID is disallowed, so do not proceed + } + else + { + context->GetValue("loot target")->Set(lootObject); + return true; + } } bool LootAction::isUseful() @@ -147,7 +156,7 @@ bool OpenLootAction::DoLoot(LootObject& lootObject) uint32 spellId = GetOpeningSpell(lootObject); if (!spellId) return false; - + return botAI->CastSpell(spellId, bot); }