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;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "Transport.h"
|
||||
#include "Battleground.h"
|
||||
#include "InstanceSaveMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Vehicle.h"
|
||||
#include "GameTime.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
|
||||
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
|
||||
if (GetPlayer()->m_InstanceValid == false && !mInstance)
|
||||
if (GetPlayer()->m_InstanceValid == false && !!mEntry->IsDungeon())
|
||||
GetPlayer()->m_InstanceValid = true;
|
||||
|
||||
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
|
||||
Difficulty diff = newMap->GetDifficulty();
|
||||
|
||||
@@ -227,12 +227,6 @@ time_t InstanceSave::GetResetTimeForDB()
|
||||
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()
|
||||
{
|
||||
return sMapStore.LookupEntry(m_mapid);
|
||||
|
||||
@@ -74,7 +74,6 @@ class TC_GAME_API InstanceSave
|
||||
void SetResetTime(time_t resetTime) { m_resetTime = resetTime; }
|
||||
time_t GetResetTimeForDB();
|
||||
|
||||
InstanceTemplate const* GetTemplate();
|
||||
MapEntry const* GetMapEntry();
|
||||
|
||||
/* online players bound to the instance (perm/solo)
|
||||
|
||||
@@ -391,16 +391,9 @@ bool MapManager::DestroyMap(Map* map)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MapManager::IsValidMAP(uint32 mapid, bool startUp)
|
||||
bool MapManager::IsValidMAP(uint32 mapId)
|
||||
{
|
||||
MapEntry const* mEntry = sMapStore.LookupEntry(mapid);
|
||||
|
||||
if (startUp)
|
||||
return mEntry ? true : false;
|
||||
else
|
||||
return mEntry && (!mEntry->IsDungeon() || sObjectMgr->GetInstanceTemplate(mapid));
|
||||
|
||||
/// @todo add check for battleground template
|
||||
return sMapStore.LookupEntry(mapId) != nullptr;
|
||||
}
|
||||
|
||||
void MapManager::UnloadAll()
|
||||
|
||||
@@ -73,21 +73,21 @@ class TC_GAME_API MapManager
|
||||
|
||||
void UnloadAll();
|
||||
|
||||
static bool IsValidMAP(uint32 mapid, bool startUp);
|
||||
static bool IsValidMAP(uint32 mapId);
|
||||
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
|
||||
@@ -6277,9 +6277,6 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint
|
||||
if (targetBind->perm && targetBind->save != casterBind->save)
|
||||
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))
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user