Addresses #1110 - Add a system to blacklist GameObject GUID's (#1365)

* Addresses #1110

* Addresses #1110
This commit is contained in:
Jelly
2025-06-08 09:22:06 -05:00
committed by GitHub
parent cfc8e85706
commit d15ec79252
4 changed files with 24 additions and 4 deletions

View File

@@ -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) #
##############################################

View File

@@ -156,7 +156,9 @@ bool PlayerbotAIConfig::Initialize()
LoadList<std::vector<uint32>>(
sConfigMgr->GetOption<std::string>("AiPlayerbot.RandomBotQuestIds", "7848,3802,5505,6502,7761"),
randomBotQuestIds);
LoadSet<std::set<uint32>>(sConfigMgr->GetOption<std::string>("AiPlayerbot.DisallowedGameObjects", "176213,17155"),
disallowedGameObjects);
botAutologin = sConfigMgr->GetOption<bool>("AiPlayerbot.BotAutologin", false);
randomBotAutologin = sConfigMgr->GetOption<bool>("AiPlayerbot.RandomBotAutologin", true);
minRandomBots = sConfigMgr->GetOption<int32>("AiPlayerbot.MinRandomBots", 50);

View File

@@ -72,6 +72,7 @@ public:
float maxAoeAvoidRadius;
std::set<uint32> aoeAvoidSpellWhitelist;
bool tellWhenAvoidAoe;
std::set<uint32> disallowedGameObjects;
uint32 openGoSpell;
bool randomBotAutologin;

View File

@@ -35,8 +35,17 @@ bool LootAction::Execute(Event /*event*/)
// bot->GetSession()->HandleLootReleaseOpcode(packet);
}
context->GetValue<LootObject>("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<LootObject>("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);
}