diff options
| author | megamage <none@none> | 2009-03-13 18:06:36 -0600 |
|---|---|---|
| committer | megamage <none@none> | 2009-03-13 18:06:36 -0600 |
| commit | c823272e34f0cbd1ec796e959bddb853ce34ce9e (patch) | |
| tree | 8abe9866a03b731bd4d73cd147908433babcc498 /src/game/BattleGround.cpp | |
| parent | 0d5044863e40be5c369cea57ecec8514231f0792 (diff) | |
[7449] Fixed BG queue invitation status showed on client. Fixed BG starting timer and BG ending timer. Author: Triply
TODO: make bg queue update player's status each minute.
--HG--
branch : trunk
Diffstat (limited to 'src/game/BattleGround.cpp')
| -rw-r--r-- | src/game/BattleGround.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index e058589483f..cdaeb5546ae 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -432,9 +432,10 @@ void BattleGround::Update(uint32 diff) if(GetStatus() == STATUS_WAIT_LEAVE) { // remove all players from battleground after 2 minutes - m_EndTime += diff; - if(m_EndTime >= TIME_TO_AUTOREMOVE) // 2 minutes + m_EndTime -= diff; + if( m_EndTime <= 0) { + m_EndTime = 0; BattleGroundPlayerMap::iterator itr, next; for(itr = m_Players.begin(); itr != m_Players.end(); itr = next) { @@ -447,6 +448,8 @@ void BattleGround::Update(uint32 diff) } } + //update start time + m_StartTime += diff; } void BattleGround::SetTeamStartLoc(uint32 TeamID, float X, float Y, float Z, float O) @@ -654,7 +657,8 @@ void BattleGround::EndBattleGround(uint32 winner) } SetStatus(STATUS_WAIT_LEAVE); - m_EndTime = 0; + //we must set it this way, because end time is sent in packet! + m_EndTime = TIME_TO_AUTOREMOVE; // arena rating calculation if(isArena() && isRated()) @@ -737,7 +741,7 @@ void BattleGround::EndBattleGround(uint32 winner) plr->GetSession()->SendPacket(&data); BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType()); - sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, this, plr->GetBattleGroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, TIME_TO_AUTOREMOVE, GetStartTime()); + sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, this, plr->GetBattleGroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, TIME_TO_AUTOREMOVE, GetStartTime(), GetArenaType()); plr->GetSession()->SendPacket(&data); plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND, 1); } @@ -972,7 +976,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac if(SendPacket) { WorldPacket data; - sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, this, plr->GetBattleGroundQueueIndex(bgQueueTypeId), STATUS_NONE, 0, 0); + sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, this, plr->GetBattleGroundQueueIndex(bgQueueTypeId), STATUS_NONE, 0, 0, 0); plr->GetSession()->SendPacket(&data); } @@ -1616,7 +1620,7 @@ void BattleGround::EndNow() { RemoveFromBGFreeSlotQueue(); SetStatus(STATUS_WAIT_LEAVE); - SetEndTime(TIME_TO_AUTOREMOVE); + SetEndTime(0); // inform invited players about the removal sBattleGroundMgr.m_BattleGroundQueues[BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType())].BGEndedRemoveInvites(this); } @@ -1733,7 +1737,7 @@ void BattleGround::PlayerAddedToBGCheckIfBGIsRunning(Player* plr) sBattleGroundMgr.BuildPvpLogDataPacket(&data, this); plr->GetSession()->SendPacket(&data); - sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, this, plr->GetBattleGroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, TIME_TO_AUTOREMOVE, GetStartTime()); + sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, this, plr->GetBattleGroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, GetEndTime(), GetStartTime(), GetArenaType()); plr->GetSession()->SendPacket(&data); } |
