Core/GameEventMgr: Spawn creatures and gameobjects in all active instances when event starts
Port From (https://github.com/TrinityCore/TrinityCore/commit/6ca0f99ccfc6549f3390a1bac151f85fdcb77561)
This commit is contained in:
@@ -1190,11 +1190,13 @@ namespace Game
|
|||||||
Global.ObjectMgr.AddCreatureToGrid(data);
|
Global.ObjectMgr.AddCreatureToGrid(data);
|
||||||
|
|
||||||
// Spawn if necessary (loaded grids only)
|
// Spawn if necessary (loaded grids only)
|
||||||
Map map = Global.MapMgr.CreateBaseMap(data.MapId);
|
Global.MapMgr.DoForAllMapsWithMapId(data.MapId, map =>
|
||||||
map.RemoveRespawnTime(SpawnObjectType.Creature, guid);
|
{
|
||||||
// We use spawn coords to spawn
|
map.RemoveRespawnTime(SpawnObjectType.Creature, guid);
|
||||||
if (map != null && !map.Instanceable() && map.IsGridLoaded(data.SpawnPoint))
|
// We use spawn coords to spawn
|
||||||
Creature.CreateCreatureFromDB(guid, map);
|
if (map.IsGridLoaded(data.SpawnPoint))
|
||||||
|
Creature.CreateCreatureFromDB(guid, map);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1214,20 +1216,25 @@ namespace Game
|
|||||||
Global.ObjectMgr.AddGameObjectToGrid(data);
|
Global.ObjectMgr.AddGameObjectToGrid(data);
|
||||||
// Spawn if necessary (loaded grids only)
|
// Spawn if necessary (loaded grids only)
|
||||||
// this base map checked as non-instanced and then only existed
|
// this base map checked as non-instanced and then only existed
|
||||||
Map map = Global.MapMgr.CreateBaseMap(data.MapId);
|
Global.MapMgr.DoForAllMapsWithMapId(data.MapId, map =>
|
||||||
map.RemoveRespawnTime(SpawnObjectType.GameObject, guid);
|
|
||||||
// We use current coords to unspawn, not spawn coords since creature can have changed grid
|
|
||||||
if (map != null && !map.Instanceable() && map.IsGridLoaded(data.SpawnPoint))
|
|
||||||
{
|
{
|
||||||
GameObject pGameobject = GameObject.CreateGameObjectFromDB(guid, map, false);
|
map.RemoveRespawnTime(SpawnObjectType.GameObject, guid);
|
||||||
// @todo find out when it is add to map
|
// We use current coords to unspawn, not spawn coords since creature can have changed grid
|
||||||
if (pGameobject)
|
if (map.IsGridLoaded(data.SpawnPoint))
|
||||||
{
|
{
|
||||||
|
GameObject go = GameObject.CreateGameObjectFromDB(guid, map, false);
|
||||||
// @todo find out when it is add to map
|
// @todo find out when it is add to map
|
||||||
if (pGameobject.IsSpawnedByDefault())
|
if (go)
|
||||||
map.AddToMap(pGameobject);
|
{
|
||||||
|
// @todo find out when it is add to map
|
||||||
|
if (go.IsSpawnedByDefault())
|
||||||
|
{
|
||||||
|
if (!map.AddToMap(go))
|
||||||
|
go.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user