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();
|
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);
|
TC_LOG_ERROR("sql.sql", "ObjectMgr::LoadInstanceTemplate: bad mapid %d for template!", mapID);
|
||||||
continue;
|
continue;
|
||||||
@@ -6753,31 +6753,26 @@ void ObjectMgr::LoadAccessRequirements()
|
|||||||
*/
|
*/
|
||||||
AreaTriggerStruct const* ObjectMgr::GetGoBackTrigger(uint32 Map) const
|
AreaTriggerStruct const* ObjectMgr::GetGoBackTrigger(uint32 Map) const
|
||||||
{
|
{
|
||||||
bool useParentDbValue = false;
|
Optional<uint32> parentId;
|
||||||
uint32 parentId = 0;
|
|
||||||
MapEntry const* mapEntry = sMapStore.LookupEntry(Map);
|
MapEntry const* mapEntry = sMapStore.LookupEntry(Map);
|
||||||
if (!mapEntry || mapEntry->CorpseMapID < 0)
|
if (!mapEntry || mapEntry->CorpseMapID < 0)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (mapEntry->IsDungeon())
|
if (mapEntry->IsDungeon())
|
||||||
{
|
if (InstanceTemplate const* iTemplate = sObjectMgr->GetInstanceTemplate(Map))
|
||||||
InstanceTemplate const* iTemplate = sObjectMgr->GetInstanceTemplate(Map);
|
parentId = iTemplate->Parent;
|
||||||
|
|
||||||
if (!iTemplate)
|
uint32 entrance_map = parentId.value_or(mapEntry->CorpseMapID);
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
parentId = iTemplate->Parent;
|
|
||||||
useParentDbValue = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 entrance_map = uint32(mapEntry->CorpseMapID);
|
|
||||||
for (AreaTriggerContainer::const_iterator itr = _areaTriggerStore.begin(); itr != _areaTriggerStore.end(); ++itr)
|
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);
|
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(itr->first);
|
||||||
if (atEntry && atEntry->ContinentID == Map)
|
if (atEntry && atEntry->ContinentID == int32(Map))
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,6 @@
|
|||||||
#include "Transport.h"
|
#include "Transport.h"
|
||||||
#include "Battleground.h"
|
#include "Battleground.h"
|
||||||
#include "InstanceSaveMgr.h"
|
#include "InstanceSaveMgr.h"
|
||||||
#include "ObjectMgr.h"
|
|
||||||
#include "Vehicle.h"
|
#include "Vehicle.h"
|
||||||
#include "GameTime.h"
|
#include "GameTime.h"
|
||||||
#include "GameClient.h"
|
#include "GameClient.h"
|
||||||
@@ -70,10 +69,9 @@ void WorldSession::HandleMoveWorldportAck()
|
|||||||
|
|
||||||
// get the destination map entry, not the current one, this will fix homebind and reset greeting
|
// get the destination map entry, not the current one, this will fix homebind and reset greeting
|
||||||
MapEntry const* mEntry = sMapStore.LookupEntry(loc.GetMapId());
|
MapEntry const* mEntry = sMapStore.LookupEntry(loc.GetMapId());
|
||||||
InstanceTemplate const* mInstance = sObjectMgr->GetInstanceTemplate(loc.GetMapId());
|
|
||||||
|
|
||||||
// reset instance validity, except if going to an instance inside an instance
|
// reset instance validity, except if going to an instance inside an instance
|
||||||
if (GetPlayer()->m_InstanceValid == false && !mInstance)
|
if (GetPlayer()->m_InstanceValid == false && !!mEntry->IsDungeon())
|
||||||
GetPlayer()->m_InstanceValid = true;
|
GetPlayer()->m_InstanceValid = true;
|
||||||
|
|
||||||
Map* oldMap = GetPlayer()->GetMap();
|
Map* oldMap = GetPlayer()->GetMap();
|
||||||
@@ -177,7 +175,7 @@ void WorldSession::HandleMoveWorldportAck()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mInstance)
|
if (mEntry->IsDungeon())
|
||||||
{
|
{
|
||||||
// check if this instance has a reset time and send it to player if so
|
// check if this instance has a reset time and send it to player if so
|
||||||
Difficulty diff = newMap->GetDifficulty();
|
Difficulty diff = newMap->GetDifficulty();
|
||||||
|
|||||||
@@ -227,12 +227,6 @@ time_t InstanceSave::GetResetTimeForDB()
|
|||||||
return GetResetTime();
|
return GetResetTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
// to cache or not to cache, that is the question
|
|
||||||
InstanceTemplate const* InstanceSave::GetTemplate()
|
|
||||||
{
|
|
||||||
return sObjectMgr->GetInstanceTemplate(m_mapid);
|
|
||||||
}
|
|
||||||
|
|
||||||
MapEntry const* InstanceSave::GetMapEntry()
|
MapEntry const* InstanceSave::GetMapEntry()
|
||||||
{
|
{
|
||||||
return sMapStore.LookupEntry(m_mapid);
|
return sMapStore.LookupEntry(m_mapid);
|
||||||
|
|||||||
@@ -74,7 +74,6 @@ class TC_GAME_API InstanceSave
|
|||||||
void SetResetTime(time_t resetTime) { m_resetTime = resetTime; }
|
void SetResetTime(time_t resetTime) { m_resetTime = resetTime; }
|
||||||
time_t GetResetTimeForDB();
|
time_t GetResetTimeForDB();
|
||||||
|
|
||||||
InstanceTemplate const* GetTemplate();
|
|
||||||
MapEntry const* GetMapEntry();
|
MapEntry const* GetMapEntry();
|
||||||
|
|
||||||
/* online players bound to the instance (perm/solo)
|
/* online players bound to the instance (perm/solo)
|
||||||
|
|||||||
@@ -391,16 +391,9 @@ bool MapManager::DestroyMap(Map* map)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MapManager::IsValidMAP(uint32 mapid, bool startUp)
|
bool MapManager::IsValidMAP(uint32 mapId)
|
||||||
{
|
{
|
||||||
MapEntry const* mEntry = sMapStore.LookupEntry(mapid);
|
return sMapStore.LookupEntry(mapId) != nullptr;
|
||||||
|
|
||||||
if (startUp)
|
|
||||||
return mEntry ? true : false;
|
|
||||||
else
|
|
||||||
return mEntry && (!mEntry->IsDungeon() || sObjectMgr->GetInstanceTemplate(mapid));
|
|
||||||
|
|
||||||
/// @todo add check for battleground template
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapManager::UnloadAll()
|
void MapManager::UnloadAll()
|
||||||
|
|||||||
@@ -73,21 +73,21 @@ class TC_GAME_API MapManager
|
|||||||
|
|
||||||
void UnloadAll();
|
void UnloadAll();
|
||||||
|
|
||||||
static bool IsValidMAP(uint32 mapid, bool startUp);
|
static bool IsValidMAP(uint32 mapId);
|
||||||
|
|
||||||
static bool IsValidMapCoord(uint32 mapid, float x, float y)
|
static bool IsValidMapCoord(uint32 mapid, float x, float y)
|
||||||
{
|
{
|
||||||
return IsValidMAP(mapid, false) && Trinity::IsValidMapCoord(x, y);
|
return IsValidMAP(mapid) && Trinity::IsValidMapCoord(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsValidMapCoord(uint32 mapid, float x, float y, float z)
|
static bool IsValidMapCoord(uint32 mapid, float x, float y, float z)
|
||||||
{
|
{
|
||||||
return IsValidMAP(mapid, false) && Trinity::IsValidMapCoord(x, y, z);
|
return IsValidMAP(mapid) && Trinity::IsValidMapCoord(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsValidMapCoord(uint32 mapid, float x, float y, float z, float o)
|
static bool IsValidMapCoord(uint32 mapid, float x, float y, float z, float o)
|
||||||
{
|
{
|
||||||
return IsValidMAP(mapid, false) && Trinity::IsValidMapCoord(x, y, z, o);
|
return IsValidMAP(mapid) && Trinity::IsValidMapCoord(x, y, z, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsValidMapCoord(uint32 mapid, Position const& pos)
|
static bool IsValidMapCoord(uint32 mapid, Position const& pos)
|
||||||
|
|||||||
@@ -6277,9 +6277,6 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint
|
|||||||
if (targetBind->perm && targetBind->save != casterBind->save)
|
if (targetBind->perm && targetBind->save != casterBind->save)
|
||||||
return SPELL_FAILED_TARGET_LOCKED_TO_RAID_INSTANCE;
|
return SPELL_FAILED_TARGET_LOCKED_TO_RAID_INSTANCE;
|
||||||
|
|
||||||
InstanceTemplate const* instance = sObjectMgr->GetInstanceTemplate(mapId);
|
|
||||||
if (!instance)
|
|
||||||
return SPELL_FAILED_TARGET_NOT_IN_INSTANCE;
|
|
||||||
if (!target->Satisfy(sObjectMgr->GetAccessRequirement(mapId, difficulty), mapId))
|
if (!target->Satisfy(sObjectMgr->GetAccessRequirement(mapId, difficulty), mapId))
|
||||||
return SPELL_FAILED_BAD_TARGETS;
|
return SPELL_FAILED_BAD_TARGETS;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user