예제 #1
0
        // Setup runtime variable values

        public RegionState(Scene p_scene, IConfig p_config)
        {
            scene  = p_scene;
            config = p_config;

            Region = scene.RegionInfo.RegionName;
            Host   = scene.RegionInfo.ExternalHostName;
            LocX   = Convert.ToString(scene.RegionInfo.RegionLocX);
            LocY   = Convert.ToString(scene.RegionInfo.RegionLocY);
            IDK    = Convert.ToString(_idk_++);

            // OpenChannel conditionally establishes a connection to the
            // IRC server. The request will either succeed, or it will
            // throw an exception.

            ChannelState.OpenChannel(this, config);

            // Connect channel to world events

            scene.EventManager.OnChatFromWorld  += OnSimChat;
            scene.EventManager.OnChatFromClient += OnSimChat;
            scene.EventManager.OnMakeRootAgent  += OnMakeRootAgent;
            scene.EventManager.OnMakeChildAgent += OnMakeChildAgent;

            m_log.InfoFormat("[IRC-Region {0}] Initialization complete", Region);
        }
        // Setup runtime variable values

        public RegionState(Scene p_scene, IConfig p_config)
        {
            scene  = p_scene;
            config = p_config;

            Region = scene.RegionInfo.RegionName;
            Host   = scene.RegionInfo.ExternalHostName;
            LocX   = Convert.ToString(scene.RegionInfo.RegionLocX);
            LocY   = Convert.ToString(scene.RegionInfo.RegionLocY);
            IDK    = Convert.ToString(_idk_++);

            showAlert = config.GetBoolean("alert_show", false);
            string alertServerInfo = String.Empty;

            if (showAlert)
            {
                bool showAlertServerInfo = config.GetBoolean("alert_show_serverinfo", true);

                if (showAlertServerInfo)
                {
                    alertServerInfo = String.Format("\nServer: {0}\nPort: {1}\nChannel: {2}\n\n",
                                                    config.GetString("server", ""), config.GetString("port", ""), config.GetString("channel", ""));
                }

                string alertPreMessage  = config.GetString("alert_msg_pre", "This region is linked to Irc.");
                string alertPostMessage = config.GetString("alert_msg_post", "Everything you say in public chat can be listened.");

                alertMessage = String.Format("{0}\n{1}{2}", alertPreMessage, alertServerInfo, alertPostMessage);

                dialogModule = scene.RequestModuleInterface <IDialogModule>();
            }

            // OpenChannel conditionally establishes a connection to the
            // IRC server. The request will either succeed, or it will
            // throw an exception.

            ChannelState.OpenChannel(this, config);

            // Connect channel to world events

            scene.EventManager.OnChatFromWorld  += OnSimChat;
            scene.EventManager.OnChatFromClient += OnSimChat;
            scene.EventManager.OnMakeRootAgent  += OnMakeRootAgent;
            scene.EventManager.OnMakeChildAgent += OnMakeChildAgent;

            m_log.InfoFormat("[IRC-Region {0}] Initialization complete", Region);
        }