예제 #1
0
 public override CmdResult ExecuteRequest(CmdRequest args)
 {
     BotClient Client = TheBotClient;
     if (Client.IsLoggedInAndReady) return Success("Already logged in");
     {
         string value;
         if (args.TryGetValue("first", out value))
         {
             Client.BotLoginParams.FirstName = value;
         }
         if (args.TryGetValue("last", out value))
         {
             Client.BotLoginParams.LastName = value;
         }
         if (args.TryGetValue("pass", out value))
         {
             Client.BotLoginParams.Password = value;
         }
         if (args.TryGetValue("loginuri", out value))
         {
             Radegast.GridManager gm = new GridManager();
             gm.LoadGrids();
             string url = value;
             string find = url.ToLower();
             foreach (var grid in gm.Grids)
             {
                 if (find == grid.Name.ToLower() || find == grid.ID.ToLower())
                 {
                     url = grid.LoginURI;
                 }
             }
             Client.BotLoginParams.URI = url;
         }
         if (args.TryGetValue("location", out value))
         {
             Client.BotLoginParams.Start = value;
         }
         if (!Client.Network.Connected && !Client.Network.LoginMessage.StartsWith("Logging"))
         {
             Client.Settings.LOGIN_SERVER = TheBotClient.BotLoginParams.URI;
                 // ClientManager.SingleInstance.config.simURL; // "http://127.0.0.1:8002/";
             ///                    Client.Network.Login(Client.BotLoginParams.FirstName, Client.BotLoginParams.LastName, Client.BotLoginParams.Password, "OnRez", "UNR");
             WriteLine("$bot beginning login");
             Client.Login();
             WriteLine("$bot started login");
         }
         else
             return Success("$bot is already logged in.");
     }
     return Success("loging in...");
 }
예제 #2
0
        public RadegastInstance(GridClient client0)
        {
            // incase something else calls GlobalInstance while we are loading
            globalInstance = this;

            if (!System.Diagnostics.Debugger.IsAttached)
            {
                Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
                Application.ThreadException += HandleThreadException;
            }

            client = client0;

            // Initialize current time zone, and mark when we started
            GetWorldTimeZone();
            StartupTimeUTC = DateTime.UtcNow;

            // Are we running mono?
            monoRuntime = Type.GetType("Mono.Runtime") != null;

            Keyboard = new Keyboard();
            Application.AddMessageFilter(Keyboard);

            netcom               = new RadegastNetcom(this);
            state                = new StateManager(this);
            mediaManager         = new MediaManager(this);
            commandsManager      = new CommandsManager(this);
            ContextActionManager = new ContextActionsManager(this);
            RegisterContextActions();
            movement = new RadegastMovement(this);

            InitializeLoggingAndConfig();
            InitializeClient(client);

            rlv         = new RLVManager(this);
            gridManager = new GridManager();
            gridManager.LoadGrids();

            names = new NameManager(this);
            COF   = new CurrentOutfitFolder(this);

            mainForm = new frmMain(this);
            mainForm.InitializeControls();

            mainForm.Load += new EventHandler(mainForm_Load);
            pluginManager  = new PluginManager(this);
            pluginManager.ScanAndLoadPlugins();
        }
예제 #3
0
        public RadegastInstance(GridClient client0)
        {
            // incase something else calls GlobalInstance while we are loading
            globalInstance = this;

            if (!System.Diagnostics.Debugger.IsAttached)
            {
                Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
                Application.ThreadException += HandleThreadException;
            }

            client = client0;

            // Initialize current time zone, and mark when we started
            GetWorldTimeZone();
            StartupTimeUTC = DateTime.UtcNow;

            // Are we running mono?
            monoRuntime = Type.GetType("Mono.Runtime") != null;

            netcom = new RadegastNetcom(this);
            state = new StateManager(this);
            mediaManager = new MediaManager(this);
            commandsManager = new CommandsManager(this);
            ContextActionManager = new ContextActionsManager(this);
            movement = new RadegastMovement(this);

            InitializeLoggingAndConfig();
            InitializeClient(client);

            rlv = new RLVManager(this);
            gridManager = new GridManager(this);
            gridManager.LoadGrids();

            names = new NameManager(this);

            mainForm = new frmMain(this);
            mainForm.InitializeControls();

            mainForm.Load += new EventHandler(mainForm_Load);
            pluginManager = new PluginManager(this);
            pluginManager.ScanAndLoadPlugins();
        }
예제 #4
0
        public void BeginLogin()
        {
            Console.WriteLine("Beginning Login...");
            //string username = cbxUsername.Text;
            string username = MainProgram.s_CommandLineOpts.Username;

            //if (cbxUsername.SelectedIndex > 0 && cbxUsername.SelectedItem is SavedLogin login)
            //{
            //username = login.Username;
            //}

            string[] parts = System.Text.RegularExpressions.Regex.Split(username.Trim(), @"[. ]+");

            if (parts.Length == 2)
            {
                netcom.LoginOptions.FirstName = parts[0];
                netcom.LoginOptions.LastName  = parts[1];
            }
            else
            {
                netcom.LoginOptions.FirstName = username.Trim();
                netcom.LoginOptions.LastName  = "Resident";
            }

            //netcom.LoginOptions.Password = txtPassword.Text;
            netcom.LoginOptions.Password = MainProgram.s_CommandLineOpts.Password;
            netcom.LoginOptions.Channel  = Properties.Resources.ProgramName;   // Channel
            netcom.LoginOptions.Version  = Properties.Resources.RadegastTitle; // Version
            netcom.AgreeToTos            = true;

            //netcom.LoginOptions.StartLocation = StartLocationType.Last;

            /*
             * switch (cbxLocation.SelectedIndex)
             * {
             *  case -1: //Custom
             *      netcom.LoginOptions.StartLocation = StartLocationType.Custom;
             *      netcom.LoginOptions.StartLocationCustom = cbxLocation.Text;
             *      break;
             *
             *  case 0: //Home
             *      netcom.LoginOptions.StartLocation = StartLocationType.Home;
             *      break;
             *
             *  case 1: //Last
             *      netcom.LoginOptions.StartLocation = StartLocationType.Last;
             *      break;
             * }
             */
            // Setup login location either from the last used or
            // override from the command line
            if (string.IsNullOrEmpty(MainProgram.s_CommandLineOpts.Location))
            {
                // Use last location as default
                netcom.LoginOptions.StartLocation = StartLocationType.Last;
            }
            else
            {
                netcom.LoginOptions.StartLocation       = StartLocationType.Custom;
                netcom.LoginOptions.StartLocationCustom = MainProgram.s_CommandLineOpts.Location;
            }

            GridManager gm = new GridManager();

            gm.LoadGrids();
            netcom.LoginOptions.Grid = gm.Grids[0];

            /*
             * if (cbxGrid.SelectedIndex == cbxGrid.Items.Count - 1) // custom login uri
             * {
             *  if (txtCustomLoginUri.TextLength == 0 || txtCustomLoginUri.Text.Trim().Length == 0)
             *  {
             *      MessageBox.Show("You must specify the Login Uri to connect to a custom grid.", Properties.Resources.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error);
             *      return;
             *  }
             *
             *  netcom.LoginOptions.Grid = new Grid("custom", "Custom", txtCustomLoginUri.Text);
             *  netcom.LoginOptions.GridCustomLoginUri = txtCustomLoginUri.Text;
             * }
             * else
             * {
             *  netcom.LoginOptions.Grid = cbxGrid.SelectedItem as Grid;
             * }
             */

            Console.WriteLine("Will Login with Name: " + netcom.loginOptions.FullName);
            Console.WriteLine("Will Login To URI: " + netcom.LoginOptions.Grid.LoginURI);
            string startLocation = "Unknown";

            if (netcom.LoginOptions.StartLocation == StartLocationType.Custom)
            {
                startLocation = netcom.LoginOptions.StartLocationCustom;
            }
            if (netcom.LoginOptions.StartLocation == StartLocationType.Last)
            {
                startLocation = "Last";
            }
            if (netcom.LoginOptions.StartLocation == StartLocationType.Home)
            {
                startLocation = "Home";
            }
            Console.WriteLine("Will Login To Region: " + startLocation);

            if (netcom.LoginOptions.Grid.Platform != "SecondLife")
            {
                instance.Client.Settings.MULTIPLE_SIMS  = true;
                instance.Client.Settings.HTTP_INVENTORY = !instance.GlobalSettings["disable_http_inventory"];
            }
            else
            {
                // UDP inventory is deprecated as of 2015-03-30 and no longer supported.
                // https://community.secondlife.com/t5/Second-Life-Server/Deploy-for-the-week-of-2015-03-30/td-p/2919194
                instance.Client.Settings.HTTP_INVENTORY = true;
            }

            Console.WriteLine("Calling netcom.Login()...");
            netcom.Login();
            //SaveConfig();
        }