Core/Battlegrounds: Capture flag immediately when standing on capture point and your team's flag return due to drop timer ended

Port From (https://github.com/TrinityCore/TrinityCore/commit/a1ddf5195b8d03ea87248b7037a3e50e3e793d8e)
This commit is contained in:
hondacrx
2022-09-07 13:07:49 -04:00
parent 5e22c92a87
commit 1d1456b0bb
+12 -10
View File
@@ -252,6 +252,8 @@ namespace Game.BattleGrounds.Zones
SetDroppedFlagGUID(ObjectGuid.Empty, GetTeamIndexByTeamId(team));
_bothFlagsKept = false;
// Check opposing flag if it is in capture zone; if so, capture it
HandleFlagRoomCapturePoint(team == Team.Alliance ? TeamId.Horde : TeamId.Alliance);
}
void EventPlayerCapturedFlag(Player player)
@@ -341,6 +343,14 @@ namespace Game.BattleGrounds.Zones
}
}
void HandleFlagRoomCapturePoint(int team)
{
Player flagCarrier = Global.ObjAccessor.GetPlayer(GetBgMap(), GetFlagPickerGUID(team));
uint areaTrigger = team == TeamId.Alliance ? 3647 : 3646u;
if (flagCarrier != null && flagCarrier.IsInAreaTriggerRadius(CliDB.AreaTriggerStorage.LookupByKey(areaTrigger)))
EventPlayerCapturedFlag(flagCarrier);
}
public override void EventPlayerDroppedFlag(Player player)
{
Team team = GetPlayerTeam(player.GetGUID());
@@ -489,11 +499,7 @@ namespace Game.BattleGrounds.Zones
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);
HandleFlagRoomCapturePoint(TeamId.Horde); // Check Horde flag if it is in capture zone; if so, capture it
}
else
{
@@ -527,11 +533,7 @@ namespace Game.BattleGrounds.Zones
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);
HandleFlagRoomCapturePoint(TeamId.Alliance); // Check Alliance flag if it is in capture zone; if so, capture it
}
else
{