Core/Spawns: merged Dynamic Spawning
This commit is contained in:
1 parent
21795a5ae5
commit
b976bc1187
87 files changed
+3200
-1007
No files matched your search
@@ -28,6 +28,7 @@
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "World.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
void ObjectGridEvacuator::Visit(CreatureMapType &m)
|
||||
{
|
||||
@@ -120,15 +121,48 @@ void LoadHelper(CellGuidSet const& guid_set, CellCoord &cell, GridRefManager<T>
|
||||
for (CellGuidSet::const_iterator i_guid = guid_set.begin(); i_guid != guid_set.end(); ++i_guid)
|
||||
{
|
||||
T* obj = new T;
|
||||
ObjectGuid::LowType guid = *i_guid;
|
||||
//TC_LOG_INFO("misc", "DEBUG: LoadHelper from table: %s for (guid: %u) Loading", table, guid);
|
||||
if (!obj->LoadFromDB(guid, map))
|
||||
{
|
||||
delete obj;
|
||||
continue;
|
||||
}
|
||||
|
||||
AddObjectHelper(cell, m, count, map, obj);
|
||||
// Don't spawn at all if there's a respawn time
|
||||
if ((obj->GetTypeId() == TYPEID_UNIT && !map->GetCreatureRespawnTime(*i_guid)) || (obj->GetTypeId() == TYPEID_GAMEOBJECT && !map->GetGORespawnTime(*i_guid)))
|
||||
{
|
||||
ObjectGuid::LowType guid = *i_guid;
|
||||
//TC_LOG_INFO("misc", "DEBUG: LoadHelper from table: %s for (guid: %u) Loading", table, guid);
|
||||
|
||||
if (obj->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
CreatureData const* cdata = sObjectMgr->GetCreatureData(guid);
|
||||
ASSERT(cdata, "Tried to load creature with spawnId %u, but no such creature exists.", guid);
|
||||
SpawnGroupTemplateData const* const group = cdata->spawnGroupData;
|
||||
// If creature in manual spawn group, don't spawn here, unless group is already active.
|
||||
if (!(group->flags & SPAWNGROUP_FLAG_SYSTEM))
|
||||
if (!map->IsSpawnGroupActive(group->groupId))
|
||||
{
|
||||
delete obj;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (obj->GetTypeId() == TYPEID_GAMEOBJECT)
|
||||
{
|
||||
// If gameobject in manual spawn group, don't spawn here, unless group is already active.
|
||||
GameObjectData const* godata = sObjectMgr->GetGameObjectData(guid);
|
||||
ASSERT(godata, "Tried to load gameobject with spawnId %u, but no such object exists.", guid);
|
||||
if (!(godata->spawnGroupData->flags & SPAWNGROUP_FLAG_SYSTEM))
|
||||
if (!map->IsSpawnGroupActive(godata->spawnGroupData->groupId))
|
||||
{
|
||||
delete obj;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!obj->LoadFromDB(guid, map, false, false))
|
||||
{
|
||||
delete obj;
|
||||
continue;
|
||||
}
|
||||
AddObjectHelper(cell, m, count, map, obj);
|
||||
}
|
||||
else
|
||||
delete obj;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user