mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 09:44:45 +01:00
Core/Battleground: Fix asynch countdown timer for new players. close #8761
This commit is contained in:
@@ -298,7 +298,7 @@ void Battleground::Update(uint32 diff)
|
||||
}
|
||||
|
||||
// Update start time and reset stats timer
|
||||
m_StartTime += diff;
|
||||
SetElapsedTime(GetElapsedTime() + diff);
|
||||
if (GetStatus() == STATUS_WAIT_JOIN)
|
||||
{
|
||||
m_ResetStatTimer += diff;
|
||||
@@ -484,7 +484,7 @@ inline void Battleground::_ProcessJoin(uint32 diff)
|
||||
|
||||
WorldPacket data(SMSG_START_TIMER, 4+4+4);
|
||||
data << uint32(0); // unk
|
||||
data << uint32(countdownMaxForBGType - (m_CountdownTimer / 1000));
|
||||
data << uint32(countdownMaxForBGType - (GetElapsedTime() / 1000));
|
||||
data << uint32(countdownMaxForBGType);
|
||||
|
||||
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
@@ -597,8 +597,8 @@ inline void Battleground::_ProcessJoin(uint32 diff)
|
||||
}
|
||||
}
|
||||
|
||||
if (m_EndTime > 0 && (m_EndTime -= diff) > 0)
|
||||
m_EndTime -= diff;
|
||||
if (GetRemainingTime() > 0 && (m_EndTime -= diff) > 0)
|
||||
SetRemainingTime(GetRemainingTime() - diff);
|
||||
}
|
||||
|
||||
inline void Battleground::_ProcessLeave(uint32 diff)
|
||||
@@ -607,10 +607,10 @@ inline void Battleground::_ProcessLeave(uint32 diff)
|
||||
// *** BATTLEGROUND ENDING SYSTEM ***
|
||||
// *********************************************************
|
||||
// remove all players from battleground after 2 minutes
|
||||
m_EndTime -= diff;
|
||||
if (m_EndTime <= 0)
|
||||
SetRemainingTime(GetRemainingTime() - diff);
|
||||
if (GetRemainingTime() <= 0)
|
||||
{
|
||||
m_EndTime = 0;
|
||||
SetRemainingTime(0);
|
||||
BattlegroundPlayerMap::iterator itr, next;
|
||||
for (itr = m_Players.begin(); itr != m_Players.end(); itr = next)
|
||||
{
|
||||
@@ -1244,7 +1244,16 @@ void Battleground::AddPlayer(Player* player)
|
||||
else
|
||||
{
|
||||
if (GetStatus() == STATUS_WAIT_JOIN) // not started yet
|
||||
{
|
||||
player->CastSpell(player, SPELL_PREPARATION, true); // reduces all mana cost of spells.
|
||||
|
||||
int32 countdownMaxForBGType = isArena() ? ARENA_COUNTDOWN_MAX : BATTLEGROUND_COUNTDOWN_MAX;
|
||||
WorldPacket data(SMSG_START_TIMER, 4+4+4);
|
||||
data << uint32(0); // unk
|
||||
data << uint32(countdownMaxForBGType - (GetElapsedTime() / 1000));
|
||||
data << uint32(countdownMaxForBGType);
|
||||
player->GetSession()->SendPacket(&data);
|
||||
}
|
||||
}
|
||||
|
||||
player->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
|
||||
|
||||
@@ -241,7 +241,6 @@ namespace Trinity
|
||||
inline uint32 BgConquestRatingCalculator(uint32 rate)
|
||||
{
|
||||
// WowWiki: Battleground ratings receive a bonus of 22.2% to the cap they generate
|
||||
printf("%u",uint32(round(ConquestRatingCalculator(rate) * 1.222f)));
|
||||
return uint32(round(ConquestRatingCalculator(rate) * 1.222f));
|
||||
}
|
||||
} // namespace Trinity::Currency
|
||||
|
||||
@@ -2909,7 +2909,7 @@ Currency.StartJusticePoints = 0
|
||||
|
||||
#
|
||||
# Currency.MaxJusticePoints
|
||||
# Amount honor points a player can have
|
||||
# Amount justice points a player can have
|
||||
# Default: 4000
|
||||
#
|
||||
|
||||
|
||||
Reference in New Issue
Block a user