From b5426152fb89f904d1559bafab5d3a9141f1df4a Mon Sep 17 00:00:00 2001 From: NoxMax <50133316+NoxMax@users.noreply.github.com> Date: Sun, 18 May 2025 05:31:32 -0600 Subject: [PATCH] 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 --- conf/playerbots.conf.dist | 136 +++++++++++++++++++++++++++++++++++++ src/PlayerbotAIConfig.cpp | 35 ++++++++++ src/PlayerbotAIConfig.h | 1 + src/RandomPlayerbotMgr.cpp | 7 +- 4 files changed, 178 insertions(+), 1 deletion(-) diff --git a/conf/playerbots.conf.dist b/conf/playerbots.conf.dist index e7e28d9e..295cdf11 100644 --- a/conf/playerbots.conf.dist +++ b/conf/playerbots.conf.dist @@ -810,6 +810,142 @@ AiPlayerbot.RandomBotTeleHigherLevel = 3 # Default: 1 (enabled) AiPlayerbot.AutoTeleportForLevel = 1 +# Bots' minimum and maximum level when teleporting in and out of a zone, according to the new RPG strategy +# Requires EnableNewRpgStrategy enabled +# Format: AiPlayerbot.ZoneBracket.zoneID = minLevel,maxLevel +# +# Classic WoW - Low-level zones: +# Dun Morogh (Zone ID: 1 Default Min,Max: 5,12) +# Elwynn Forest (Zone ID: 12 Default Min,Max: 5,12) +# Durotar (Zone ID: 14 Default Min,Max: 5,12) +# Tirisfal Glades (Zone ID: 85 Default Min,Max: 5,12) +# Teldrassil (Zone ID: 141 Default Min,Max: 5,12) +# Mulgore (Zone ID: 215 Default Min,Max: 5,12) +# Eversong Woods (Zone ID: 3430 Default Min,Max: 5,12) +# Azuremyst Isle (Zone ID: 3524 Default Min,Max: 5,12) +AiPlayerbot.ZoneBracket.1 = 5,12 +AiPlayerbot.ZoneBracket.12 = 5,12 +AiPlayerbot.ZoneBracket.14 = 5,12 +AiPlayerbot.ZoneBracket.85 = 5,12 +AiPlayerbot.ZoneBracket.141 = 5,12 +AiPlayerbot.ZoneBracket.215 = 5,12 +AiPlayerbot.ZoneBracket.3430 = 5,12 +AiPlayerbot.ZoneBracket.3524 = 5,12 + +# Classic WoW - Mid-level zones: +# Barrens (Zone ID: 17 Default Min,Max: 10,25) +# Loch Modan (Zone ID: 38 Default Min,Max: 10,20) +# Westfall (Zone ID: 40 Default Min,Max: 10,21) +# Silverpine Forest (Zone ID: 130 Default Min,Max: 10,23) +# Darkshore (Zone ID: 148 Default Min,Max: 10,21) +# Ghostlands (Zone ID: 3433 Default Min,Max: 10,22) +# Bloodmyst Isle (Zone ID: 3525 Default Min,Max: 10,21) +AiPlayerbot.ZoneBracket.17 = 10,25 +AiPlayerbot.ZoneBracket.38 = 10,20 +AiPlayerbot.ZoneBracket.40 = 10,21 +AiPlayerbot.ZoneBracket.130 = 10,23 +AiPlayerbot.ZoneBracket.148 = 10,21 +AiPlayerbot.ZoneBracket.3433 = 10,22 +AiPlayerbot.ZoneBracket.3525 = 10,21 + +# Classic WoW - High-level zones: +# Deadwind Pass (Zone ID: 10 Default Min,Max: 19,33) +# Wetlands (Zone ID: 11 Default Min,Max: 21,30) +# Redridge Mountains (Zone ID: 44 Default Min,Max: 16,28) +# Hillsbrad Foothills (Zone ID: 267 Default Min,Max: 20,34) +# Ashenvale (Zone ID: 331 Default Min,Max: 18,33) +# Thousand Needles (Zone ID: 400 Default Min,Max: 24,36) +# Stonetalon Mountains (Zone ID: 406 Default Min,Max: 16,29) +AiPlayerbot.ZoneBracket.10 = 19,33 +AiPlayerbot.ZoneBracket.11 = 21,30 +AiPlayerbot.ZoneBracket.44 = 16,28 +AiPlayerbot.ZoneBracket.267 = 20,34 +AiPlayerbot.ZoneBracket.331 = 18,33 +AiPlayerbot.ZoneBracket.400 = 24,36 +AiPlayerbot.ZoneBracket.406 = 16,29 + +# Classic WoW - Higher-level zones: +# Badlands (Zone ID: 3 Default Min,Max: 36,46) +# Swamp of Sorrows (Zone ID: 8 Default Min,Max: 36,46) +# Dustwallow Marsh (Zone ID: 15 Default Min,Max: 35,46) +# Azshara (Zone ID: 16 Default Min,Max: 45,52) +# Stranglethorn Vale (Zone ID: 33 Default Min,Max: 32,47) +# Arathi Highlands (Zone ID: 45 Default Min,Max: 30,42) +# Hinterlands (Zone ID: 47 Default Min,Max: 42,51) +# Searing Gorge (Zone ID: 51 Default Min,Max: 45,51) +# Feralas (Zone ID: 357 Default Min,Max: 40,52) +# Desolace (Zone ID: 405 Default Min,Max: 30,41) +# Tanaris (Zone ID: 440 Default Min,Max: 41,52) +AiPlayerbot.ZoneBracket.3 = 36,46 +AiPlayerbot.ZoneBracket.8 = 36,46 +AiPlayerbot.ZoneBracket.15 = 35,46 +AiPlayerbot.ZoneBracket.16 = 45,52 +AiPlayerbot.ZoneBracket.33 = 32,47 +AiPlayerbot.ZoneBracket.45 = 30,42 +AiPlayerbot.ZoneBracket.47 = 42,51 +AiPlayerbot.ZoneBracket.51 = 45,51 +AiPlayerbot.ZoneBracket.357 = 40,52 +AiPlayerbot.ZoneBracket.405 = 30,41 +AiPlayerbot.ZoneBracket.440 = 41,52 + +# Classic WoW - Top-level zones: +# Blasted Lands (Zone ID: 4 Default Min,Max: 52,57) +# Western Plaguelands (Zone ID: 28 Default Min,Max: 50,60) +# Burning Steppes (Zone ID: 46 Default Min,Max: 51,60) +# Eastern Plaguelands (Zone ID: 139 Default Min,Max: 54,62) +# Felwood (Zone ID: 361 Default Min,Max: 47,57) +# Un'Goro Crater (Zone ID: 490 Default Min,Max: 49,56) +# Winterspring (Zone ID: 618 Default Min,Max: 54,61) +# Silithus (Zone ID: 1377 Default Min,Max: 54,63) +AiPlayerbot.ZoneBracket.4 = 52,57 +AiPlayerbot.ZoneBracket.28 = 50,60 +AiPlayerbot.ZoneBracket.46 = 51,60 +AiPlayerbot.ZoneBracket.139 = 54,62 +AiPlayerbot.ZoneBracket.361 = 47,57 +AiPlayerbot.ZoneBracket.490 = 49,56 +AiPlayerbot.ZoneBracket.618 = 54,61 +AiPlayerbot.ZoneBracket.1377 = 54,63 + +# The Burning Crusade - Zones: +# Hellfire Peninsula (Zone ID: 3483 Default Min,Max: 58,66) +# Nagrand (Zone ID: 3518 Default Min,Max: 64,70) +# Terokkar Forest (Zone ID: 3519 Default Min,Max: 62,73) +# Shadowmoon Valley (Zone ID: 3520 Default Min,Max: 66,73) +# Zangarmarsh (Zone ID: 3521 Default Min,Max: 60,67) +# Blade's Edge Mountains (Zone ID: 3522 Default Min,Max: 64,73) +# Netherstorm (Zone ID: 3523 Default Min,Max: 67,73) +# Isle of Quel'Danas (Zone ID: 4080 Default Min,Max: 68,73) +AiPlayerbot.ZoneBracket.3483 = 58,66 +AiPlayerbot.ZoneBracket.3518 = 64,70 +AiPlayerbot.ZoneBracket.3519 = 62,73 +AiPlayerbot.ZoneBracket.3520 = 66,73 +AiPlayerbot.ZoneBracket.3521 = 60,67 +AiPlayerbot.ZoneBracket.3522 = 64,73 +AiPlayerbot.ZoneBracket.3523 = 67,73 +AiPlayerbot.ZoneBracket.4080 = 68,73 + +# Wrath of the Lich King - Zones: +# Dragonblight (Zone ID: 65 Default Min,Max: 71,77) +# Zul'Drak (Zone ID: 66 Default Min,Max: 74,80) +# Storm Peaks (Zone ID: 67 Default Min,Max: 77,80) +# Icecrown Glacier (Zone ID: 210 Default Min,Max: 77,80) +# Grizzly Hills (Zone ID: 394 Default Min,Max: 72,78) +# Howling Fjord (Zone ID: 495 Default Min,Max: 68,74) +# Crystalsong Forest (Zone ID: 2817 Default Min,Max: 77,80) +# Borean Tundra (Zone ID: 3537 Default Min,Max: 68,75) +# Sholazar Basin (Zone ID: 3711 Default Min,Max: 75,80) +# Wintergrasp (Zone ID: 4197 Default Min,Max: 79,80) +AiPlayerbot.ZoneBracket.65 = 71,77 +AiPlayerbot.ZoneBracket.66 = 74,80 +AiPlayerbot.ZoneBracket.67 = 77,80 +AiPlayerbot.ZoneBracket.210 = 77,80 +AiPlayerbot.ZoneBracket.394 = 72,78 +AiPlayerbot.ZoneBracket.495 = 68,74 +AiPlayerbot.ZoneBracket.2817 = 77,80 +AiPlayerbot.ZoneBracket.3537 = 68,75 +AiPlayerbot.ZoneBracket.3711 = 75,80 +AiPlayerbot.ZoneBracket.4197 = 79,80 + # # # diff --git a/src/PlayerbotAIConfig.cpp b/src/PlayerbotAIConfig.cpp index b034c66f..b0d0460b 100644 --- a/src/PlayerbotAIConfig.cpp +++ b/src/PlayerbotAIConfig.cpp @@ -312,6 +312,41 @@ bool PlayerbotAIConfig::Initialize() randomBotTeleHigherLevel = sConfigMgr->GetOption("AiPlayerbot.RandomBotTeleHigherLevel", 3); openGoSpell = sConfigMgr->GetOption("AiPlayerbot.OpenGoSpell", 6477); + // Zones for NewRpgStrategy teleportation brackets + std::vector 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(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("AiPlayerbot.RandomChangeMultiplier", 1.0); randomBotCombatStrategies = sConfigMgr->GetOption("AiPlayerbot.RandomBotCombatStrategies", "-threat"); diff --git a/src/PlayerbotAIConfig.h b/src/PlayerbotAIConfig.h index 6a32c95a..35060e48 100644 --- a/src/PlayerbotAIConfig.h +++ b/src/PlayerbotAIConfig.h @@ -195,6 +195,7 @@ public: bool randomBotLoginAtStartup; uint32 randomBotTeleLowerLevel, randomBotTeleHigherLevel; + std::map> zoneBrackets; bool logInGroupOnly, logValuesPerTick; bool fleeingEnabled; bool summonAtInnkeepersEnabled; diff --git a/src/RandomPlayerbotMgr.cpp b/src/RandomPlayerbotMgr.cpp index a899995e..4711ed03 100644 --- a/src/RandomPlayerbotMgr.cpp +++ b/src/RandomPlayerbotMgr.cpp @@ -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()