/// <summary> /// Add a new teleport destination in memory and save to database, if /// successful. /// </summary> /// <param name="client"></param> /// <param name="teleportID"></param> /// <param name="type"></param> private void AddTeleport(GameClient client, String teleportID, String type) { GamePlayer player = client.Player; eRealm realm = player.Realm; if (WorldMgr.GetTeleportLocation(realm, String.Format("{0}:{1}", type, teleportID)) != null) { client.Out.SendMessage(String.Format("Teleport ID [{0}] already exists!", teleportID), eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } Teleport teleport = new Teleport(); teleport.TeleportID = teleportID; teleport.Realm = (int)realm; teleport.RegionID = player.CurrentRegion.ID; teleport.X = player.X; teleport.Y = player.Y; teleport.Z = player.Z; teleport.Heading = player.Heading; teleport.Type = type; if (!WorldMgr.AddTeleportLocation(teleport)) { client.Out.SendMessage(String.Format("Failed to add teleport ID [{0}] in memory!", teleportID), eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } GameServer.Database.AddObject(teleport); client.Out.SendMessage(String.Format("Teleport ID [{0}] successfully added.", teleportID), eChatType.CT_System, eChatLoc.CL_SystemWindow); }