Core/Maps: Link instance map to LfgDungeons

This commit is contained in:
Shauren
2024-10-05 11:56:02 +02:00
parent 086632d871
commit 8127609764
7 changed files with 21 additions and 12 deletions

View File

@@ -86,7 +86,8 @@ Map* MapManager::CreateWorldMap(uint32 mapId, uint32 instanceId)
return map;
}
InstanceMap* MapManager::CreateInstance(uint32 mapId, uint32 instanceId, InstanceLock* instanceLock, Difficulty difficulty, TeamId team, Group* group)
InstanceMap* MapManager::CreateInstance(uint32 mapId, uint32 instanceId, InstanceLock* instanceLock, Difficulty difficulty, TeamId team, Group* group,
Optional<uint32> lfgDungeonsId)
{
// make sure we have a valid map id
MapEntry const* entry = sMapStore.LookupEntry(mapId);
@@ -102,7 +103,7 @@ InstanceMap* MapManager::CreateInstance(uint32 mapId, uint32 instanceId, Instanc
TC_LOG_DEBUG("maps", "MapInstanced::CreateInstance: {}map instance {} for {} created with difficulty {}",
instanceLock && instanceLock->IsNew() ? "" : "new ", instanceId, mapId, sDifficultyStore.AssertEntry(difficulty)->Name[sWorld->GetDefaultDbcLocale()]);
InstanceMap* map = new InstanceMap(mapId, i_gridCleanUpDelay, instanceId, difficulty, team, instanceLock);
InstanceMap* map = new InstanceMap(mapId, i_gridCleanUpDelay, instanceId, difficulty, team, instanceLock, lfgDungeonsId);
ASSERT(map->IsDungeon());
map->LoadRespawnTimes();
@@ -150,7 +151,7 @@ GarrisonMap* MapManager::CreateGarrison(uint32 mapId, uint32 instanceId, Player*
- create the instance if it's not created already
- the player is not actually added to the instance (only in InstanceMap::Add)
*/
Map* MapManager::CreateMap(uint32 mapId, Player* player)
Map* MapManager::CreateMap(uint32 mapId, Player* player, Optional<uint32> lfgDungeonsId /*= {}*/)
{
if (!player)
return nullptr;
@@ -225,7 +226,8 @@ Map* MapManager::CreateMap(uint32 mapId, Player* player)
if (!map)
{
map = CreateInstance(mapId, newInstanceId, instanceLock, difficulty, GetTeamIdForTeam(sCharacterCache->GetCharacterTeamByGuid(instanceOwnerGuid)), group);
map = CreateInstance(mapId, newInstanceId, instanceLock, difficulty, GetTeamIdForTeam(sCharacterCache->GetCharacterTeamByGuid(instanceOwnerGuid)), group,
lfgDungeonsId);
if (group)
group->SetRecentInstance(mapId, instanceOwnerGuid, newInstanceId);
else