aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 7f0922b1b9e..3ef70be459c 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
@@ -279,6 +279,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)
@@ -367,6 +369,13 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* player)
_flagsTimer[GetTeamIndexByTeamId(team) ? 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)
{
@@ -515,11 +524,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
{
@@ -552,11 +557,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 a3eb9f56503..156eb8dd87b 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h
@@ -245,6 +245,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, bool entered) override;