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

This commit is contained in:
Gildor
2021-12-15 19:36:56 +01:00
committed by GitHub
parent 41c8c4ba74
commit fade6fbf4f
8 changed files with 23 additions and 8 deletions

View File

@@ -73,8 +73,10 @@ Arena::Arena()
void Arena::AddPlayer(Player* player)
{
bool const isInBattleground = IsPlayerInBattleground(player->GetGUID());
Battleground::AddPlayer(player);
PlayerScores[player->GetGUID().GetCounter()] = new ArenaScore(player->GetGUID(), player->GetBGTeam());
if (!isInBattleground)
PlayerScores[player->GetGUID().GetCounter()] = new ArenaScore(player->GetGUID(), player->GetBGTeam());
if (player->GetBGTeam() == ALLIANCE) // gold
{

View File

@@ -1024,7 +1024,8 @@ void Battleground::AddPlayer(Player* player)
}
// reset all map criterias on map enter
player->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
if (!isInBattleground)
player->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
// setup BG group membership
PlayerAddedToBGCheckIfBGIsRunning(player);

View File

@@ -230,8 +230,10 @@ void BattlegroundAB::StartingEventOpenDoors()
void BattlegroundAB::AddPlayer(Player* player)
{
bool const isInBattleground = IsPlayerInBattleground(player->GetGUID());
Battleground::AddPlayer(player);
PlayerScores[player->GetGUID().GetCounter()] = new BattlegroundABScore(player->GetGUID());
if (!isInBattleground)
PlayerScores[player->GetGUID().GetCounter()] = new BattlegroundABScore(player->GetGUID());
}
void BattlegroundAB::RemovePlayer(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*team*/)

View File

@@ -446,8 +446,10 @@ void BattlegroundAV::StartingEventOpenDoors()
void BattlegroundAV::AddPlayer(Player* player)
{
bool const isInBattleground = IsPlayerInBattleground(player->GetGUID());
Battleground::AddPlayer(player);
PlayerScores[player->GetGUID().GetCounter()] = new BattlegroundAVScore(player->GetGUID());
if (!isInBattleground)
PlayerScores[player->GetGUID().GetCounter()] = new BattlegroundAVScore(player->GetGUID());
}
void BattlegroundAV::EndBattleground(uint32 winner)

View File

@@ -358,8 +358,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().GetCounter()] = new BattlegroundEYScore(player->GetGUID());
if (!isInBattleground)
PlayerScores[player->GetGUID().GetCounter()] = new BattlegroundEYScore(player->GetGUID());
m_PlayersNearPoint[EY_POINTS_MAX].push_back(player->GetGUID());
}

View File

@@ -248,8 +248,10 @@ void BattlegroundIC::StartingEventOpenDoors()
void BattlegroundIC::AddPlayer(Player* player)
{
bool const isInBattleground = IsPlayerInBattleground(player->GetGUID());
Battleground::AddPlayer(player);
PlayerScores[player->GetGUID().GetCounter()] = new BattlegroundICScore(player->GetGUID());
if (!isInBattleground)
PlayerScores[player->GetGUID().GetCounter()] = new BattlegroundICScore(player->GetGUID());
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

@@ -482,8 +482,10 @@ void BattlegroundSA::FillInitialWorldStates(WorldPackets::WorldState::InitWorldS
void BattlegroundSA::AddPlayer(Player* player)
{
bool const isInBattleground = IsPlayerInBattleground(player->GetGUID());
Battleground::AddPlayer(player);
PlayerScores[player->GetGUID().GetCounter()] = new BattlegroundSAScore(player->GetGUID());
if (!isInBattleground)
PlayerScores[player->GetGUID().GetCounter()] = new BattlegroundSAScore(player->GetGUID());
SendTransportInit(player);

View File

@@ -235,8 +235,10 @@ void BattlegroundWS::StartingEventOpenDoors()
void BattlegroundWS::AddPlayer(Player* player)
{
bool const isInBattleground = IsPlayerInBattleground(player->GetGUID());
Battleground::AddPlayer(player);
PlayerScores[player->GetGUID().GetCounter()] = new BattlegroundWGScore(player->GetGUID());
if (!isInBattleground)
PlayerScores[player->GetGUID().GetCounter()] = new BattlegroundWGScore(player->GetGUID());
}
void BattlegroundWS::RespawnFlag(uint32 Team, bool captured)