Exemplo n.º 1
0
        private byte[] RemoveTelehub(Dictionary <string, object> request)
        {
            Dictionary <string, object> result = new Dictionary <string, object>();

            int RegionX, RegionY;

            Util.UlongToInts(m_regionHandle, out RegionX, out RegionY);
            GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, RegionX, RegionY);

            if (r != null)
            {
                TelehubConnector.RemoveTelehub(r.RegionID, 0);
            }
            result["result"] = "Successful";

            string       xmlString = WebUtils.BuildXmlResponse(result);
            UTF8Encoding encoding  = new UTF8Encoding();

            return(encoding.GetBytes(xmlString));
        }
Exemplo n.º 2
0
        public void GodlikeMessage(IClientAPI client, UUID requester, string Method, List <string> Parameters)
        {
            if (RegionConnector == null)
            {
                return;
            }
            IScenePresence Sp = ((Scene)client.Scene).GetScenePresence(client.AgentId);

            if (!((Scene)client.Scene).Permissions.CanIssueEstateCommand(client.AgentId, false))
            {
                return;
            }

            string parameter1 = Parameters[0];

            if (Method == "telehub")
            {
                if (parameter1 == "spawnpoint remove")
                {
                    Telehub telehub = RegionConnector.FindTelehub(client.Scene.RegionInfo.RegionID, client.Scene.RegionInfo.RegionHandle);
                    if (telehub == null)
                    {
                        return;
                    }
                    //Remove the one we sent at X
                    telehub.SpawnPos.RemoveAt(int.Parse(Parameters[1]));
                    RegionConnector.AddTelehub(telehub, client.Scene.RegionInfo.RegionHandle);
                    SendTelehubInfo(client);
                }
                if (parameter1 == "spawnpoint add")
                {
                    ISceneChildEntity part = Sp.Scene.GetSceneObjectPart(uint.Parse(Parameters[1]));
                    if (part == null)
                    {
                        return;
                    }
                    Telehub telehub = RegionConnector.FindTelehub(client.Scene.RegionInfo.RegionID, client.Scene.RegionInfo.RegionHandle);
                    if (telehub == null)
                    {
                        return;
                    }
                    telehub.RegionLocX = client.Scene.RegionInfo.RegionLocX;
                    telehub.RegionLocY = client.Scene.RegionInfo.RegionLocY;
                    telehub.RegionID   = client.Scene.RegionInfo.RegionID;
                    Vector3 pos = new Vector3(telehub.TelehubLocX, telehub.TelehubLocY, telehub.TelehubLocZ);
                    if (telehub.TelehubLocX == 0 && telehub.TelehubLocY == 0)
                    {
                        return;                                        //No spawns without a telehub
                    }
                    telehub.SpawnPos.Add(part.AbsolutePosition - pos); //Spawns are offsets
                    RegionConnector.AddTelehub(telehub, client.Scene.RegionInfo.RegionHandle);
                    SendTelehubInfo(client);
                }
                if (parameter1 == "delete")
                {
                    RegionConnector.RemoveTelehub(client.Scene.RegionInfo.RegionID, client.Scene.RegionInfo.RegionHandle);
                    SendTelehubInfo(client);
                }
                if (parameter1 == "connect")
                {
                    ISceneChildEntity part = Sp.Scene.GetSceneObjectPart(uint.Parse(Parameters[1]));
                    if (part == null)
                    {
                        return;
                    }
                    Telehub telehub = RegionConnector.FindTelehub(client.Scene.RegionInfo.RegionID, client.Scene.RegionInfo.RegionHandle);
                    if (telehub == null)
                    {
                        telehub = new Telehub();
                    }
                    telehub.RegionLocX  = client.Scene.RegionInfo.RegionLocX;
                    telehub.RegionLocY  = client.Scene.RegionInfo.RegionLocY;
                    telehub.RegionID    = client.Scene.RegionInfo.RegionID;
                    telehub.TelehubLocX = part.AbsolutePosition.X;
                    telehub.TelehubLocY = part.AbsolutePosition.Y;
                    telehub.TelehubLocZ = part.AbsolutePosition.Z;
                    telehub.TelehubRotX = part.ParentEntity.Rotation.X;
                    telehub.TelehubRotY = part.ParentEntity.Rotation.Y;
                    telehub.TelehubRotZ = part.ParentEntity.Rotation.Z;
                    telehub.ObjectUUID  = part.UUID;
                    telehub.Name        = part.Name;
                    RegionConnector.AddTelehub(telehub, client.Scene.RegionInfo.RegionHandle);
                    SendTelehubInfo(client);
                }

                if (parameter1 == "info ui")
                {
                    SendTelehubInfo(client);
                }
            }
        }