コード例 #1
0
        public void GodlikeMessage(IClientAPI client, UUID requester, string Method, List<string> Parameters)
        {
            ScenePresence Sp = m_scene.GetScenePresence(client.AgentId);
            if (!m_scene.Permissions.CanIssueEstateCommand(client.AgentId, false))
                return;

            string parameter1 = Parameters[0];
            if (Method == "telehub")
            {
                if (parameter1 == "spawnpoint remove")
                {
                    Telehub telehub = m_scene.StorageManager.EstateDataStore.FindTelehub(client.Scene.RegionInfo.RegionID);
                    if (telehub == null)
                        return;
                    //Remove the one we sent at X
                    telehub.SpawnPos.RemoveAt(int.Parse(Parameters[1]));
                    m_scene.StorageManager.EstateDataStore.AddTelehub(telehub);
                    SendTelehubInfo(client);
                }
                if (parameter1 == "spawnpoint add")
                {
                    SceneObjectPart part = Sp.Scene.GetSceneObjectPart(uint.Parse(Parameters[1]));
                    if (part == null)
                        return;
                    Telehub telehub = m_scene.StorageManager.EstateDataStore.FindTelehub(client.Scene.RegionInfo.RegionID);
                    if (telehub == null)
                        return;
                    telehub.RegionID = client.Scene.RegionInfo.RegionID;
                    if (telehub.TelehubLoc.X == 0 && telehub.TelehubLoc.Y == 0)
                        return; //No spawns without a telehub
                    telehub.SpawnPos.Add(part.AbsolutePosition - telehub.TelehubLoc); //Spawns are offsets
                    m_scene.StorageManager.EstateDataStore.AddTelehub(telehub);
                    SendTelehubInfo(client);
                }
                if (parameter1 == "delete")
                {
                    m_scene.StorageManager.EstateDataStore.RemoveTelehub(client.Scene.RegionInfo.RegionID);
                    SendTelehubInfo(client);
                }
                if (parameter1 == "connect")
                {
                    SceneObjectPart part = Sp.Scene.GetSceneObjectPart(uint.Parse(Parameters[1]));
                    if (part == null)
                        return;
                    Telehub telehub = m_scene.StorageManager.EstateDataStore.FindTelehub(client.Scene.RegionInfo.RegionID);
                    if (telehub == null)
                        telehub = new Telehub();
                    telehub.RegionID = client.Scene.RegionInfo.RegionID;
                    telehub.TelehubLoc = part.AbsolutePosition;
                    telehub.TelehubRot = part.ParentGroup.Rotation;
                    telehub.ObjectUUID = part.UUID;
                    telehub.Name = part.Name;
                    m_scene.StorageManager.EstateDataStore.AddTelehub(telehub);
                    SendTelehubInfo(client);
                }

                if (parameter1 == "info ui")
                    SendTelehubInfo(client);
            }
        }
コード例 #2
0
ファイル: MySQLEstateData.cs プロジェクト: BogusCurry/halcyon
        /// <summary>
        ///     Adds a new telehub in the region. Replaces an old one automatically.
        /// </summary>
        /// <param name="telehub"></param>
        /// <param name="regionhandle"> </param>
        public void AddTelehub(Telehub telehub)
        {
            string sql = "REPLACE into telehubs (RegionID, TelehubLoc, TelehubRot, ObjectUUID, Spawns, Name) VALUES (?RegionID, ?TelehubLoc, ?TelehubRot, ?ObjectUUID, ?Spawns, ?Name)";

            using (MySqlConnection conn = GetConnection())
            {
                using (MySqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandText = sql;
                    cmd.Parameters.Add("?RegionID", telehub.RegionID.ToString());
                    cmd.Parameters.Add("?TelehubLoc", telehub.TelehubLoc.ToString());
                    cmd.Parameters.Add("?TelehubRot", telehub.TelehubRot.ToString());
                    cmd.Parameters.Add("?ObjectUUID", telehub.ObjectUUID.ToString());
                    cmd.Parameters.Add("?Spawns", telehub.BuildFromList(telehub.SpawnPos));
                    cmd.Parameters.Add("?Name", telehub.Name);
                    cmd.ExecuteNonQuery();
                }
            }
        }