From 5c89215f01cae17af1ad3db495b1d94f88256ecd Mon Sep 17 00:00:00 2001 From: Andrew <47818697+Nyeriah@users.noreply.github.com> Date: Mon, 20 Apr 2026 06:41:21 -0300 Subject: [PATCH] fix(Core/Battlegrounds): despawn docks vehicles on IoC node contest (#25160) Co-authored-by: Claude Opus 4.6 --- .../Battlegrounds/Zones/BattlegroundIC.cpp | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp index 2d43dbdf4..b3d204b5d 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp @@ -745,6 +745,31 @@ void BattlegroundIC::HandleContestedNodes(ICNodePoint* nodePoint) (*itr)->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE); } } + else if (nodePoint->nodeType == NODE_TYPE_DOCKS) + { + auto removeUnusedVehicles = [&](uint8 baseType, uint8 count) + { + for (uint8 i = 0; i < count; ++i) + { + uint8 type = baseType + i; + if (Creature* vehicle = GetBgMap()->GetCreature(BgCreatures[type])) + { + if (Vehicle* veh = vehicle->GetVehicleKit()) + if (!veh->IsVehicleInUse()) + { + respawnMap.erase(vehicle->GetGUID()); + DelCreature(type); + } + } + } + }; + + uint8 glaiveBase = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_H : BG_IC_NPC_GLAIVE_THROWER_1_A); + removeUnusedVehicles(glaiveBase, MAX_GLAIVE_THROWERS_SPAWNS_PER_FACTION); + + uint8 catapultBase = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_H : BG_IC_NPC_CATAPULT_1_A); + removeUnusedVehicles(catapultBase, MAX_CATAPULTS_SPAWNS_PER_FACTION); + } else if (nodePoint->nodeType == NODE_TYPE_REFINERY || nodePoint->nodeType == NODE_TYPE_QUARRY) { // nodePoint->faction is the assaulting team (set before this call);