aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Battlegrounds/Battleground.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2023-09-25 00:53:56 +0200
committerShauren <shauren.trinity@gmail.com>2023-09-25 00:53:56 +0200
commit41a20b1e4008d450d075847ef1fe367f0e3a240f (patch)
tree4e202edb0d037a4a406926e6cacd686c7afcbca1 /src/server/game/Battlegrounds/Battleground.cpp
parente1f345756ba34ccf4d4dd07b90c254097a240b51 (diff)
Core/Achievements: Fixed achievement criteria StartEvent and FailEvent
* Criteria using StartEvent cannot be updated without that event triggering first (not only for timed achievements) * Implemented most StartEvent and FailEvent types * Fixed saving criteria removed by RemoveCriteriaProgress
Diffstat (limited to 'src/server/game/Battlegrounds/Battleground.cpp')
-rw-r--r--src/server/game/Battlegrounds/Battleground.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index 35c037159f9..56788c7d520 100644
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -418,8 +418,13 @@ inline void Battleground::_ProcessJoin(uint32 diff)
SendPacketToAll(WorldPackets::Battleground::PVPMatchSetState(WorldPackets::Battleground::PVPMatchState::Engaged).Write());
for (auto const& [guid, _] : GetPlayers())
- if (Player* player = ObjectAccessor::FindPlayer(guid))
+ {
+ if (Player* player = ObjectAccessor::GetPlayer(GetBgMap(), guid))
+ {
+ player->StartCriteria(CriteriaStartEvent::StartBattleground, GetBgMap()->GetId());
player->AtStartOfEncounter(EncounterType::Battleground);
+ }
+ }
// Remove preparation
if (isArena())
@@ -929,7 +934,7 @@ void Battleground::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool Sen
player->SetBGTeam(0);
// remove all criterias on bg leave
- player->ResetCriteria(CriteriaFailEvent::LeaveBattleground, GetMapId(), true);
+ player->FailCriteria(CriteriaFailEvent::LeaveBattleground, 0);
if (Transport)
player->TeleportToBGEntryPoint();
@@ -1096,10 +1101,6 @@ void Battleground::AddPlayer(Player* player, BattlegroundQueueTypeId queueId)
}
}
- // reset all map criterias on map enter
- if (!isInBattleground)
- player->ResetCriteria(CriteriaFailEvent::LeaveBattleground, GetMapId(), true);
-
// setup BG group membership
PlayerAddedToBGCheckIfBGIsRunning(player);
AddOrSetPlayerToCorrectBgGroup(player, team);