From 08008a315517432893b32c7703a27e3ba5071cf5 Mon Sep 17 00:00:00 2001 From: kadeshar Date: Sat, 8 Feb 2025 12:31:06 +0100 Subject: [PATCH] Worldbuff startup fix (#951) * - [Performance] Fixed world buff loading from config file * - [Refactoring] Changed mathod name --- src/PlayerbotAIConfig.cpp | 11 ++++++----- src/PlayerbotAIConfig.h | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/PlayerbotAIConfig.cpp b/src/PlayerbotAIConfig.cpp index dde4a2a3..461faca5 100644 --- a/src/PlayerbotAIConfig.cpp +++ b/src/PlayerbotAIConfig.cpp @@ -419,14 +419,15 @@ bool PlayerbotAIConfig::Initialize() { for (uint32 classId = 0; classId < MAX_CLASSES; classId++) { - for (uint32 specId = 0; specId < MAX_SPECNO; specId++) + for (uint32 specId = 0; specId <= MAX_WORLDBUFF_SPECNO; specId++) { - for (uint32 minLevel = 0; minLevel < MAX_LEVEL; minLevel++) + for (uint32 minLevel = 0; minLevel <= randomBotMaxLevel; minLevel++) { - for (uint32 maxLevel = 0; maxLevel < MAX_LEVEL; maxLevel++) + for (uint32 maxLevel = minLevel; maxLevel <= randomBotMaxLevel; maxLevel++) { - loadWorldBuf(factionId, classId, specId, minLevel, maxLevel); + loadWorldBuff(factionId, classId, specId, minLevel, maxLevel); } + loadWorldBuff(factionId, classId, specId, minLevel, 0); } } } @@ -673,7 +674,7 @@ void PlayerbotAIConfig::log(std::string const fileName, char const* str, ...) fflush(stdout); } -void PlayerbotAIConfig::loadWorldBuf(uint32 factionId1, uint32 classId1, uint32 specId1, uint32 minLevel1, uint32 maxLevel1) +void PlayerbotAIConfig::loadWorldBuff(uint32 factionId1, uint32 classId1, uint32 specId1, uint32 minLevel1, uint32 maxLevel1) { std::vector buffs; diff --git a/src/PlayerbotAIConfig.h b/src/PlayerbotAIConfig.h index b383ab45..2f91ed76 100644 --- a/src/PlayerbotAIConfig.h +++ b/src/PlayerbotAIConfig.h @@ -35,6 +35,7 @@ enum class HealingManaEfficiency : uint8 }; #define MAX_SPECNO 20 +#define MAX_WORLDBUFF_SPECNO 3 class PlayerbotAIConfig { @@ -358,7 +359,7 @@ public: } void log(std::string const fileName, const char* str, ...); - void loadWorldBuf(uint32 factionId, uint32 classId, uint32 specId, uint32 minLevel, uint32 maxLevel); + void loadWorldBuff(uint32 factionId, uint32 classId, uint32 specId, uint32 minLevel, uint32 maxLevel); static std::vector> ParseTempTalentsOrder(uint32 cls, std::string temp_talents_order); static std::vector> ParseTempPetTalentsOrder(uint32 spec, std::string temp_talents_order); };