コード例 #1
0
        public void ChangeEstate(string ownerName, string estateToJoin, UUID regionID)
        {
            InternalDoRemote(ownerName, estateToJoin, regionID);
            if (m_doRemoteOnly)
            {
                return;
            }

            IEstateConnector conn = Aurora.DataManager.DataManager.RequestPlugin <IEstateConnector>();

            if (conn != null)
            {
                conn.DelinkRegion(regionID);
                UserAccount account = m_registry.RequestModuleInterface <IUserAccountService>().GetUserAccount(null, ownerName);
                conn.LinkRegion(regionID, conn.GetEstate(account.PrincipalID, estateToJoin));
            }
        }
コード例 #2
0
        /// <summary>
        /// Creates the estate info for a region.
        /// </summary>
        /// <returns>The estate info.</returns>
        /// <param name="scene">Scene.</param>
        private EstateSettings CreateEstateInfo(IScene scene)
        {
            // check for regionType to determine if this is 'Mainland' or an 'Estate'
            string regType = scene.RegionInfo.RegionType.ToLower();

            if (regType.StartsWith("m"))
            {
                return(LinkMainlandEstate(scene.RegionInfo.RegionID));
            }

            // we are linking to a user estate
            IEstateConnector     estateConnector = Framework.Utilities.DataManager.RequestPlugin <IEstateConnector>();
            ISystemEstateService sysEstateInfo   = m_registry.RequestModuleInterface <ISystemEstateService>();

            string sysEstateOwnerName;
            var    sysAccount = scene.UserAccountService.GetUserAccount(scene.RegionInfo.AllScopeIDs, (UUID)Constants.RealEstateOwnerUUID);

            if (sysAccount == null)
            {
                sysEstateOwnerName = sysEstateInfo.SystemEstateOwnerName;
            }
            else
            {
                sysEstateOwnerName = sysAccount.Name;
            }


            // This is an 'Estate' so get some details....
            LastEstateOwner = sysEstateOwnerName;
            while (true)
            {
                UserAccount account;
                string      estateOwner;

                estateOwner = MainConsole.Instance.Prompt("Estate owner name (" + sysEstateOwnerName + "/User Name)", LastEstateOwner);

                // we have a prospective estate owner...
                List <EstateSettings> ownerEstates = null;
                account = scene.UserAccountService.GetUserAccount(scene.RegionInfo.AllScopeIDs, estateOwner);
                if (account != null)
                {
                    // we have a user account...
                    LastEstateOwner = account.Name;

                    ownerEstates = estateConnector.GetEstates(account.PrincipalID);
                }

                if (account == null || ownerEstates == null || ownerEstates.Count == 0)
                {
                    if (account == null)
                    {
                        MainConsole.Instance.Warn("[Estate]: Unable to locate the user " + estateOwner);
                    }
                    else
                    {
                        MainConsole.Instance.WarnFormat("[Estate]: The user, {0}, has no estates currently.", account.Name);
                    }

                    string joinMainland = MainConsole.Instance.Prompt(
                        "Do you want to 'park' the region with the system owner/estate? (yes/no)", "yes");
                    if (joinMainland.ToLower().StartsWith("y"))                      // joining 'mainland'
                    {
                        return(LinkMainlandEstate(scene.RegionInfo.RegionID));
                    }

                    continue;
                }

                if (ownerEstates.Count > 1)
                {
                    MainConsole.Instance.InfoFormat("[Estate]: User {0} has {1} estates currently. {2}",
                                                    account.Name, ownerEstates.Count, "These estates are the following:");
                    foreach (EstateSettings t in ownerEstates)
                    {
                        MainConsole.Instance.CleanInfo("         " + t.EstateName);
                    }

                    LastEstateName = ownerEstates[0].EstateName;

                    List <string> responses = ownerEstates.Select(settings => settings.EstateName).ToList();
                    responses.Add("Cancel");

                    do
                    {
                        //TODO: This could be a problem if we have a lot of estates
                        string response = MainConsole.Instance.Prompt("Estate name to join", LastEstateName, responses);
                        if (response == "None" || response == "Cancel")
                        {
                            LastEstateName = "";
                            break;
                        }
                        LastEstateName = response;
                    } while (LastEstateName == "");
                    if (LastEstateName == "")
                    {
                        continue;
                    }
                }
                else
                {
                    LastEstateName = ownerEstates[0].EstateName;
                }


                // we should have a user account and estate name by now
                int estateID = estateConnector.GetEstate(account.PrincipalID, LastEstateName);
                if (estateID == 0)
                {
                    MainConsole.Instance.Warn("[Estate]: The name you have entered matches no known estate. Please try again");
                    continue;
                }

                // link up the region
                EstateSettings ES;
                if (estateConnector.LinkRegion(scene.RegionInfo.RegionID, estateID))
                {
                    if ((ES = estateConnector.GetEstateSettings(scene.RegionInfo.RegionID)) == null ||
                        ES.EstateID == 0)
                    //We could do by EstateID now, but we need to completely make sure that it fully is set up
                    {
                        MainConsole.Instance.Warn("[Estate]: The connection to the server was broken, please try again.");
                        continue;
                    }
                }
                else
                {
                    MainConsole.Instance.WarnFormat("[Estate]: Joining the {0} estate failed. Please try again.", LastEstateName);
                    continue;
                }

                MainConsole.Instance.InfoFormat("[Estate]: Successfully joined the {0} estate!", LastEstateName);
                return(ES);
            }
        }
コード例 #3
0
        /// <summary>
        /// Creates the estate info for a region.
        /// </summary>
        /// <returns>The estate info.</returns>
        /// <param name="scene">Scene.</param>
        EstateSettings CreateEstateInfo(IScene scene)
        {
            // check for regionType to determine if this is 'Mainland' or an 'Estate'
            string regType = scene.RegionInfo.RegionType.ToLower();

            if (regType.StartsWith("m", System.StringComparison.Ordinal))
            {
                return(LinkSystemEstate(scene.RegionInfo.RegionID, Constants.MainlandEstateID));
            }

            // we are linking to a user estate
            IEstateConnector      estateConnector = Framework.Utilities.DataManager.RequestPlugin <IEstateConnector> ();
            ISystemAccountService sysAccounts     = m_registry.RequestModuleInterface <ISystemAccountService> ();

            string sysEstateOwnerName;
            var    sysAccount = scene.UserAccountService.GetUserAccount(scene.RegionInfo.AllScopeIDs, sysAccounts.SystemEstateOwnerUUID);

            if (!sysAccount.Valid)
            {
                sysEstateOwnerName = sysAccounts.SystemEstateOwnerName;
            }
            else
            {
                sysEstateOwnerName = sysAccount.Name;
            }


            // This is an 'Estate' so get some details....
            var    LastEstateOwner = sysEstateOwnerName;
            string LastEstateName;

            while (true)
            {
                UserAccount ownerAcct;
                string      estateOwner;

                estateOwner = MainConsole.Instance.Prompt("Estate owner name (" + sysEstateOwnerName + "/User Name)", LastEstateOwner);

                // we have a prospective estate owner...
                List <EstateSettings> ownerEstates = null;
                ownerAcct = scene.UserAccountService.GetUserAccount(scene.RegionInfo.AllScopeIDs, estateOwner);
                if (ownerAcct.Valid)
                {
                    // we have a user account...
                    LastEstateOwner = ownerAcct.Name;
                    ownerEstates    = estateConnector.GetEstates(ownerAcct.PrincipalID);
                }

                if (!ownerAcct.Valid || ownerEstates == null || ownerEstates.Count == 0)
                {
                    if (!ownerAcct.Valid)
                    {
                        MainConsole.Instance.Warn("[Estate]: Unable to locate the user " + estateOwner);
                    }
                    else
                    {
                        MainConsole.Instance.WarnFormat("[Estate]: The user, {0}, has no estates currently.", ownerAcct.Name);
                    }

                    string joinSystemland = MainConsole.Instance.Prompt(
                        "Do you want to 'park' the region with the system owner/estate? (yes/no)", "yes");
                    if (joinSystemland.ToLower().StartsWith("y", System.StringComparison.Ordinal))                        // joining 'Systemland'
                    {
                        return(LinkSystemEstate(scene.RegionInfo.RegionID, Constants.SystemEstateID));
                    }

                    continue;
                }

                if (ownerEstates.Count > 1)
                {
                    MainConsole.Instance.InfoFormat("[Estate]: User {0} has {1} estates currently. {2}",
                                                    ownerAcct.Name, ownerEstates.Count, "These estates are the following:");
                    foreach (EstateSettings t in ownerEstates)
                    {
                        MainConsole.Instance.CleanInfo("         " + t.EstateName);
                    }

                    LastEstateName = ownerEstates [0].EstateName;

                    List <string> responses = ownerEstates.Select(settings => settings.EstateName).ToList();
                    responses.Add("Cancel");

                    do
                    {
                        //TODO: This could be a problem if we have a lot of estates
                        string response = MainConsole.Instance.Prompt("Estate name to join", LastEstateName, responses);
                        if (response == "None" || response == "Cancel")
                        {
                            LastEstateName = "";
                            break;
                        }
                        LastEstateName = response;
                    } while (LastEstateName == "");
                    if (LastEstateName == "")
                    {
                        continue;
                    }
                }
                else
                {
                    LastEstateName = ownerEstates [0].EstateName;
                }


                // we should have a user account and estate name by now
                int estateID = estateConnector.GetEstate(ownerAcct.PrincipalID, LastEstateName);
                if (estateID == 0)
                {
                    MainConsole.Instance.Warn("[Estate]: The name you have entered matches no known estate. Please try again");
                    continue;
                }

                // link up the region
                EstateSettings ES;
                UUID           oldOwnerID = UUID.Zero;
                if (scene.RegionInfo.EstateSettings != null)
                {
                    oldOwnerID = scene.RegionInfo.EstateSettings.EstateOwner;
                }

                if (!estateConnector.LinkRegion(scene.RegionInfo.RegionID, estateID))
                {
                    MainConsole.Instance.WarnFormat("[Estate]: Joining the {0} estate failed. Please try again.", LastEstateName);
                    continue;
                }

                // make sure that the region is fully set up
                if ((ES = estateConnector.GetRegionEstateSettings(scene.RegionInfo.RegionID)) == null || ES.EstateID == 0)
                {
                    MainConsole.Instance.Warn("[Estate]: Unable to verify region update (possible server connection error), please try again.");
                    continue;
                }

                // Linking was successful, change any previously owned parcels to the new owner
                if (oldOwnerID != UUID.Zero)
                {
                    IParcelManagementModule parcelManagement = scene.RequestModuleInterface <IParcelManagementModule> ();
                    if (parcelManagement != null)
                    {
                        parcelManagement.ReclaimParcels(oldOwnerID, ES.EstateOwner);
                    }
                }

                MainConsole.Instance.InfoFormat("[Estate]: Successfully joined the {0} estate!", LastEstateName);
                return(ES);
            }
        }
コード例 #4
0
        int GetUserEstateID(IScene scene, IEstateConnector estateConnector)
        {
            while (true)
            {
                UserAccount ownerAcct;
                string      estateOwner;

                estateOwner = MainConsole.Instance.Prompt("Estate owner name");
                if (string.IsNullOrEmpty(estateOwner))
                {
                    return(0);
                }

                // we have a prospective estate owner...
                List <EstateSettings> ownerEstates = null;
                ownerAcct = scene.UserAccountService.GetUserAccount(scene.RegionInfo.AllScopeIDs, estateOwner);
                if (ownerAcct.Valid)
                {
                    // we have a user account...
                    ownerEstates = estateConnector.GetEstates(ownerAcct.PrincipalID);
                }

                if (ownerEstates == null || ownerEstates.Count == 0)
                {
                    if (!ownerAcct.Valid)
                    {
                        MainConsole.Instance.Warn("[Estate]: Unable to locate the user " + estateOwner);
                    }
                    else
                    {
                        MainConsole.Instance.WarnFormat("[Estate]: The user, {0}, has no estates currently.", ownerAcct.Name);
                    }

                    continue;   // try again
                }

                string LastEstateName;
                if (ownerEstates.Count > 1)
                {
                    MainConsole.Instance.InfoFormat("[Estate]: User {0} has {1} estates currently. {2}",
                                                    ownerAcct.Name, ownerEstates.Count, "These estates are the following:");
                    foreach (EstateSettings t in ownerEstates)
                    {
                        MainConsole.Instance.CleanInfo("         " + t.EstateName);
                    }

                    LastEstateName = ownerEstates [0].EstateName;

                    List <string> responses = ownerEstates.Select(settings => settings.EstateName).ToList();
                    responses.Add("Cancel");

                    do
                    {
                        //TODO: This could be a problem if we have a lot of estates
                        string response = MainConsole.Instance.Prompt("Estate name to join", LastEstateName, responses);
                        if (response == "None" || response == "Cancel")
                        {
                            LastEstateName = "";
                            break;
                        }
                        LastEstateName = response;
                    } while (LastEstateName == "");
                    if (LastEstateName == "")
                    {
                        continue;
                    }
                }
                else
                {
                    LastEstateName = ownerEstates [0].EstateName;
                }


                // we should have a user account and estate name by now
                int estateID = estateConnector.GetEstate(ownerAcct.PrincipalID, LastEstateName);
                if (estateID == 0)
                {
                    MainConsole.Instance.Warn("[Estate]: The name you have entered matches no known estate. Please try again");
                    continue;
                }

                return(estateID);
            }
        }
コード例 #5
0
        int GetUserEstateID(IScene scene, IEstateConnector estateConnector)
        {
            while (true)
            {
                UserAccount account;
                string estateOwner;

                estateOwner = MainConsole.Instance.Prompt ("Estate owner name");
                if (string.IsNullOrEmpty (estateOwner))
                    return 0;

                // we have a prospective estate owner...
                List<EstateSettings> ownerEstates = null;
                account = scene.UserAccountService.GetUserAccount (scene.RegionInfo.AllScopeIDs, estateOwner);
                if (account != null)
                {
                    // we have a user account...
                    ownerEstates = estateConnector.GetEstates (account.PrincipalID);
                }

                if (ownerEstates == null || ownerEstates.Count == 0)
                {
                    if (account == null)
                        MainConsole.Instance.Warn ("[Estate]: Unable to locate the user " + estateOwner);
                    else
                        MainConsole.Instance.WarnFormat ("[Estate]: The user, {0}, has no estates currently.", account.Name);

                    continue;   // try again
                }

                string LastEstateName;
                if (ownerEstates.Count > 1)
                {
                    MainConsole.Instance.InfoFormat ("[Estate]: User {0} has {1} estates currently. {2}",
                        account.Name, ownerEstates.Count, "These estates are the following:");
                    foreach (EstateSettings t in ownerEstates)
                        MainConsole.Instance.CleanInfo ("         " + t.EstateName);

                    LastEstateName = ownerEstates [0].EstateName;

                    List<string> responses = ownerEstates.Select (settings => settings.EstateName).ToList ();
                    responses.Add ("Cancel");

                    do
                    {
                        //TODO: This could be a problem if we have a lot of estates
                        string response = MainConsole.Instance.Prompt ("Estate name to join", LastEstateName, responses);
                        if (response == "None" || response == "Cancel")
                        {
                            LastEstateName = "";
                            break;
                        }
                        LastEstateName = response;
                    } while (LastEstateName == "");
                    if (LastEstateName == "")
                        continue;

                } else
                    LastEstateName = ownerEstates [0].EstateName;

                // we should have a user account and estate name by now
                int estateID = estateConnector.GetEstate (account.PrincipalID, LastEstateName);
                if (estateID == 0)
                {
                    MainConsole.Instance.Warn ("[Estate]: The name you have entered matches no known estate. Please try again");
                    continue;
                }

                return estateID;
            }
        }
コード例 #6
0
        private EstateSettings CreateEstateInfo(IScene scene)
        {
            EstateSettings ES = new EstateSettings();

            while (true)
            {
                IEstateConnector EstateConnector = Framework.Utilities.DataManager.RequestPlugin <IEstateConnector>();

                string      name    = MainConsole.Instance.Prompt("Estate owner name", LastEstateOwner);
                UserAccount account = scene.UserAccountService.GetUserAccount(scene.RegionInfo.AllScopeIDs, name);

                if (account == null)
                {
                    string createNewUser =
                        MainConsole.Instance.Prompt(
                            "Could not find user " + name + ". Would you like to create this user?", "yes");

                    if (createNewUser == "yes")
                    {
                        // Create a new account
                        string password = MainConsole.Instance.PasswordPrompt(name + "'s password");
                        string email    = MainConsole.Instance.Prompt(name + "'s email", "");

                        scene.UserAccountService.CreateUser(name, Util.Md5Hash(password), email);
                        account = scene.UserAccountService.GetUserAccount(scene.RegionInfo.AllScopeIDs, name);

                        if (account == null)
                        {
                            MainConsole.Instance.ErrorFormat(
                                "[EstateService]: Unable to store account. If this simulator is connected to a grid, you must create the estate owner account first at the grid level.");
                            continue;
                        }
                    }
                    else
                    {
                        continue;
                    }
                }

                LastEstateOwner = account.Name;

                List <EstateSettings> ownerEstates = EstateConnector.GetEstates(account.PrincipalID);
                string response = (ownerEstates != null && ownerEstates.Count > 0) ? "yes" : "no";
                if (ownerEstates != null && ownerEstates.Count > 0)
                {
                    MainConsole.Instance.WarnFormat("Found user. {0} has {1} estates currently. {2}", account.Name,
                                                    ownerEstates.Count,
                                                    "These estates are the following:");
                    foreach (EstateSettings t in ownerEstates)
                    {
                        MainConsole.Instance.Warn(t.EstateName);
                    }
                    response =
                        MainConsole.Instance.Prompt(
                            "Do you wish to join one of these existing estates? (Options are {yes, no, cancel})",
                            response, new List <string> {
                        "yes", "no", "cancel"
                    });
                }
                else
                {
                    MainConsole.Instance.WarnFormat("Found user. {0} has no estates currently. Creating a new estate.",
                                                    account.Name);
                }
                if (response == "no")
                {
                    // Create a new estate
                    // ES could be null
                    ES.EstateName = MainConsole.Instance.Prompt("New estate name (or cancel to go back)", "My Estate");
                    if (ES.EstateName == "cancel")
                    {
                        continue;
                    }
                    //Set to auto connect to this region next
                    LastEstateName = ES.EstateName;
                    ES.EstateOwner = account.PrincipalID;

                    ES.EstateID = (uint)EstateConnector.CreateNewEstate(ES, scene.RegionInfo.RegionID);
                    if (ES.EstateID == 0)
                    {
                        MainConsole.Instance.Warn("There was an error in creating this estate: " + ES.EstateName);
                        //EstateName holds the error. See LocalEstateConnector for more info.
                        continue;
                    }
                    break;
                }
                if (response == "yes")
                {
                    if (ownerEstates != null && ownerEstates.Count != 1)
                    {
                        if (LastEstateName == "")
                        {
                            LastEstateName = ownerEstates[0].EstateName;
                        }

                        List <string> responses = ownerEstates.Select(settings => settings.EstateName).ToList();

                        responses.Add("None");
                        responses.Add("Cancel");
                        response = MainConsole.Instance.Prompt("Estate name to join", LastEstateName, responses);
                        if (response == "None" || response == "Cancel")
                        {
                            continue;
                        }
                        LastEstateName = response;
                    }
                    else if (ownerEstates != null)
                    {
                        LastEstateName = ownerEstates[0].EstateName;
                    }

                    int estateID = EstateConnector.GetEstate(account.PrincipalID, LastEstateName);
                    if (estateID == 0)
                    {
                        MainConsole.Instance.Warn("The name you have entered matches no known estate. Please try again");
                        continue;
                    }

                    //We save the Password because we have to reset it after we tell the EstateService about it, as it clears it for security reasons
                    if (EstateConnector.LinkRegion(scene.RegionInfo.RegionID, estateID))
                    {
                        if ((ES = EstateConnector.GetEstateSettings(scene.RegionInfo.RegionID)) == null ||
                            ES.EstateID == 0)
                        //We could do by EstateID now, but we need to completely make sure that it fully is set up
                        {
                            MainConsole.Instance.Warn("The connection to the server was broken, please try again soon.");
                            continue;
                        }
                        MainConsole.Instance.Warn("Successfully joined the estate!");
                        break;
                    }

                    MainConsole.Instance.Warn("Joining the estate failed. Please try again.");
                    continue;
                }
            }
            return(ES);
        }