Expose zone level brackets to user configuration (#1309)

* Make variable name more intuitive

* Make variable name more intuitive

* Make variable name more intuitive and clarify function

* Update playerbots.conf.dist

* Update PlayerbotAIConfig.cpp

* Update PlayerbotAIConfig.h

* Update RandomPlayerbotMgr.cpp

* Update playerbots.conf.dist

* Update playerbots.conf.dist

* Update playerbots.conf.dist

* Update playerbots.conf.dist

* Update playerbots.conf.dist

* Update playerbots.conf.dist
This commit is contained in:
NoxMax
2025-05-18 05:31:32 -06:00
committed by GitHub
parent f3ee83d471
commit b5426152fb
4 changed files with 178 additions and 1 deletions

View File

@@ -312,6 +312,41 @@ bool PlayerbotAIConfig::Initialize()
randomBotTeleHigherLevel = sConfigMgr->GetOption<int32>("AiPlayerbot.RandomBotTeleHigherLevel", 3);
openGoSpell = sConfigMgr->GetOption<int32>("AiPlayerbot.OpenGoSpell", 6477);
// Zones for NewRpgStrategy teleportation brackets
std::vector<uint32> zoneIds = {
// Classic WoW - Low-level zones
1, 12, 14, 85, 141, 215, 3430, 3524,
// Classic WoW - Mid-level zones
17, 38, 40, 130, 148, 3433, 3525,
// Classic WoW - High-level zones
10, 11, 44, 267, 331, 400, 406,
// Classic WoW - Higher-level zones
3, 8, 15, 16, 33, 45, 47, 51, 357, 405, 440,
// Classic WoW - Top-level zones
4, 28, 46, 139, 361, 490, 618, 1377,
// The Burning Crusade - Zones
3483, 3518, 3519, 3520, 3521, 3522, 3523, 4080,
// Wrath of the Lich King - Zones
65, 66, 67, 210, 394, 495, 2817, 3537, 3711, 4197
};
for (uint32 zoneId : zoneIds)
{
std::string setting = "AiPlayerbot.ZoneBracket." + std::to_string(zoneId);
std::string value = sConfigMgr->GetOption<std::string>(setting, "");
if (!value.empty())
{
size_t commaPos = value.find(',');
if (commaPos != std::string::npos)
{
uint32 minLevel = atoi(value.substr(0, commaPos).c_str());
uint32 maxLevel = atoi(value.substr(commaPos + 1).c_str());
zoneBrackets[zoneId] = std::make_pair(minLevel, maxLevel);
}
}
}
randomChangeMultiplier = sConfigMgr->GetOption<float>("AiPlayerbot.RandomChangeMultiplier", 1.0);
randomBotCombatStrategies = sConfigMgr->GetOption<std::string>("AiPlayerbot.RandomBotCombatStrategies", "-threat");

View File

@@ -195,6 +195,7 @@ public:
bool randomBotLoginAtStartup;
uint32 randomBotTeleLowerLevel, randomBotTeleHigherLevel;
std::map<uint32, std::pair<uint32, uint32>> zoneBrackets;
bool logInGroupOnly, logValuesPerTick;
bool fleeingEnabled;
bool summonAtInnkeepersEnabled;

View File

@@ -1563,7 +1563,12 @@ void RandomPlayerbotMgr::PrepareZone2LevelBracket()
zone2LevelBracket[2817] = {77, 80}; // Crystalsong Forest
zone2LevelBracket[3537] = {68, 75}; // Borean Tundra
zone2LevelBracket[3711] = {75, 80}; // Sholazar Basin
zone2LevelBracket[4197] = {79, 80}; // Wintergrasp
zone2LevelBracket[4197] = {79, 80}; // Wintergrasp
// Override with values from config
for (auto const& [zoneId, bracketPair] : sPlayerbotAIConfig->zoneBrackets) {
zone2LevelBracket[zoneId] = {bracketPair.first, bracketPair.second};
}
}
void RandomPlayerbotMgr::PrepareTeleportCache()