mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-23 13:46:24 +00:00
feat(Core): make BGs and Arena prep time configurable (#22136)
Co-authored-by: Tereneckla <Tereneckla@pm.me>
This commit is contained in:
@@ -195,6 +195,8 @@ Battleground::Battleground()
|
||||
|
||||
m_HonorMode = BG_NORMAL;
|
||||
|
||||
m_SetupCompleted = false;
|
||||
|
||||
StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_2M;
|
||||
StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_1M;
|
||||
StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_30S;
|
||||
@@ -475,10 +477,8 @@ inline void Battleground::_ProcessJoin(uint32 diff)
|
||||
itr->second->ResetAllPowers();
|
||||
}
|
||||
|
||||
if (!(m_Events & BG_STARTING_EVENT_1))
|
||||
if (!m_SetupCompleted)
|
||||
{
|
||||
m_Events |= BG_STARTING_EVENT_1;
|
||||
|
||||
if (!FindBgMap())
|
||||
{
|
||||
LOG_ERROR("bg.battleground", "Battleground::_ProcessJoin: map (map id: {}, instance id: {}) is not created!", m_MapId, m_InstanceID);
|
||||
@@ -494,13 +494,52 @@ inline void Battleground::_ProcessJoin(uint32 diff)
|
||||
}
|
||||
|
||||
StartingEventCloseDoors();
|
||||
SetStartDelayTime(StartDelayTimes[BG_STARTING_EVENT_FIRST]);
|
||||
|
||||
// First start warning - 2 or 1 minute
|
||||
// Get the configured prep time
|
||||
uint32 configuredPrepTime;
|
||||
|
||||
// Special case for Strand of the Ancients - always use 120 seconds due to boat timing mechanics
|
||||
if (GetBgTypeID() == BATTLEGROUND_SA)
|
||||
configuredPrepTime = 120 * IN_MILLISECONDS;
|
||||
else
|
||||
configuredPrepTime = isArena() ?
|
||||
sWorld->getIntConfig(CONFIG_ARENA_PREP_TIME) * IN_MILLISECONDS :
|
||||
sWorld->getIntConfig(CONFIG_BATTLEGROUND_PREP_TIME) * IN_MILLISECONDS;
|
||||
|
||||
SetStartDelayTime(configuredPrepTime);
|
||||
|
||||
// Pre-mark events for announcements that should be skipped based on configured prep time
|
||||
if (configuredPrepTime < StartDelayTimes[BG_STARTING_EVENT_FIRST])
|
||||
{
|
||||
// Skip first announcement (120s for BG, 60s for Arena)
|
||||
m_Events |= BG_STARTING_EVENT_1;
|
||||
|
||||
if (configuredPrepTime < StartDelayTimes[BG_STARTING_EVENT_SECOND])
|
||||
{
|
||||
// Skip second announcement (60s for BG, 30s for Arena)
|
||||
m_Events |= BG_STARTING_EVENT_2;
|
||||
|
||||
if (configuredPrepTime < StartDelayTimes[BG_STARTING_EVENT_THIRD])
|
||||
{
|
||||
// Skip third announcement (30s for BG, 15s for Arena)
|
||||
m_Events |= BG_STARTING_EVENT_3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Mark setup as completed
|
||||
m_SetupCompleted = true;
|
||||
}
|
||||
|
||||
// First announcement at 120s or 60s (Depending on BG or Arena and configured time)
|
||||
if (GetStartDelayTime() <= StartDelayTimes[BG_STARTING_EVENT_FIRST] && !(m_Events & BG_STARTING_EVENT_1))
|
||||
{
|
||||
m_Events |= BG_STARTING_EVENT_1;
|
||||
|
||||
if (StartMessageIds[BG_STARTING_EVENT_FIRST])
|
||||
SendBroadcastText(StartMessageIds[BG_STARTING_EVENT_FIRST], CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
}
|
||||
// After 1 minute or 30 seconds, warning is signaled
|
||||
// Second announcement at 60s or 30s
|
||||
else if (GetStartDelayTime() <= StartDelayTimes[BG_STARTING_EVENT_SECOND] && !(m_Events & BG_STARTING_EVENT_2))
|
||||
{
|
||||
m_Events |= BG_STARTING_EVENT_2;
|
||||
@@ -508,7 +547,7 @@ inline void Battleground::_ProcessJoin(uint32 diff)
|
||||
if (StartMessageIds[BG_STARTING_EVENT_SECOND])
|
||||
SendBroadcastText(StartMessageIds[BG_STARTING_EVENT_SECOND], CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
}
|
||||
// After 30 or 15 seconds, warning is signaled
|
||||
// Third announcement at 30s or 15s
|
||||
else if (GetStartDelayTime() <= StartDelayTimes[BG_STARTING_EVENT_THIRD] && !(m_Events & BG_STARTING_EVENT_3))
|
||||
{
|
||||
m_Events |= BG_STARTING_EVENT_3;
|
||||
@@ -543,11 +582,12 @@ inline void Battleground::_ProcessJoin(uint32 diff)
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Delay expired (after 2 or 1 minute)
|
||||
// Delay expired (after configured prep time)
|
||||
else if (GetStartDelayTime() <= 0 && !(m_Events & BG_STARTING_EVENT_4))
|
||||
{
|
||||
m_Events |= BG_STARTING_EVENT_4;
|
||||
|
||||
// Start the battle
|
||||
StartingEventOpenDoors();
|
||||
|
||||
if (StartMessageIds[BG_STARTING_EVENT_FOURTH])
|
||||
|
||||
Reference in New Issue
Block a user