diff --git a/Source/Game/BattleGrounds/BattleGroundManager.cs b/Source/Game/BattleGrounds/BattleGroundManager.cs index 85ad2db4c..f6615293b 100644 --- a/Source/Game/BattleGrounds/BattleGroundManager.cs +++ b/Source/Game/BattleGrounds/BattleGroundManager.cs @@ -417,7 +417,7 @@ namespace Game.BattleGrounds WorldSafeLocsEntry pos = bg.GetTeamStartPosition(Battleground.GetTeamIndexByTeamId(team)); Log.outDebug(LogFilter.Battleground, $"BattlegroundMgr.SendToBattleground: Sending {player.GetName()} to map {mapid}, {pos.Loc} (bgType {bgTypeId})"); - player.TeleportTo(pos.Loc); + player.TeleportTo(new Entities.TeleportLocation() { Location = pos.Loc, TransportGuid = pos.TransportSpawnId.HasValue ? ObjectGuid.Create(HighGuid.Transport, pos.TransportSpawnId.Value) : ObjectGuid.Empty }); } else Log.outError(LogFilter.Battleground, $"BattlegroundMgr.SendToBattleground: Instance {instanceId} (bgType {bgTypeId}) not found while trying to teleport player {player.GetName()}"); diff --git a/Source/Game/Entities/Player/Player.cs b/Source/Game/Entities/Player/Player.cs index 1ce41496c..348ad6598 100644 --- a/Source/Game/Entities/Player/Player.cs +++ b/Source/Game/Entities/Player/Player.cs @@ -4480,7 +4480,7 @@ namespace Game.Entities // and don't show spirit healer location if (closestGrave != null) { - TeleportTo(closestGrave.Loc, shouldResurrect ? TeleportToOptions.ReviveAtTeleport : 0); + TeleportTo(new TeleportLocation() { Location = closestGrave.Loc, TransportGuid = closestGrave.TransportSpawnId.HasValue ? ObjectGuid.Create(HighGuid.Transport, closestGrave.TransportSpawnId.Value) : ObjectGuid.Empty }, shouldResurrect ? TeleportToOptions.ReviveAtTeleport : TeleportToOptions.None); if (IsDead()) // not send if alive, because it used in TeleportTo() { DeathReleaseLoc packet = new(); diff --git a/Source/Game/Globals/ObjectManager.cs b/Source/Game/Globals/ObjectManager.cs index 0e6bcf1a7..fd289ae87 100644 --- a/Source/Game/Globals/ObjectManager.cs +++ b/Source/Game/Globals/ObjectManager.cs @@ -800,8 +800,8 @@ namespace Game { uint oldMSTime = Time.GetMSTime(); - // 0 1 2 3 4 5 - SQLResult result = DB.World.Query("SELECT ID, MapID, LocX, LocY, LocZ, Facing FROM world_safe_locs"); + // 0 1 2 3 4 5 6 + SQLResult result = DB.World.Query("SELECT ID, MapID, LocX, LocY, LocZ, Facing, TransportSpawnId FROM world_safe_locs"); if (result.IsEmpty()) { Log.outInfo(LogFilter.ServerLoading, "Loaded 0 world locations. DB table `world_safe_locs` is empty."); @@ -817,9 +817,23 @@ namespace Game continue; } + ulong? transportSpawnId = null; + if (!result.IsNull(6)) + { + ulong spawnId = result.Read(6); + if (Global.TransportMgr.GetTransportSpawn(spawnId) == null) + { + Log.outError(LogFilter.Sql, $"World location (ID: {id}) has a invalid transportSpawnID {spawnId}, skipped."); + continue; + } + + transportSpawnId = spawnId; + } + WorldSafeLocsEntry worldSafeLocs = new(); worldSafeLocs.Id = id; worldSafeLocs.Loc = loc; + worldSafeLocs.TransportSpawnId = transportSpawnId; _worldSafeLocs[id] = worldSafeLocs; } while (result.NextRow()); @@ -11491,6 +11505,7 @@ namespace Game { public uint Id; public WorldLocation Loc; + public ulong? TransportSpawnId; } public class GraveyardData