Core/Battlegrounds: Avoid reset BG and Arena scoreboard stats and BG map achievement criterias when relogin if player was already in the BG (#27280)

(cherry picked from commit fade6fbf4fab1c520de72417cbfb1c7a6dc69c32)
This commit is contained in:
Gildor
2022-03-24 11:48:37 +01:00
committed by Shauren
parent cc94b595cf
commit 1bfbc371d5
8 changed files with 23 additions and 8 deletions
+3 -1
View File
@@ -42,8 +42,10 @@ Arena::Arena(BattlegroundTemplate const* battlegroundTemplate) : Battleground(ba
void Arena::AddPlayer(Player* player)
{
bool const isInBattleground = IsPlayerInBattleground(player->GetGUID());
Battleground::AddPlayer(player);
PlayerScores[player->GetGUID()] = new ArenaScore(player->GetGUID(), player->GetBGTeam());
if (!isInBattleground)
PlayerScores[player->GetGUID()] = new ArenaScore(player->GetGUID(), player->GetBGTeam());
if (player->GetBGTeam() == ALLIANCE) // gold
{
@@ -1121,7 +1121,8 @@ void Battleground::AddPlayer(Player* player)
}
// reset all map criterias on map enter
player->ResetCriteria(CriteriaFailEvent::LeaveBattleground, GetMapId(), true);
if (!isInBattleground)
player->ResetCriteria(CriteriaFailEvent::LeaveBattleground, GetMapId(), true);
// setup BG group membership
PlayerAddedToBGCheckIfBGIsRunning(player);
@@ -222,8 +222,10 @@ void BattlegroundAB::StartingEventOpenDoors()
void BattlegroundAB::AddPlayer(Player* player)
{
bool const isInBattleground = IsPlayerInBattleground(player->GetGUID());
Battleground::AddPlayer(player);
PlayerScores[player->GetGUID()] = new BattlegroundABScore(player->GetGUID(), player->GetBGTeam());
if (!isInBattleground)
PlayerScores[player->GetGUID()] = new BattlegroundABScore(player->GetGUID(), player->GetBGTeam());
}
void BattlegroundAB::RemovePlayer(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*team*/)
@@ -436,8 +436,10 @@ void BattlegroundAV::StartingEventOpenDoors()
void BattlegroundAV::AddPlayer(Player* player)
{
bool const isInBattleground = IsPlayerInBattleground(player->GetGUID());
Battleground::AddPlayer(player);
PlayerScores[player->GetGUID()] = new BattlegroundAVScore(player->GetGUID(), player->GetBGTeam());
if (!isInBattleground)
PlayerScores[player->GetGUID()] = new BattlegroundAVScore(player->GetGUID(), player->GetBGTeam());
}
void BattlegroundAV::EndBattleground(uint32 winner)
@@ -380,8 +380,10 @@ void BattlegroundEY::UpdatePointsIcons(uint32 Team, uint32 Point)
void BattlegroundEY::AddPlayer(Player* player)
{
bool const isInBattleground = IsPlayerInBattleground(player->GetGUID());
Battleground::AddPlayer(player);
PlayerScores[player->GetGUID()] = new BattlegroundEYScore(player->GetGUID(), player->GetBGTeam());
if (!isInBattleground)
PlayerScores[player->GetGUID()] = new BattlegroundEYScore(player->GetGUID(), player->GetBGTeam());
m_PlayersNearPoint[EY_POINTS_MAX].push_back(player->GetGUID());
}
@@ -242,8 +242,10 @@ void BattlegroundIC::StartingEventOpenDoors()
void BattlegroundIC::AddPlayer(Player* player)
{
bool const isInBattleground = IsPlayerInBattleground(player->GetGUID());
Battleground::AddPlayer(player);
PlayerScores[player->GetGUID()] = new BattlegroundICScore(player->GetGUID(), player->GetBGTeam());
if (!isInBattleground)
PlayerScores[player->GetGUID()] = new BattlegroundICScore(player->GetGUID(), player->GetBGTeam());
if (nodePoint[NODE_TYPE_QUARRY].nodeState == (player->GetTeamId() == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H))
player->CastSpell(player, SPELL_QUARRY, true);
@@ -476,8 +476,10 @@ void BattlegroundSA::FillInitialWorldStates(WorldPackets::WorldState::InitWorldS
void BattlegroundSA::AddPlayer(Player* player)
{
bool const isInBattleground = IsPlayerInBattleground(player->GetGUID());
Battleground::AddPlayer(player);
PlayerScores[player->GetGUID()] = new BattlegroundSAScore(player->GetGUID(), player->GetBGTeam());
if (!isInBattleground)
PlayerScores[player->GetGUID()] = new BattlegroundSAScore(player->GetGUID(), player->GetBGTeam());
SendTransportInit(player);
@@ -228,8 +228,10 @@ void BattlegroundWS::StartingEventOpenDoors()
void BattlegroundWS::AddPlayer(Player* player)
{
bool const isInBattleground = IsPlayerInBattleground(player->GetGUID());
Battleground::AddPlayer(player);
PlayerScores[player->GetGUID()] = new BattlegroundWGScore(player->GetGUID(), player->GetBGTeam());
if (!isInBattleground)
PlayerScores[player->GetGUID()] = new BattlegroundWGScore(player->GetGUID(), player->GetBGTeam());
}
void BattlegroundWS::RespawnFlag(uint32 Team, bool captured)