diff options
| author | Shauren <shauren.trinity@gmail.com> | 2023-03-21 12:07:54 +0100 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2023-03-21 12:07:54 +0100 |
| commit | 2569dc8cfec7a5fd89f037579ea6081504b9223f (patch) | |
| tree | faa1c70bb7d9f00081d3a70498efe1ab98cd5410 /src/server/game/Maps | |
| parent | 5f642b78f04bbbc723d573362ff25f2ede24f5af (diff) | |
Core/Instances: Fixed not being able to reenter instances that have no encounters completed
Closes #28737
Diffstat (limited to 'src/server/game/Maps')
| -rw-r--r-- | src/server/game/Maps/Map.cpp | 12 | ||||
| -rw-r--r-- | src/server/game/Maps/MapManager.cpp | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index d215693c4cc..c5a44aefc51 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -2860,7 +2860,7 @@ bool InstanceMap::AddPlayerToMap(Player* player, bool initPlayer /*= true*/) player->AddInstanceEnterTime(GetInstanceId(), GameTime::GetGameTime()); MapDb2Entries entries{ GetEntry(), GetMapDifficulty() }; - if (entries.MapDifficulty->HasResetSchedule() && i_instanceLock && i_instanceLock->GetData()->CompletedEncountersMask) + if (entries.MapDifficulty->HasResetSchedule() && i_instanceLock && !i_instanceLock->IsNew()) { if (!entries.MapDifficulty->IsUsingEncounterLocks()) { @@ -2948,7 +2948,7 @@ void InstanceMap::CreateInstanceData() if (!i_data) return; - if (!i_instanceLock || !i_instanceLock->GetInstanceId()) + if (!i_instanceLock || i_instanceLock->IsNew()) { i_data->Create(); return; @@ -2985,7 +2985,7 @@ void InstanceMap::TrySetOwningGroup(Group* group) InstanceResetResult InstanceMap::Reset(InstanceResetMethod method) { // raids can be reset if no boss was killed - if (method != InstanceResetMethod::Expire && i_instanceLock && i_instanceLock->GetData()->CompletedEncountersMask) + if (method != InstanceResetMethod::Expire && i_instanceLock && !i_instanceLock->IsNew()) return InstanceResetResult::CannotReset; if (HavePlayers()) @@ -3075,7 +3075,7 @@ void InstanceMap::UpdateInstanceLock(UpdateBossStateSaveDataEvent const& updateS playerCompletedEncounters = playerLock->GetData()->CompletedEncountersMask | (1u << updateSaveDataEvent.DungeonEncounter->Bit); } - bool isNewLock = !playerLock || !playerLock->GetData()->CompletedEncountersMask || playerLock->IsExpired(); + bool isNewLock = !playerLock || playerLock->IsNew() || playerLock->IsExpired(); InstanceLock const* newLock = sInstanceLockMgr.UpdateInstanceLockForPlayer(trans, player->GetGUID(), entries, InstanceLockUpdateEvent(GetInstanceId(), i_data->UpdateBossStateSaveData(oldData ? *oldData : "", updateSaveDataEvent), @@ -3121,7 +3121,7 @@ void InstanceMap::UpdateInstanceLock(UpdateAdditionalSaveDataEvent const& update if (playerLock) oldData = &playerLock->GetData()->Data; - bool isNewLock = !playerLock || !playerLock->GetData()->CompletedEncountersMask || playerLock->IsExpired(); + bool isNewLock = !playerLock || playerLock->IsNew() || playerLock->IsExpired(); InstanceLock const* newLock = sInstanceLockMgr.UpdateInstanceLockForPlayer(trans, player->GetGUID(), entries, InstanceLockUpdateEvent(GetInstanceId(), i_data->UpdateAdditionalSaveData(oldData ? *oldData : "", updateSaveDataEvent), @@ -3146,7 +3146,7 @@ void InstanceMap::CreateInstanceLockForPlayer(Player* player) MapDb2Entries entries{ GetEntry(), GetMapDifficulty() }; InstanceLock const* playerLock = sInstanceLockMgr.FindActiveInstanceLock(player->GetGUID(), entries); - bool isNewLock = !playerLock || !playerLock->GetData()->CompletedEncountersMask || playerLock->IsExpired(); + bool isNewLock = !playerLock || playerLock->IsNew() || playerLock->IsExpired(); CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction(); diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp index fe9c950cc49..0c2d686d10d 100644 --- a/src/server/game/Maps/MapManager.cpp +++ b/src/server/game/Maps/MapManager.cpp @@ -95,7 +95,7 @@ InstanceMap* MapManager::CreateInstance(uint32 mapId, uint32 instanceId, Instanc sDB2Manager.GetDownscaledMapDifficultyData(mapId, difficulty); TC_LOG_DEBUG("maps", "MapInstanced::CreateInstance: {}map instance {} for {} created with difficulty {}", - instanceLock && instanceLock->GetInstanceId() ? "" : "new ", instanceId, mapId, sDifficultyStore.AssertEntry(difficulty)->Name[sWorld->GetDefaultDbcLocale()]); + instanceLock && instanceLock->IsNew() ? "" : "new ", instanceId, mapId, sDifficultyStore.AssertEntry(difficulty)->Name[sWorld->GetDefaultDbcLocale()]); InstanceMap* map = new InstanceMap(mapId, i_gridCleanUpDelay, instanceId, difficulty, team, instanceLock); ASSERT(map->IsDungeon()); |
