diff options
Diffstat (limited to 'src/game/BattleGroundWS.cpp')
-rw-r--r-- | src/game/BattleGroundWS.cpp | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/game/BattleGroundWS.cpp b/src/game/BattleGroundWS.cpp index 63dd2f48a0b..0071e2c615c 100644 --- a/src/game/BattleGroundWS.cpp +++ b/src/game/BattleGroundWS.cpp @@ -67,9 +67,32 @@ BattleGroundWS::~BattleGroundWS() void BattleGroundWS::Update(uint32 diff) { BattleGround::Update(diff); - + if (GetStatus() == STATUS_IN_PROGRESS) { + if( GetStartTime() >= 25*MINUTE*1000 ) // Таймер тикать начинает после 25 минут + { + if( GetTeamScore(ALLIANCE) == 0 ) + { + if ( GetTeamScore(HORDE) == 0 ) // No one scored - result is tie + EndBattleGround(NULL); + + else // Horde has more points and thus wins + EndBattleGround(HORDE); + } + + else if( GetTeamScore(HORDE) == 0 ) + EndBattleGround(ALLIANCE); // Alliance has >0, Horde has 0, alliance wins + + else if( GetTeamScore(HORDE) == GetTeamScore(ALLIANCE) ) // Team score equal, winner is team that scored the first flag + EndBattleGround(m_FirstFlagCaptureTeam); + + else if( GetTeamScore(HORDE) > GetTeamScore(ALLIANCE) ) // Last but not least, check who has the higher score + EndBattleGround(HORDE); + else + EndBattleGround(ALLIANCE); + } + if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_WAIT_RESPAWN) { m_FlagsTimer[BG_TEAM_ALLIANCE] -= diff; @@ -225,7 +248,7 @@ void BattleGroundWS::RespawnFlagAfterDrop(uint32 team) PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED); - GameObject *obj = HashMapHolder<GameObject>::Find(GetDroppedFlagGUID(team)); + GameObject *obj = GetBgMap()->GetGameObject(GetDroppedFlagGUID(team)); if (obj) obj->Delete(); else @@ -294,6 +317,9 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source) UpdateTeamScore(Source->GetTeam()); // only flag capture should be updated UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures + + if(!m_FirstFlagCaptureTeam) + SetFirstFlagCapture(Source->GetTeam()); if (GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE) winner = ALLIANCE; |