Core/Battlegrounds: Capture flags immediately when standing on capture point and your team's flag gets returned

Port From (https://github.com/TrinityCore/TrinityCore/commit/bd74524d4c150c5dbaac850a8965d2953953a8f6)
This commit is contained in:
hondacrx
2022-09-07 13:04:59 -04:00
parent 13b221475b
commit 5e22c92a87
@@ -18,6 +18,8 @@
using Framework.Constants;
using Game.Entities;
using Game.Networking.Packets;
using Game.DataStorage;
using System.Collections.Generic;
namespace Game.BattleGrounds.Zones
{
@@ -486,6 +488,12 @@ namespace Game.BattleGrounds.Zones
PlaySoundToAll(WSGSound.FlagReturned);
UpdatePlayerScore(player, ScoreType.FlagReturns, 1);
_bothFlagsKept = false;
// Check Horde flag if it is in capture zone; if so, capture it
Player hordeFlagCarrier = Global.ObjAccessor.GetPlayer(GetBgMap(), GetFlagPickerGUID(TeamId.Horde));
if (hordeFlagCarrier != null)
if (hordeFlagCarrier.IsInAreaTriggerRadius(CliDB.AreaTriggerStorage.LookupByKey(3646)))
EventPlayerCapturedFlag(hordeFlagCarrier);
}
else
{
@@ -518,6 +526,12 @@ namespace Game.BattleGrounds.Zones
PlaySoundToAll(WSGSound.FlagReturned);
UpdatePlayerScore(player, ScoreType.FlagReturns, 1);
_bothFlagsKept = false;
// Check Alliance flag if it is in capture zone; if so, capture it
Player allianceFlagCarrier = Global.ObjAccessor.GetPlayer(GetBgMap(), GetFlagPickerGUID(TeamId.Alliance));
if (allianceFlagCarrier != null)
if (allianceFlagCarrier.IsInAreaTriggerRadius(CliDB.AreaTriggerStorage.LookupByKey(3647)))
EventPlayerCapturedFlag(allianceFlagCarrier);
}
else
{