示例#1
0
        public void Start(IScene scene)
        {
            m_scene = scene;

            m_regionInfo  = scene.GetSceneModule <RegionInfo>();
            m_permissions = scene.GetSceneModule <LLPermissions>();

            m_estateClient = scene.Simian.GetAppModule <IEstateClient>();
            if (m_estateClient != null)
            {
                if (!m_estateClient.TryGetEstate(scene.ID, out m_estate))
                {
                    // FIXME: Get the config file entry for this sim's estate name and join it or
                    // create it if it doesn't exist
                }
            }

            m_udp = m_scene.GetSceneModule <LLUDP>();
            if (m_udp != null)
            {
                m_udp.AddPacketHandler(PacketType.RequestRegionInfo, RequestRegionInfoHandler);
                m_udp.AddPacketHandler(PacketType.EstateCovenantRequest, EstateCovenantRequestHandler);
                m_udp.AddPacketHandler(PacketType.EstateOwnerMessage, EstateOwnerMessageHandler);
                m_udp.AddPacketHandler(PacketType.GodlikeMessage, GodlikeMessageHandler);
                m_udp.AddPacketHandler(PacketType.GodUpdateRegionInfo, GodUpdateRegionInfoHandler);
            }
        }
示例#2
0
        public bool IsEstateManager(IScenePresence presence)
        {
            // If we are running without a connection to an estate service,
            // assume no users are estate managers
            if (m_estateClient == null)
            {
                return(false);
            }

            // Try to fetch this scene's estate and check if this presence is the
            // estate owner or a manager
            Estate estate;

            if (m_estateClient.TryGetEstate(m_scene.ID, out estate))
            {
                return(estate.OwnerID == presence.ID || estate.ContainsManager(presence.ID));
            }

            return(false);
        }
示例#3
0
文件: Estates.cs 项目: thoys/simian
        public void Start(IScene scene)
        {
            m_scene = scene;

            m_regionInfo = scene.GetSceneModule<RegionInfo>();
            m_permissions = scene.GetSceneModule<LLPermissions>();

            m_estateClient = scene.Simian.GetAppModule<IEstateClient>();
            if (m_estateClient != null)
            {
                if (!m_estateClient.TryGetEstate(scene.ID, out m_estate))
                {
                    // FIXME: Get the config file entry for this sim's estate name and join it or
                    // create it if it doesn't exist
                }
            }

            m_udp = m_scene.GetSceneModule<LLUDP>();
            if (m_udp != null)
            {
                m_udp.AddPacketHandler(PacketType.RequestRegionInfo, RequestRegionInfoHandler);
                m_udp.AddPacketHandler(PacketType.EstateCovenantRequest, EstateCovenantRequestHandler);
                m_udp.AddPacketHandler(PacketType.EstateOwnerMessage, EstateOwnerMessageHandler);
                m_udp.AddPacketHandler(PacketType.GodlikeMessage, GodlikeMessageHandler);
                m_udp.AddPacketHandler(PacketType.GodUpdateRegionInfo, GodUpdateRegionInfoHandler);
            }
        }
示例#4
0
        private void EstateOwnerMessageHandler(Packet packet, LLAgent agent)
        {
            EstateOwnerMessagePacket message = (EstateOwnerMessagePacket)packet;
            string method = Utils.BytesToString(message.MethodData.Method);
            Estate estate;

            if (m_estateClient == null)
            {
                m_log.Warn("Ignoring estate owner message \"" + method + "\", no IEstateClient");
                return;
            }
            if (!m_estateClient.TryGetEstate(m_scene.ID, out estate))
            {
                m_log.Warn("Ignoring estate owner message \"" + method + "\", scene " + m_scene.Name + " has no estate");
                return;
            }
            if (m_permissions != null)
            {
                if (!m_permissions.IsEstateManager(agent))
                {
                    m_log.Warn("Ignoring estate owner message \"" + method + "\" from non-manager " + agent.Name);
                    return;
                }
            }

            string[] parameters = new string[message.ParamList.Length];

            for (int i = 0; i < message.ParamList.Length; i++)
            {
                parameters[i] = Utils.BytesToString(message.ParamList[0].Parameter);
            }

            switch (method)
            {
            case "getinfo":
                SendDetailedEstateData(agent, estate, message.MethodData.Invoice);
                SendEstateAccessList(agent, estate, EstateAccessFlags.Managers | EstateAccessFlags.AllowedAgents |
                                     EstateAccessFlags.AllowedGroups | EstateAccessFlags.BannedAgents, message.MethodData.Invoice);
                break;

            case "setregioninfo":
                SetRegionInfo(agent, estate, parameters);
                break;

            case " texturedetail":
                SetTextureDetail(agent, estate, parameters);
                break;

            case "textureheights":
                SetTextureHeights(agent, estate, parameters);
                break;

            case "texturecommit":
                BroadcastRegionHandshake();
                break;

            case "setregionterrain":
                SetRegionTerrain(agent, estate, parameters);
                break;

            case "restart":
                //RegionRestart(parameters);
                break;

            case "estatechangecovenantid":
                ChangeCovenantID(agent, estate, parameters, message.MethodData.Invoice);
                break;

            case "estateaccessdelta":
                ChangeEstateAccess(agent, estate, parameters, message.MethodData.Invoice);
                break;

            case "simulatormessage":
                //SimulatorMessage(agent, estate, parameters);
                break;

            case "instantmessage":
                //InstantMessage(agent, estate, parameters);
                break;

            case "setregiondebug":
                //SetRegionDebug(agent, estate, parameters);
                break;

            case "teleporthomeuser":
                //TeleportHomeUser(agent, estate, parameters);
                break;

            case "teleporthomeallusers":
                //TeleportHomeAllUsers(agent, estate, parameters);
                break;

            case "colliders":
                //GetColliders(agent, estate, parameters);
                break;

            case "scripts":
                //GetScripts(agent, estate, parameters);
                break;

            case "terrain":
                //GetTerrain(agent, estate, parameters);
                break;

            case "estatechangeinfo":
                //EstateChangeInfo(agent, estate, parameters);
                break;

            case "refreshmapvisibility":
                //RefreshMapVisibility();
                break;

            default:
                m_log.Warn("Unrecognized EstateOwnerMessage \"" + method + "\" from " + agent.Name);
                break;
            }
        }