Playerbot: never down-level bots below their natural level
The alt/companion finalize paths used 'bot->GetLevel() != targetLevel' and called GiveLevel(owner level) — a bot that naturally out-leveled the owner (e.g. hit 10 while owner was 9) got reset back DOWN to the owner's level, wiping XP and breaking progression, and jumbling the bot's stats (the recurring 'bots show the player's 1110/1000 stats' bug). Only level UP: change the guards to '<' so bots are never reset below where they already are.
This commit is contained in:
@@ -1305,7 +1305,7 @@ void Module::OnWorldUpdate(std::chrono::milliseconds diff)
|
|||||||
ObjectGuid::Create<HighGuid::Player>(botId)))
|
ObjectGuid::Create<HighGuid::Player>(botId)))
|
||||||
{
|
{
|
||||||
uint8 const ownerLevel = owner->GetLevel();
|
uint8 const ownerLevel = owner->GetLevel();
|
||||||
if (bot->GetLevel() != ownerLevel)
|
if (bot->GetLevel() < ownerLevel)
|
||||||
{
|
{
|
||||||
bot->GiveLevel(ownerLevel);
|
bot->GiveLevel(ownerLevel);
|
||||||
g_lastLevelSyncMs[uint64(botId)] = now_ms;
|
g_lastLevelSyncMs[uint64(botId)] = now_ms;
|
||||||
@@ -3641,7 +3641,9 @@ void Module::DrainCompanionFinalizes(uint32 now_ms)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
uint8 const targetLevel = entry.level ? entry.level : owner->GetLevel();
|
uint8 const targetLevel = entry.level ? entry.level : owner->GetLevel();
|
||||||
if (bot->GetLevel() != targetLevel)
|
// Only level UP — never reset a bot that naturally out-leveled the
|
||||||
|
// owner back down (that broke progression and jumbled stats).
|
||||||
|
if (bot->GetLevel() < targetLevel)
|
||||||
{
|
{
|
||||||
bot->GiveLevel(targetLevel);
|
bot->GiveLevel(targetLevel);
|
||||||
bot->InitTalentForLevel();
|
bot->InitTalentForLevel();
|
||||||
@@ -3825,7 +3827,9 @@ void Module::DrainAltFinalizes(uint32 /*now_ms*/)
|
|||||||
|
|
||||||
// ----- success path -----
|
// ----- success path -----
|
||||||
uint8 const lvl = e.level ? e.level : owner->GetLevel();
|
uint8 const lvl = e.level ? e.level : owner->GetLevel();
|
||||||
if (bot->GetLevel() != lvl)
|
// Only level UP — never reset a bot that naturally out-leveled the
|
||||||
|
// owner back down (that broke progression and jumbled stats).
|
||||||
|
if (bot->GetLevel() < lvl)
|
||||||
{
|
{
|
||||||
bot->GiveLevel(lvl);
|
bot->GiveLevel(lvl);
|
||||||
bot->InitTalentForLevel();
|
bot->InitTalentForLevel();
|
||||||
|
|||||||
Reference in New Issue
Block a user