static public Zone_Respawn GetZoneRespawn(UInt16 ZoneID, byte Realm, Point3D PinPosition) { Zone_Respawn Respawn = null; List <Zone_Respawn> Respawns; if (_Zone_Respawn.TryGetValue(ZoneID, out Respawns)) { float LastDistance = float.MaxValue; foreach (Zone_Respawn Res in Respawns) { if (Res.Realm != Realm) { continue; } Point3D Pos = new Point3D(Res.PinX, Res.PinY, Res.PinZ); float Distance = Pos.GetDistance(PinPosition); if (Distance < LastDistance) { LastDistance = Distance; Respawn = Res; } } } else { Log.Error("WorldMgr", "Zone Respawn not found for : " + ZoneID); } return(Respawn); }
public SpawnPoint(Zone_Respawn respawn) { Point3D world; if (respawn.InZoneID != 0) { world = ZoneService.GetWorldPosition( ZoneService.GetZone_Info( (ushort)respawn.InZoneID), respawn.PinX, respawn.PinY, respawn.PinZ); ZoneId = (ushort)respawn.InZoneID; } else { world = ZoneService.GetWorldPosition( ZoneService.GetZone_Info( (ushort)respawn.ZoneID), respawn.PinX, respawn.PinY, respawn.PinZ); ZoneId = (ushort)respawn.ZoneID; } X = world.X; Y = world.Y; Z = world.Z; }
public void RespawnPlayer() { Zone_Respawn Respawn = WorldMgr.GetZoneRespawn(Zone.ZoneId, (byte)Realm, this); if (Respawn != null) { SafePinTeleport(Respawn.PinX, Respawn.PinY, Respawn.PinZ, Respawn.WorldO); } RezUnit(); }
static public bool RespawnAdd(Player Plr, ref List <string> Values) { Zone_Respawn Respawn = new Zone_Respawn(); Respawn.PinX = (UInt16)Plr.X; Respawn.PinY = (UInt16)Plr.Y; Respawn.PinZ = (UInt16)Plr.Z; Respawn.WorldO = Plr.Heading; Respawn.ZoneID = Plr.Zone.ZoneId; Respawn.Realm = (byte)Plr.Realm; WorldMgr.Database.AddObject(Respawn); WorldMgr.LoadZone_Respawn(); return(true); }
/// <summary> /// /// </summary> /// <param name="plr">Player that initiated the command</param> /// <param name="values">List of command arguments (after command name)</param> /// <returns>True if command was correctly handled, false if operation was canceled</returns> public static bool RespawnRemove(Player plr, ref List <string> values) { int id = GetInt(ref values); Zone_Respawn respawn = WorldMgr.Database.SelectObject <Zone_Respawn>("RespawnID=" + id); if (respawn != null) { WorldMgr.Database.DeleteObject(respawn); ZoneService.LoadZone_Respawn(); } else { return(false); } return(true); }
static public bool RespawnRemove(Player Plr, ref List <string> Values) { int ID = GetInt(ref Values); Zone_Respawn Respawn = WorldMgr.Database.SelectObject <Zone_Respawn>("RespawnID=" + ID); if (Respawn != null) { WorldMgr.Database.DeleteObject(Respawn); WorldMgr.LoadZone_Respawn(); } else { return(false); } return(true); }
public void RespawnPlayer() { if (!GetPlayer().IsDead) { return; } EvtInterface.RemoveEvent(AutomaticRespawnPlayer); EvtInterface.RemoveEvent(RespawnPlayer); Zone_Respawn Respawn = WorldMgr.GetZoneRespawn(Zone.ZoneId, (byte)Realm, this); if (Respawn != null) { SafePinTeleport(Respawn.PinX, Respawn.PinY, Respawn.PinZ, Respawn.WorldO); } RezUnit(); }
/// <summary> /// /// </summary> /// <param name="plr">Player that initiated the command</param> /// <param name="values">List of command arguments (after command name)</param> /// <returns>True if command was correctly handled, false if operation was canceled</returns> public static bool RespawnAdd(Player plr, ref List <string> values) { byte realm = (byte)GetInt(ref values); Zone_Respawn respawn = new Zone_Respawn { PinX = (ushort)plr.X, PinY = (ushort)plr.Y, PinZ = (ushort)plr.Z, WorldO = plr.Heading, ZoneID = plr.Zone.ZoneId, Realm = realm }; WorldMgr.Database.AddObject(respawn); ZoneService.LoadZone_Respawn(); GameObject_proto proto = GameObjectService.GetGameObjectProto(563); GameObject_spawn spawn = new GameObject_spawn { Guid = (uint)GameObjectService.GenerateGameObjectSpawnGUID(), WorldX = plr.WorldPosition.X, WorldY = plr.WorldPosition.Y, WorldZ = plr.WorldPosition.Z, WorldO = plr.Heading, ZoneId = plr.Zone.ZoneId }; spawn.BuildFromProto(proto); plr.Region.CreateGameObject(spawn); GMCommandLog log = new GMCommandLog { PlayerName = plr.Name, AccountId = (uint)plr.Client._Account.AccountId, Command = "ADD RESPAWN TO " + plr.Zone.ZoneId + " " + (ushort)plr.X + " " + (ushort)plr.Y, Date = DateTime.Now }; CharMgr.Database.AddObject(log); return(true); }
/// <summary> /// /// </summary> /// <param name="plr">Player that initiated the command</param> /// <param name="values">List of command arguments (after command name)</param> /// <returns>True if command was correctly handled, false if operation was canceled</returns> public static bool RespawnModify(Player plr, ref List <string> values) { int id = GetInt(ref values); Zone_Respawn respawn = WorldMgr.Database.SelectObject <Zone_Respawn>("RespawnID=" + id); if (respawn == null) { return(false); } respawn.PinX = (ushort)plr.X; respawn.PinY = (ushort)plr.Y; respawn.PinZ = (ushort)plr.Z; respawn.WorldO = plr.Heading; respawn.ZoneID = plr.Zone.ZoneId; respawn.Realm = (byte)plr.Realm; WorldMgr.Database.SaveObject(respawn); ZoneService.LoadZone_Respawn(); return(true); }
static public bool RespawnModify(Player Plr, ref List <string> Values) { int ID = GetInt(ref Values); Zone_Respawn Respawn = WorldMgr.Database.SelectObject <Zone_Respawn>("RespawnID=" + ID); if (Respawn == null) { return(false); } Respawn.PinX = (UInt16)Plr.X; Respawn.PinY = (UInt16)Plr.Y; Respawn.PinZ = (UInt16)Plr.Z; Respawn.WorldO = Plr.Heading; Respawn.ZoneID = Plr.Zone.ZoneId; Respawn.Realm = (byte)Plr.Realm; WorldMgr.Database.SaveObject(Respawn); WorldMgr.LoadZone_Respawn(); return(true); }