aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGildor <gildor55@gmail.com>2022-09-02 14:58:57 +0200
committerGitHub <noreply@github.com>2022-09-02 14:58:57 +0200
commitd86dcce1c855c5d2d5b48c00ef0e929f87b8b36e (patch)
treedd2b0415ea0e8b1106a2995f7439c8496996824f
parent6e37438e5dadd30dc2ce36e468045e0be4d26c83 (diff)
Core/Battlegrounds: Capture flag immediately when standing on capture point and your team's flag return due to drop timer ended (#28200)
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp21
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundWS.h1
2 files changed, 12 insertions, 10 deletions
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
index c19015dd095..59353ac8db1 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
@@ -292,6 +292,8 @@ void BattlegroundWS::RespawnFlagAfterDrop(uint32 team)
SetDroppedFlagGUID(ObjectGuid::Empty, GetTeamIndexByTeamId(team));
_bothFlagsKept = false;
+ // Check opposing flag if it is in capture zone; if so, capture it
+ HandleFlagRoomCapturePoint(team == ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE);
}
void BattlegroundWS::EventPlayerCapturedFlag(Player* player)
@@ -381,6 +383,13 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* player)
_flagsTimer[GetTeamIndexByTeamId(player->GetTeam()) ? 0 : 1] = BG_WS_FLAG_RESPAWN_TIME;
}
}
+void BattlegroundWS::HandleFlagRoomCapturePoint(int32 team)
+{
+ Player* flagCarrier = ObjectAccessor::GetPlayer(GetBgMap(), GetFlagPickerGUID(team));
+ uint32 areaTrigger = team == TEAM_ALLIANCE ? 3647 : 3646;
+ if (flagCarrier && flagCarrier->IsInAreaTriggerRadius(sAreaTriggerStore.LookupEntry(areaTrigger)))
+ EventPlayerCapturedFlag(flagCarrier);
+}
void BattlegroundWS::EventPlayerDroppedFlag(Player* player)
{
@@ -534,11 +543,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target
PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED);
UpdatePlayerScore(player, SCORE_FLAG_RETURNS, 1);
_bothFlagsKept = false;
-
- // Check Horde flag if it is in capture zone; if so, capture it
- if (Player* hordeFlagCarrier = ObjectAccessor::GetPlayer(GetBgMap(), GetFlagPickerGUID(TEAM_HORDE)))
- if (hordeFlagCarrier->IsInAreaTriggerRadius(sAreaTriggerStore.LookupEntry(3646)))
- EventPlayerCapturedFlag(hordeFlagCarrier);
+ HandleFlagRoomCapturePoint(TEAM_HORDE); // Check Horde flag if it is in capture zone; if so, capture it
}
else
{
@@ -572,11 +577,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target
PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED);
UpdatePlayerScore(player, SCORE_FLAG_RETURNS, 1);
_bothFlagsKept = false;
-
- // Check Alliance flag if it is in capture zone; if so, capture it
- if (Player* allianceFlagCarrier = ObjectAccessor::GetPlayer(GetBgMap(), GetFlagPickerGUID(TEAM_ALLIANCE)))
- if (allianceFlagCarrier->IsInAreaTriggerRadius(sAreaTriggerStore.LookupEntry(3647)))
- EventPlayerCapturedFlag(allianceFlagCarrier);
+ HandleFlagRoomCapturePoint(TEAM_ALLIANCE); // Check Alliance flag if it is in capture zone; if so, capture it
}
else
{
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h
index a7d02c6139c..aa120ab8f3a 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h
@@ -226,6 +226,7 @@ class BattlegroundWS : public Battleground
void EventPlayerDroppedFlag(Player* player) override;
void EventPlayerClickedOnFlag(Player* player, GameObject* target_obj) override;
void EventPlayerCapturedFlag(Player* player);
+ void HandleFlagRoomCapturePoint(int32 team);
void RemovePlayer(Player* player, ObjectGuid guid, uint32 team) override;
void HandleAreaTrigger(Player* player, uint32 trigger) override;