From 853b58934805ab6db11ff1072c6b1dcd7776e984 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Fri, 17 Dec 2021 17:55:34 -0500 Subject: [PATCH] game event respawn Port From (https://github.com/TrinityCore/TrinityCore/commit/4e7727d575f2c22dddc6327d89e0cfecb9b9748e) --- Source/Game/Events/GameEventManager.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/Game/Events/GameEventManager.cs b/Source/Game/Events/GameEventManager.cs index 4ff2864e3..3f5d67a15 100644 --- a/Source/Game/Events/GameEventManager.cs +++ b/Source/Game/Events/GameEventManager.cs @@ -1190,7 +1190,8 @@ namespace Game Global.ObjectMgr.AddCreatureToGrid(guid, data); // Spawn if necessary (loaded grids only) - Map map = Global.MapMgr.FindMap(data.spawnPoint.GetMapId(), 0); + Map map = Global.MapMgr.CreateBaseMap(data.spawnPoint.GetMapId()); + map.RemoveRespawnTime(SpawnObjectType.Creature, guid); // We use spawn coords to spawn if (map != null && !map.Instanceable() && map.IsGridLoaded(data.spawnPoint)) Creature.CreateCreatureFromDB(guid, map); @@ -1213,7 +1214,8 @@ namespace Game Global.ObjectMgr.AddGameObjectToGrid(guid, data); // Spawn if necessary (loaded grids only) // this base map checked as non-instanced and then only existed - Map map = Global.MapMgr.FindMap(data.spawnPoint.GetMapId(), 0); + Map map = Global.MapMgr.CreateBaseMap(data.spawnPoint.GetMapId()); + 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)) { @@ -1265,6 +1267,7 @@ namespace Game Global.MapMgr.DoForAllMapsWithMapId(data.spawnPoint.GetMapId(), map => { + map.RemoveRespawnTime(SpawnObjectType.Creature, guid); var creatureBounds = map.GetCreatureBySpawnIdStore().LookupByKey(guid); foreach (var creature in creatureBounds) creature.AddObjectToRemoveList(); @@ -1292,6 +1295,7 @@ namespace Game Global.MapMgr.DoForAllMapsWithMapId(data.spawnPoint.GetMapId(), map => { + map.RemoveRespawnTime(SpawnObjectType.GameObject, guid); var gameobjectBounds = map.GetGameObjectBySpawnIdStore().LookupByKey(guid); foreach (var go in gameobjectBounds) go.AddObjectToRemoveList();