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);
|
||||
|
||||
// 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
|
||||
if (map != null && !map.Instanceable() && map.IsGridLoaded(data.SpawnPoint))
|
||||
if (map.IsGridLoaded(data.SpawnPoint))
|
||||
Creature.CreateCreatureFromDB(guid, map);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1214,21 +1216,26 @@ namespace Game
|
||||
Global.ObjectMgr.AddGameObjectToGrid(data);
|
||||
// Spawn if necessary (loaded grids only)
|
||||
// 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))
|
||||
if (map.IsGridLoaded(data.SpawnPoint))
|
||||
{
|
||||
GameObject pGameobject = GameObject.CreateGameObjectFromDB(guid, map, false);
|
||||
GameObject go = GameObject.CreateGameObjectFromDB(guid, map, false);
|
||||
// @todo find out when it is add to map
|
||||
if (pGameobject)
|
||||
if (go)
|
||||
{
|
||||
// @todo find out when it is add to map
|
||||
if (pGameobject.IsSpawnedByDefault())
|
||||
map.AddToMap(pGameobject);
|
||||
if (go.IsSpawnedByDefault())
|
||||
{
|
||||
if (!map.AddToMap(go))
|
||||
go.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (internal_event_id < 0 || internal_event_id >= mGameEventPoolIds.Length)
|
||||
|
||||
Reference in New Issue
Block a user