aboutsummaryrefslogtreecommitdiff
path: root/src/game/ObjectMgr.cpp
diff options
context:
space:
mode:
authorclick <none@none>2010-05-04 18:25:30 +0200
committerclick <none@none>2010-05-04 18:25:30 +0200
commit029e4804543c473f3b8cf98cfbecc91675dc4b78 (patch)
tree5a4f006e4f75d6ba6738b4d868b52b33e30c8936 /src/game/ObjectMgr.cpp
parent51d0c07c90690925e03a8d5e75decc2e1410c57e (diff)
Add stricter regulations for instances (login-checks and support for sending unbound player to parent-instance / homebind if not matching criterias)
Patch by Elron103 - closes issue #1323. --HG-- branch : trunk
Diffstat (limited to 'src/game/ObjectMgr.cpp')
-rw-r--r--src/game/ObjectMgr.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp
index 349dd342b7a..6db783eb610 100644
--- a/src/game/ObjectMgr.cpp
+++ b/src/game/ObjectMgr.cpp
@@ -5899,15 +5899,30 @@ void ObjectMgr::LoadAccessRequirements()
}
/*
- * Searches for the areatrigger which teleports players out of the given map
+ * Searches for the areatrigger which teleports players out of the given map with instance_template.parent field support
*/
AreaTrigger const* ObjectMgr::GetGoBackTrigger(uint32 Map) const
{
+ bool useParentDbValue = false;
+ uint32 parentId = 0;
const MapEntry *mapEntry = sMapStore.LookupEntry(Map);
- if (!mapEntry || mapEntry->entrance_map < 0) return NULL;
+ if (!mapEntry || mapEntry->entrance_map < 0)
+ return NULL;
+
+ if (mapEntry->IsDungeon())
+ {
+ const InstanceTemplate *iTemplate = objmgr.GetInstanceTemplate(Map);
+
+ if (!iTemplate)
+ return NULL;
+
+ parentId = iTemplate->parent;
+ useParentDbValue = true;
+ }
+
uint32 entrance_map = uint32(mapEntry->entrance_map);
for (AreaTriggerMap::const_iterator itr = mAreaTriggers.begin(); itr != mAreaTriggers.end(); ++itr)
- if (itr->second.target_mapId == entrance_map)
+ if ((!useParentDbValue && itr->second.target_mapId == entrance_map) || (useParentDbValue && itr->second.target_mapId == parentId))
{
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(itr->first);
if (atEntry && atEntry->mapid == Map)