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 fade6fbf4f)
This commit is contained in:
Gildor
2021-12-15 19:36:56 +01:00
committed by Shauren
parent cc94b595cf
commit 1bfbc371d5
8 changed files with 23 additions and 8 deletions

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
{

View File

@@ -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);

View File

@@ -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*/)

View File

@@ -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)

View File

@@ -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());
}

View File

@@ -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);

View File

@@ -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);

View File

@@ -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)