From 4bd5a9b89cbfbec21c89de34783f778d6c7e1b98 Mon Sep 17 00:00:00 2001 From: Keleborn <22352763+Celandriel@users.noreply.github.com> Date: Sun, 26 Apr 2026 10:14:17 -0700 Subject: [PATCH] Crash Fix. Queue arena packet instead of handle directly. (#2331) ## Pull Request Description Have arenas follow the same path as battlegrounds when queueing . Intended to to resolve discord user crash. ## Feature Evaluation - Describe the **minimum logic** required to achieve the intended behavior. - Describe the **processing cost** when this logic executes across many bots. ## How to Test the Changes ## Impact Assessment - Does this change increase per-bot/per-tick processing or risk scaling poorly with thousands of bots? - - [x] No, not at all - - [ ] Minimal impact (**explain below**) - - [ ] Moderate impact (**explain below**) - Does this change modify default bot behavior? - - [x] No - - [ ] Yes (**explain why**) - Does this change add new decision branches or increase maintenance complexity? - - [x] No - - [ ] Yes (**explain below**) ## AI Assistance Was AI assistance used while working on this change? - - [x] No - - [ ] Yes (**explain below**) ## Final Checklist - - [x] Stability is not compromised. - - [x] Performance impact is understood, tested, and acceptable. - - [x] Added logic complexity is justified and explained. - - [x] Any new bot dialogue lines are translated. - - [x] Documentation updated if needed (Conf comments, WiKi commands). ## Notes for Reviewers --- src/Ai/Base/Actions/BattleGroundJoinAction.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Ai/Base/Actions/BattleGroundJoinAction.cpp b/src/Ai/Base/Actions/BattleGroundJoinAction.cpp index fdc13120f..ab897a1b2 100644 --- a/src/Ai/Base/Actions/BattleGroundJoinAction.cpp +++ b/src/Ai/Base/Actions/BattleGroundJoinAction.cpp @@ -534,21 +534,18 @@ bool BGJoinAction::JoinQueue(uint32 type) botAI->GetAiObjectContext()->GetValue("bg type")->Set(0); + WorldPacket* packet = nullptr; if (!isArena) { - WorldPacket* packet = new WorldPacket(CMSG_BATTLEMASTER_JOIN, 20); + packet = new WorldPacket(CMSG_BATTLEMASTER_JOIN, 20); *packet << bot->GetGUID() << bgTypeId_ << instanceId << joinAsGroup; - /// FIX race condition - // bot->GetSession()->HandleBattlemasterJoinOpcode(packet); - bot->GetSession()->QueuePacket(packet); } else { - WorldPacket arena_packet(CMSG_BATTLEMASTER_JOIN_ARENA, 20); - arena_packet << unit->GetGUID() << arenaslot << asGroup << uint8(isRated); - bot->GetSession()->HandleBattlemasterJoinArena(arena_packet); + packet = new WorldPacket(CMSG_BATTLEMASTER_JOIN_ARENA, 20); + *packet << unit->GetGUID() << arenaslot << asGroup << uint8(isRated); } - + bot->GetSession()->QueuePacket(packet); return true; }