From fade6fbf4fab1c520de72417cbfb1c7a6dc69c32 Mon Sep 17 00:00:00 2001 From: Gildor Date: Wed, 15 Dec 2021 19:36:56 +0100 Subject: Core/Battlegrounds: Avoid reset BG and Arena scoreboard stats and BG map achievement criterias when relogin if player was already in the BG (#27280) --- src/server/game/Battlegrounds/Arena.cpp | 4 +++- src/server/game/Battlegrounds/Battleground.cpp | 3 ++- src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp | 4 +++- src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp | 4 +++- src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp | 4 +++- src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp | 4 +++- src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp | 4 +++- src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp | 4 +++- 8 files changed, 23 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/Arena.cpp b/src/server/game/Battlegrounds/Arena.cpp index 1a40c127973..8317b39fb42 100644 --- a/src/server/game/Battlegrounds/Arena.cpp +++ b/src/server/game/Battlegrounds/Arena.cpp @@ -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 { diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 325b762abcb..9594fc82ab3 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -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); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp index aeb316f443d..0cc836d3877 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp @@ -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*/) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index b1457af4df4..e972a57f294 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -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) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp index 81524e44fd7..3c0d0b5a1c4 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp @@ -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()); } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp index 463d17055fd..0e07f0e1b39 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp @@ -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); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index 2f4d2b717ff..3c52c39dba1 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -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); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index b1f129d06cb..be95818455d 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp @@ -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) -- cgit v1.2.3