Core/Maps: Made instance_template no longer required to create and enter instance maps
This commit is contained in:
1 parent
0baf2d1e1e
commit
68cf700178
7 files changed
+17
-41
No files matched your search
@@ -5536,7 +5536,7 @@ void ObjectMgr::LoadInstanceTemplate()
|
||||
|
||||
uint16 mapID = fields[0].GetUInt16();
|
||||
|
||||
if (!MapManager::IsValidMAP(mapID, true))
|
||||
if (!MapManager::IsValidMAP(mapID))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "ObjectMgr::LoadInstanceTemplate: bad mapid %d for template!", mapID);
|
||||
continue;
|
||||
@@ -6753,31 +6753,26 @@ void ObjectMgr::LoadAccessRequirements()
|
||||
*/
|
||||
AreaTriggerStruct const* ObjectMgr::GetGoBackTrigger(uint32 Map) const
|
||||
{
|
||||
bool useParentDbValue = false;
|
||||
uint32 parentId = 0;
|
||||
Optional<uint32> parentId;
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(Map);
|
||||
if (!mapEntry || mapEntry->CorpseMapID < 0)
|
||||
return nullptr;
|
||||
|
||||
if (mapEntry->IsDungeon())
|
||||
{
|
||||
InstanceTemplate const* iTemplate = sObjectMgr->GetInstanceTemplate(Map);
|
||||
if (InstanceTemplate const* iTemplate = sObjectMgr->GetInstanceTemplate(Map))
|
||||
parentId = iTemplate->Parent;
|
||||
|
||||
if (!iTemplate)
|
||||
return nullptr;
|
||||
uint32 entrance_map = parentId.value_or(mapEntry->CorpseMapID);
|
||||
|
||||
parentId = iTemplate->Parent;
|
||||
useParentDbValue = true;
|
||||
}
|
||||
|
||||
uint32 entrance_map = uint32(mapEntry->CorpseMapID);
|
||||
for (AreaTriggerContainer::const_iterator itr = _areaTriggerStore.begin(); itr != _areaTriggerStore.end(); ++itr)
|
||||
if ((!useParentDbValue && itr->second.target_mapId == entrance_map) || (useParentDbValue && itr->second.target_mapId == parentId))
|
||||
{
|
||||
if (itr->second.target_mapId == entrance_map)
|
||||
{
|
||||
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(itr->first);
|
||||
if (atEntry && atEntry->ContinentID == Map)
|
||||
if (atEntry && atEntry->ContinentID == int32(Map))
|
||||
return &itr->second;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user