From 02db9c6c8ab3498688cde160d94b2e202a96e69d Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Sat, 22 Jun 2024 14:28:38 +0800 Subject: [PATCH] [Configuration] Disable death knight login --- conf/playerbots.conf.dist | 10 +++++++--- src/PlayerbotAIConfig.cpp | 5 +++-- src/PlayerbotAIConfig.h | 1 + src/RandomPlayerbotMgr.cpp | 15 ++++++++++++++- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/conf/playerbots.conf.dist b/conf/playerbots.conf.dist index 1396975b..88cffdce 100644 --- a/conf/playerbots.conf.dist +++ b/conf/playerbots.conf.dist @@ -49,7 +49,7 @@ AiPlayerbot.RandomBotMinLevel = 1 AiPlayerbot.RandomBotMaxLevel = 80 # Enable/Disable rotation of bots (randomly select a bot from the bots pool to go online and rotate them periodically) -# Need reset rndbot after changing the setting +# Need to reset rndbot after changing the setting (.playerbot rndbot reset) # default: 0 (disable, the online bots are fixed) AiPlayerbot.EnableRotation = 0 @@ -108,6 +108,10 @@ AiPlayerbot.RandombotStartingLevel = 5 # Server XP Rate * AiPlayerbot.KillXPRate AiPlayerbot.KillXPRate = 1 +# Disable death knight for bots login +# Need to reset rndbot after changing the setting (.playerbot rndbot reset) +AiPlayerbot.DisableDeathKnightLogin = 0 + # Specify percent of active bots # The default is 10. With 10% of all bots going active or inactive each minute. AiPlayerbot.BotActiveAlone = 100 @@ -213,8 +217,8 @@ AiPlayerbot.SyncQuestForPlayer = 0 AiPlayerbot.SyncLevelWithPlayers = 0 # Give free food to random bots -# Default: 1 (enabled) -AiPlayerbot.FreeFood = 1 +# Default: 0 (disabled) +AiPlayerbot.FreeFood = 0 # Bot automatically trains spells when talking to trainer (yes = train all available spells as long as the bot has the money, free = auto trains with no money cost, no = only list spells) # Only for random bots diff --git a/src/PlayerbotAIConfig.cpp b/src/PlayerbotAIConfig.cpp index d3ab8a0b..87b85830 100644 --- a/src/PlayerbotAIConfig.cpp +++ b/src/PlayerbotAIConfig.cpp @@ -281,11 +281,12 @@ bool PlayerbotAIConfig::Initialize() autoGearScoreLimit = sConfigMgr->GetOption("AiPlayerbot.AutoGearScoreLimit", 0); playerbotsXPrate = sConfigMgr->GetOption("AiPlayerbot.KillXPRate", 1); + disableDeathKnightLogin = sConfigMgr->GetOption("AiPlayerbot.DisableDeathKnightLogin", 0); botActiveAlone = sConfigMgr->GetOption("AiPlayerbot.BotActiveAlone", 10); enablePrototypePerformanceDiff = sConfigMgr->GetOption("AiPlayerbot.EnablePrototypePerformanceDiff", false); - diffWithPlayer = sConfigMgr->GetOption("AiPlayerbot.DiffWithPlayer", 100); - diffEmpty = sConfigMgr->GetIntDefault("AiPlayerbot.DiffEmpty", 200); + diffWithPlayer = sConfigMgr->GetOption("AiPlayerbot.DiffWithPlayer", 100); + diffEmpty = sConfigMgr->GetOption("AiPlayerbot.DiffEmpty", 200); randombotsWalkingRPG = sConfigMgr->GetOption("AiPlayerbot.RandombotsWalkingRPG", false); randombotsWalkingRPGInDoors = sConfigMgr->GetOption("AiPlayerbot.RandombotsWalkingRPG.InDoors", false); diff --git a/src/PlayerbotAIConfig.h b/src/PlayerbotAIConfig.h index 4447fc17..5356bc49 100644 --- a/src/PlayerbotAIConfig.h +++ b/src/PlayerbotAIConfig.h @@ -176,6 +176,7 @@ class PlayerbotAIConfig bool randomBotShowCloak; bool disableRandomLevels; uint32 playerbotsXPrate; + bool disableDeathKnightLogin; uint32 botActiveAlone; uint32 enablePrototypePerformanceDiff; diff --git a/src/RandomPlayerbotMgr.cpp b/src/RandomPlayerbotMgr.cpp index 80372098..bceed464 100644 --- a/src/RandomPlayerbotMgr.cpp +++ b/src/RandomPlayerbotMgr.cpp @@ -9,6 +9,7 @@ #include "Battleground.h" #include "BattlegroundMgr.h" #include "CellImpl.h" +#include "DatabaseEnv.h" #include "Define.h" #include "FleeManager.h" #include "GameTime.h" @@ -26,6 +27,7 @@ #include "Random.h" #include "ServerFacade.h" #include "ChannelMgr.h" +#include "SharedDefines.h" #include "Unit.h" #include "World.h" #include "UpdateTime.h" @@ -480,7 +482,6 @@ uint32 RandomPlayerbotMgr::AddRandomBots() { Field* fields = result->Fetch(); ObjectGuid::LowType guid = fields[0].Get(); - if (GetEventValue(guid, "add")) continue; @@ -492,6 +493,18 @@ uint32 RandomPlayerbotMgr::AddRandomBots() if (std::find(currentBots.begin(), currentBots.end(), guid) != currentBots.end()) continue; + + if (sPlayerbotAIConfig->disableDeathKnightLogin) { + QueryResult result = CharacterDatabase.Query("Select class from characters where guid = {}", guid); + if (!result) { + continue; + } + Field* fields = result->Fetch(); + uint32 rClass = fields[0].Get(); + if (rClass == CLASS_DEATH_KNIGHT) { + continue; + } + } guids.push_back(guid); } while (result->NextRow());