InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save, Difficulty difficulty) { // load/create a map TRINITY_GUARD(ACE_Thread_Mutex, Lock); // make sure we have a valid map id const MapEntry* entry = sMapStore.LookupEntry(GetId()); if (!entry) { sLog->outError(LOG_FILTER_MAPS, "CreateInstance: no entry for map %d", GetId()); ASSERT(false); } const InstanceTemplate* iTemplate = sObjectMgr->GetInstanceTemplate(GetId()); if (!iTemplate) { sLog->outError(LOG_FILTER_MAPS, "CreateInstance: no instance template for map %d", GetId()); ASSERT(false); } // some instances only have one difficulty GetDownscaledMapDifficultyData(GetId(), difficulty); sLog->outDebug(LOG_FILTER_MAPS, "MapInstanced::CreateInstance: %s map instance %d for %d created with difficulty %s", save?"":"new ", InstanceId, GetId(), difficulty?"heroic":"normal"); InstanceMap* map = new InstanceMap(GetId(), GetGridExpiry(), InstanceId, difficulty, this); ASSERT(map->IsDungeon()); map->LoadRespawnTimes(); bool load_data = save != NULL; map->CreateInstanceData(load_data); m_InstancedMaps[InstanceId] = map; return map; }
InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save, Difficulty difficulty, TeamId team) { // load/create a map std::lock_guard<std::mutex> lock(_mapLock); // make sure we have a valid map id const MapEntry* entry = sMapStore.LookupEntry(GetId()); if (!entry) { TC_LOG_ERROR("maps", "CreateInstance: no entry for map %d", GetId()); ABORT(); } const InstanceTemplate* iTemplate = sObjectMgr->GetInstanceTemplate(GetId()); if (!iTemplate) { TC_LOG_ERROR("maps", "CreateInstance: no instance template for map %d", GetId()); ABORT(); } // some instances only have one difficulty sDB2Manager.GetDownscaledMapDifficultyData(GetId(), difficulty); TC_LOG_DEBUG("maps", "MapInstanced::CreateInstance: %s map instance %d for %d created with difficulty %s", save ? "" : "new ", InstanceId, GetId(), difficulty ? "heroic" : "normal"); InstanceMap* map = new InstanceMap(GetId(), GetGridExpiry(), InstanceId, difficulty, this); ASSERT(map->IsDungeon()); map->LoadRespawnTimes(); map->LoadCorpseData(); bool load_data = save != NULL; map->CreateInstanceData(load_data); if (InstanceScenario* instanceScenario = sScenarioMgr->CreateInstanceScenario(map, team)) map->SetInstanceScenario(instanceScenario); if (sWorld->getBoolConfig(CONFIG_INSTANCEMAP_LOAD_GRIDS)) map->LoadAllCells(); m_InstancedMaps[InstanceId] = map; return map; }
InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save, Difficulty difficulty) { // load/create a map TRINITY_GUARD(ACE_Thread_Mutex, Lock); // make sure we have a valid map id const MapEntry* entry = sMapStore.LookupEntry(GetId()); if (!entry) { sLog->outError("CreateInstance: no entry for map %d", GetId()); ASSERT(false); } const InstanceTemplate* iTemplate = sObjectMgr->GetInstanceTemplate(GetId()); if (!iTemplate) { sLog->outError("CreateInstance: no instance template for map %d", GetId()); ASSERT(false); } // some instances only have one difficulty GetDownscaledMapDifficultyData(GetId(), difficulty); ;//sLog->outDebug(LOG_FILTER_MAPS, "MapInstanced::CreateInstance: %s map instance %d for %d created with difficulty %s", save?"":"new ", InstanceId, GetId(), difficulty?"heroic":"normal"); InstanceMap* map = new InstanceMap(GetId(), InstanceId, difficulty, this); ASSERT(map->IsDungeon()); map->LoadRespawnTimes(); if (save) map->CreateInstanceScript(true, save->GetInstanceData(), save->GetCompletedEncounterMask()); else map->CreateInstanceScript(false, "", 0); if (!save) // this is for sure a dungeon (assert above), no need to check here sInstanceSaveMgr->AddInstanceSave(GetId(), InstanceId, difficulty); m_InstancedMaps[InstanceId] = map; return map; }
InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save, Difficulty difficulty) { // load/create a map std::lock_guard<std::mutex> lock(_mapLock); // make sure we have a valid map id const MapEntry* entry = sMapStore.LookupEntry(GetId()); if (!entry) { TC_LOG_ERROR("maps", "CreateInstance: no entry for map %d", GetId()); ASSERT(false); } const InstanceTemplate* iTemplate = sObjectMgr->GetInstanceTemplate(GetId()); if (!iTemplate) { TC_LOG_ERROR("maps", "CreateInstance: no instance template for map %d", GetId()); ASSERT(false); } // some instances only have one difficulty GetDownscaledMapDifficultyData(GetId(), difficulty); TC_LOG_DEBUG("maps", "MapInstanced::CreateInstance: %s map instance %d for %d created with difficulty %s", save ? "" : "new ", InstanceId, GetId(), difficulty ? "heroic" : "normal"); InstanceMap* map = new InstanceMap(GetId(), GetGridExpiry(), InstanceId, difficulty, this); ASSERT(map->IsDungeon()); map->LoadRespawnTimes(); map->LoadCorpseData(); bool load_data = save != NULL; map->CreateInstanceData(load_data); m_InstancedMaps[InstanceId] = map; return map; }