mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +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());
|
||||
|
||||
|
|
|
|||
|
|
@ -112,6 +112,8 @@ enum BattleGroundTimeIntervals
|
|||
RESPAWN_IMMEDIATELY = 0, // secs
|
||||
BUFF_RESPAWN_TIME = 180, // secs
|
||||
ARENA_SPAWN_BUFF_OBJECTS = 90000, // ms - 90sec after start
|
||||
BATTLEGROUND_COUNTDOWN_MAX = 120, // secs
|
||||
ARENA_COUNTDOWN_MAX = 60, // secs
|
||||
};
|
||||
|
||||
enum BattleGroundStartTimeIntervals
|
||||
|
|
@ -575,6 +577,7 @@ class BattleGround
|
|||
BattleGroundStatus m_Status;
|
||||
uint32 m_ClientInstanceID; // the instance-id which is sent to the client and without any other internal use
|
||||
uint32 m_StartTime;
|
||||
uint32 m_CountdownTimer;
|
||||
bool m_ArenaBuffSpawned; // to cache if arenabuff event is started (cause bool is faster than checking IsActiveEvent)
|
||||
int32 m_EndTime; // it is set to 120000 when bg is ending and it decreases itself
|
||||
BattleGroundBracketId m_BracketId;
|
||||
|
|
|
|||
|
|
@ -1412,4 +1412,5 @@ void InitializeOpcodes()
|
|||
//OPCODE(CMSG_OBJECT_UPDATE_FAILED, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleObjectUpdateFailedOpcode );
|
||||
OPCODE(CMSG_REFORGE_ITEM, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleReforgeItemOpcode );
|
||||
OPCODE(SMSG_REFORGE_RESULT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
OPCODE(SMSG_START_TIMER, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1430,6 +1430,7 @@ enum Opcodes
|
|||
CMSG_REFORGE_ITEM = 0x331A, // 4.3.4 15595
|
||||
SMSG_REFORGE_RESULT = 0x58A4, // 4.3.4 15595
|
||||
CMSG_LOAD_SCREEN = 0x2422, // 4.3.4 15595
|
||||
SMSG_START_TIMER = 0x59A5, // 4.3.4 15595
|
||||
};
|
||||
|
||||
#define MAX_OPCODE_TABLE_SIZE 0xFFFF
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue