Skip to content

Commit

Permalink
Fix bots joining bgs and ignoring amount limit
Browse files Browse the repository at this point in the history
  • Loading branch information
davidonete committed Jan 19, 2025
1 parent 977247b commit 824c9f9
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions playerbot/strategy/actions/BattleGroundJoinAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,9 +490,14 @@ bool BGJoinAction::shouldJoinBg(BattleGroundQueueTypeId queueTypeId, BattleGroun
if (!isArena && bot->GetGroup() && !bot->GetGroup()->IsLeader(bot->GetObjectGuid()))
return false;

bool needBots = sRandomPlayerbotMgr.NeedBots[queueTypeId][bracketId][isArena ? isRated : GetTeamIndexByTeamId(bot->GetTeam())];
// do not join if BG queue is full
if (BgCount >= BracketSize && (ACount >= TeamSize) && (HCount >= TeamSize))
{
return false;
}

// add more bots if players are not invited or if 1st BG instance is full
bool needBots = sRandomPlayerbotMgr.NeedBots[queueTypeId][bracketId][isArena ? isRated : GetTeamIndexByTeamId(bot->GetTeam())];
if (needBots || (hasPlayers && BgCount > BracketSize && (BgCount % BracketSize) != 0))
{
bool needAlly = HCount >= ACount;
Expand All @@ -512,12 +517,6 @@ bool BGJoinAction::shouldJoinBg(BattleGroundQueueTypeId queueTypeId, BattleGroun
}
}

// do not join if BG queue is full
if (BgCount >= BracketSize && (ACount >= TeamSize) && (HCount >= TeamSize))
{
return false;
}

if (!isArena && ((ACount >= TeamSize && TeamId == 0) || (HCount >= TeamSize && TeamId == 1)))
{
return false;
Expand Down Expand Up @@ -837,7 +836,7 @@ bool BGJoinAction::JoinQueue(uint32 type)
}
#endif

bot->GetSession()->HandleBattlemasterJoinOpcode(packet);
ai->QueuePacket(packet);
return true;
}

Expand Down Expand Up @@ -1331,7 +1330,7 @@ bool BGStatusAction::Execute(Event& event)
// temp fix for crash
//return true;

#ifdef MANGOSBOT_TWOx
#ifdef MANGOSBOT_TWO
BattleGroundQueue& bgQueue = sServerFacade.bgQueue(queueTypeId);
GroupQueueInfo ginfo;
if (bgQueue.GetPlayerGroupInfoData(bot->GetObjectGuid(), &ginfo))
Expand Down

0 comments on commit 824c9f9

Please sign in to comment.