From 2c224d3121cfb2fdb9c912d993461b80ed16d9a5 Mon Sep 17 00:00:00 2001 From: Yunfan Li <56597220+liyunfan1223@users.noreply.github.com> Date: Sun, 9 Feb 2025 21:50:04 +0800 Subject: [PATCH] Add LimitTalentsExpansion config (#954) --- conf/playerbots.conf.dist | 5 +++++ src/PlayerbotAIConfig.cpp | 1 + src/PlayerbotAIConfig.h | 1 + src/factory/PlayerbotFactory.cpp | 26 +++++++++++++++++++------- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/conf/playerbots.conf.dist b/conf/playerbots.conf.dist index 5b8ea656..b16f6f3c 100644 --- a/conf/playerbots.conf.dist +++ b/conf/playerbots.conf.dist @@ -529,6 +529,11 @@ AiPlayerbot.RandomBotHordeRatio = 50 # Disable death knight for bots login AiPlayerbot.DisableDeathKnightLogin = 0 +# Enable expansion limitation for talents and glyphs - ie: level <= 60 bot only uses talents +# available in vanilla, level <= 70 bot only uses talents available in TBC) +# Default: 0 +AiPlayerbot.LimitTalentsExpansion = 0 + # # # diff --git a/src/PlayerbotAIConfig.cpp b/src/PlayerbotAIConfig.cpp index 461faca5..91962734 100644 --- a/src/PlayerbotAIConfig.cpp +++ b/src/PlayerbotAIConfig.cpp @@ -485,6 +485,7 @@ bool PlayerbotAIConfig::Initialize() randomBotAllianceRatio = sConfigMgr->GetOption("AiPlayerbot.RandomBotAllianceRatio", 50); randomBotHordeRatio = sConfigMgr->GetOption("AiPlayerbot.RandomBotHordeRatio", 50); disableDeathKnightLogin = sConfigMgr->GetOption("AiPlayerbot.DisableDeathKnightLogin", 0); + limitTalentsExpansion = sConfigMgr->GetOption("AiPlayerbot.LimitTalentsExpansion", 0); botActiveAlone = sConfigMgr->GetOption("AiPlayerbot.BotActiveAlone", 100); BotActiveAloneForceWhenInRadius = sConfigMgr->GetOption("AiPlayerbot.BotActiveAloneForceWhenInRadius", 150); BotActiveAloneForceWhenInZone = sConfigMgr->GetOption("AiPlayerbot.BotActiveAloneForceWhenInZone", 1); diff --git a/src/PlayerbotAIConfig.h b/src/PlayerbotAIConfig.h index 2f91ed76..527fb6cd 100644 --- a/src/PlayerbotAIConfig.h +++ b/src/PlayerbotAIConfig.h @@ -279,6 +279,7 @@ public: uint32 randomBotAllianceRatio; uint32 randomBotHordeRatio; bool disableDeathKnightLogin; + bool limitTalentsExpansion; uint32 botActiveAlone; uint32 BotActiveAloneForceWhenInRadius; bool BotActiveAloneForceWhenInZone; diff --git a/src/factory/PlayerbotFactory.cpp b/src/factory/PlayerbotFactory.cpp index ac4d907f..7a9a9f4e 100644 --- a/src/factory/PlayerbotFactory.cpp +++ b/src/factory/PlayerbotFactory.cpp @@ -1021,13 +1021,13 @@ void PlayerbotFactory::InitTalentsTree(bool increment /*false*/, bool use_templa { InitTalentsByTemplate(specTab); } - // always use template now - // else - // { - // InitTalents(specTab); - // if (bot->GetFreeTalentPoints()) - // InitTalents((specTab + 1) % 3); - // } + // if LimitTalentsExpansion = 1 there may be unused talent points + if (bot->GetFreeTalentPoints()) + InitTalents((specTab + 1) % 3); + + if (bot->GetFreeTalentPoints()) + InitTalents((specTab + 2) % 3); + bot->SendTalentsInfoData(false); } @@ -2620,6 +2620,12 @@ void PlayerbotFactory::InitTalentsByTemplate(uint32 specTab) for (std::vector& p : sPlayerbotAIConfig->parsedSpecLinkOrder[cls][specIndex][level]) { uint32 tab = p[0], row = p[1], col = p[2], lvl = p[3]; + if (sPlayerbotAIConfig->limitTalentsExpansion && bot->GetLevel() <= 60 && (row > 6 || (row == 6 && col != 1))) + continue; + + if (sPlayerbotAIConfig->limitTalentsExpansion && bot->GetLevel() <= 70 && (row > 8 || (row == 8 && col != 1))) + continue; + uint32 talentID = 0; uint32 learnLevel = 0; std::vector& spells = spells_row[row]; @@ -3224,6 +3230,12 @@ void PlayerbotFactory::InitGlyphs(bool increment) } } + if (sPlayerbotAIConfig->limitTalentsExpansion && bot->GetLevel() <= 70) + { + bot->SendTalentsInfoData(false); + return; + } + uint32 level = bot->GetLevel(); uint32 maxSlot = 0; if (level >= 15)