From 84e6f6ef9df808fc96bf75acd80f146acd0f6bcb Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Thu, 8 Aug 2024 11:59:01 +0800 Subject: [PATCH] Fix itemQuality for random bots --- src/PlayerbotFactory.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/PlayerbotFactory.cpp b/src/PlayerbotFactory.cpp index 4591471b..84812822 100644 --- a/src/PlayerbotFactory.cpp +++ b/src/PlayerbotFactory.cpp @@ -55,6 +55,15 @@ PlayerbotFactory::PlayerbotFactory(Player* bot, uint32 level, uint32 itemQuality : level(level), itemQuality(itemQuality), gearScoreLimit(gearScoreLimit), bot(bot) { botAI = GET_PLAYERBOT_AI(bot); + if (!this->itemQuality) + { + uint32 gs = sPlayerbotAIConfig->randomGearScoreLimit == 0 + ? 0 + : PlayerbotFactory::CalcMixedGearScore(sPlayerbotAIConfig->randomGearScoreLimit, + sPlayerbotAIConfig->randomGearQualityLimit); + this->itemQuality = sPlayerbotAIConfig->randomGearQualityLimit; + this->gearScoreLimit = gs; + } } void PlayerbotFactory::Init() @@ -149,16 +158,6 @@ void PlayerbotFactory::Init() void PlayerbotFactory::Prepare() { - if (!itemQuality) - { - uint32 gs = sPlayerbotAIConfig->randomGearScoreLimit == 0 - ? 0 - : PlayerbotFactory::CalcMixedGearScore(sPlayerbotAIConfig->randomGearScoreLimit, - sPlayerbotAIConfig->randomGearQualityLimit); - itemQuality = sPlayerbotAIConfig->randomGearQualityLimit; - gearScoreLimit = gs; - } - if (bot->isDead()) bot->ResurrectPlayer(1.0f, false);