diff options
Diffstat (limited to 'src/server/game/Battlegrounds/Battleground.cpp')
-rwxr-xr-x | src/server/game/Battlegrounds/Battleground.cpp | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index eb7ce9a64a4..13d434ff0e9 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -146,6 +146,7 @@ Battleground::Battleground() m_IsArena = false; m_Winner = 2; m_StartTime = 0; + m_CountdownTimer = 0; m_ResetStatTimer = 0; m_ValidStartPositionTimer = 0; m_Events = 0; @@ -298,7 +299,11 @@ void Battleground::Update(uint32 diff) // Update start time and reset stats timer m_StartTime += diff; - m_ResetStatTimer += diff; + if (GetStatus() == STATUS_WAIT_JOIN) + { + m_ResetStatTimer += diff; + m_CountdownTimer += diff; + } PostUpdateImpl(diff); } @@ -462,7 +467,6 @@ inline void Battleground::_ProcessJoin(uint32 diff) ModifyStartDelayTime(diff); // I know it's a too big but it's the value sent in packet, I get it from retail sniff. - // I think it's link to the countdown when bgs start SetRemainingTime(300000); if (m_ResetStatTimer > 5000) @@ -473,6 +477,23 @@ inline void Battleground::_ProcessJoin(uint32 diff) player->ResetAllPowers(); } + // Send packet every 10 seconds until the 2nd field reach 0 + if (m_CountdownTimer >= 10000) + { + uint32 countdownMaxForBGType = isArena() ? ARENA_COUNTDOWN_MAX : BATTLEGROUND_COUNTDOWN_MAX; + + WorldPacket data(SMSG_START_TIMER, 4+4+4); + data << uint32(0); // unk + data << uint32(countdownMaxForBGType - (m_CountdownTimer / 1000)); + data << uint32(countdownMaxForBGType); + + for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) + if (Player* player = ObjectAccessor::FindPlayer(itr->first)) + player->GetSession()->SendPacket(&data); + + m_CountdownTimer = 0; + } + if (!(m_Events & BG_STARTING_EVENT_1)) { m_Events |= BG_STARTING_EVENT_1; @@ -530,7 +551,7 @@ inline void Battleground::_ProcessJoin(uint32 diff) WorldPacket status; BattlegroundQueueTypeId bgQueueTypeId = sBattlegroundMgr->BGQueueTypeId(m_TypeID, GetArenaType()); uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId); - sBattlegroundMgr->BuildBattlegroundStatusPacket(&status, this, player, queueSlot, STATUS_IN_PROGRESS, 0, GetElapsedTime(), GetArenaType()); + sBattlegroundMgr->BuildBattlegroundStatusPacket(&status, this, player, queueSlot, STATUS_IN_PROGRESS, player->GetBattlegroundQueueJoinTime(m_TypeID), GetElapsedTime(), GetArenaType()); player->GetSession()->SendPacket(&status); player->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION); @@ -778,7 +799,7 @@ void Battleground::EndBattleground(uint32 winner) SetStatus(STATUS_WAIT_LEAVE); //we must set it this way, because end time is sent in packet! - m_EndTime = TIME_AUTOCLOSE_BATTLEGROUND; + SetRemainingTime(TIME_AUTOCLOSE_BATTLEGROUND); // arena rating calculation if (isArena() && isRated()) @@ -1179,7 +1200,7 @@ void Battleground::AddPlayer(Player* player) BattlegroundQueueTypeId bgQueueTypeId = sBattlegroundMgr->BGQueueTypeId(m_TypeID, GetArenaType()); uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId); - sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player, queueSlot, STATUS_IN_PROGRESS, player->GetBattlegroundQueueJoinTime(m_TypeID), GetElapsedTime(), GetArenaType(), isArena() ? 0 : 1); + sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player, queueSlot, STATUS_IN_PROGRESS, player->GetBattlegroundQueueJoinTime(m_TypeID), GetElapsedTime(), GetArenaType()); player->GetSession()->SendPacket(&data); player->RemoveAurasByType(SPELL_AURA_MOUNTED); @@ -1212,6 +1233,9 @@ void Battleground::AddPlayer(Player* player) player->ResetAllPowers(); } + // Correctly display EnemyUnitFrame + player->SetByteValue(PLAYER_BYTES_3, 3, player->GetBGTeam()); + WorldPacket data(SMSG_ARENA_OPPONENT_UPDATE, 8); data << uint64(player->GetGUID()); SendPacketToTeam(team, &data, player, false); |