mirror of
https://github.com/mangosfour/server.git
synced 2025-12-26 07:37:02 +00:00
Implemented SMSG_START_TIMER (Implement bg countdown timer)
This commit is contained in:
parent
46e1f87c04
commit
970a6124ba
4 changed files with 34 additions and 0 deletions
|
|
@ -219,6 +219,7 @@ BattleGround::BattleGround()
|
|||
m_IsArena = false;
|
||||
m_Winner = TEAM_NONE;
|
||||
m_StartTime = 0;
|
||||
m_CountdownTimer = 0;
|
||||
m_Events = 0;
|
||||
m_IsRated = false;
|
||||
m_Name = "";
|
||||
|
|
@ -399,6 +400,24 @@ void BattleGround::Update(uint32 diff)
|
|||
{
|
||||
ModifyStartDelayTime(diff);
|
||||
|
||||
if (m_CountdownTimer >= 10000)
|
||||
{
|
||||
uint32 countdownMaxForBGType = isArena() ? ARENA_COUNTDOWN_MAX : BATTLEGROUND_COUNTDOWN_MAX;
|
||||
|
||||
WorldPacket data(SMSG_START_TIMER, 4+4+4);
|
||||
data << uint32(0);
|
||||
data << uint32(countdownMaxForBGType - (m_StartTime / 1000));
|
||||
data << uint32(countdownMaxForBGType);
|
||||
|
||||
for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
if (Player* player = sObjectMgr.GetPlayer(itr->first))
|
||||
player->GetSession()->SendPacket(&data);
|
||||
|
||||
m_CountdownTimer = 0;
|
||||
}
|
||||
else
|
||||
m_CountdownTimer += diff;
|
||||
|
||||
if (!(m_Events & BG_STARTING_EVENT_1))
|
||||
{
|
||||
m_Events |= BG_STARTING_EVENT_1;
|
||||
|
|
@ -1217,6 +1236,16 @@ void BattleGround::AddPlayer(Player* plr)
|
|||
plr->CastSpell(plr, SPELL_BATTLEGROUND_DAMPENING, true);
|
||||
}
|
||||
|
||||
if (GetStatus() == STATUS_WAIT_JOIN) // not started yet
|
||||
{
|
||||
int32 countdownMaxForBGType = isArena() ? ARENA_COUNTDOWN_MAX : BATTLEGROUND_COUNTDOWN_MAX;
|
||||
WorldPacket data(SMSG_START_TIMER, 4+4+4);
|
||||
data << uint32(0); // unk
|
||||
data << uint32(countdownMaxForBGType - (m_StartTime / 1000));
|
||||
data << uint32(countdownMaxForBGType);
|
||||
plr->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE, ACHIEVEMENT_CRITERIA_CONDITION_MAP, GetMapId());
|
||||
plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE, ACHIEVEMENT_CRITERIA_CONDITION_MAP, GetMapId());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue