From 3c261876a15621fd3b38d150f763044602a6892d Mon Sep 17 00:00:00 2001 From: mingchen Date: Tue, 5 Jun 2007 00:26:37 +0000 Subject: *Cleaned up Configuration Setup questions *Added Configuration option for Master User Avatar name and (in sandbox mode) password *Added support for Master User in sandbox mode. Support lacks for grid mode still. **Grid support is possible when remotely fetching avatar data by name and UUID is available *Currently lacks parcel buying support. For now, in sandbox mode, log into master user information to own the parcel --- Common/OpenSim.Servers/LoginServer.cs | 7 ++ OpenSim/OpenSim.RegionServer/RegionInfo.cs | 77 +++++++++++++++------- .../OpenSim.RegionServer/world/ParcelManager.cs | 8 +-- OpenSim/OpenSim/OpenSimMain.cs | 36 ++++++++-- 4 files changed, 95 insertions(+), 33 deletions(-) diff --git a/Common/OpenSim.Servers/LoginServer.cs b/Common/OpenSim.Servers/LoginServer.cs index 6fd174b..7ee8ae2 100644 --- a/Common/OpenSim.Servers/LoginServer.cs +++ b/Common/OpenSim.Servers/LoginServer.cs @@ -254,9 +254,16 @@ namespace OpenSim.UserServer string mdPassword = EncodePassword(password); Console.WriteLine("with password: " + mdPassword); this.userManager.CreateNewProfile(firstName, lastName, mdPassword); + return true; } + public UserProfile GetProfileByName(string firstName, string lastName) + { + return this.userManager.GetProfileByName(firstName, lastName); + } + + //IUserServer implementation public AgentInventory RequestAgentsInventory(LLUUID agentID) { diff --git a/OpenSim/OpenSim.RegionServer/RegionInfo.cs b/OpenSim/OpenSim.RegionServer/RegionInfo.cs index d0ce1ce..6bd8f08 100644 --- a/OpenSim/OpenSim.RegionServer/RegionInfo.cs +++ b/OpenSim/OpenSim.RegionServer/RegionInfo.cs @@ -26,7 +26,10 @@ namespace OpenSim public string UserRecvKey = ""; private bool isSandbox; - public string RegionOwnerName = ""; + public string MasterAvatarFirstName = ""; + public string MasterAvatarLastName = ""; + public string MasterAvatarSandboxPassword = ""; + public LLUUID MasterAvatarAssignedUUID = LLUUID.Zero; public string DataStore; @@ -105,7 +108,7 @@ namespace OpenSim attri = configData.GetAttribute("SimName"); if (attri == "") { - this.RegionName = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Name", "OpenSim test"); + this.RegionName = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GENERAL SETTING: Simulator Name", "OpenSim Island"); configData.SetAttribute("SimName", this.RegionName); } else @@ -117,7 +120,7 @@ namespace OpenSim attri = configData.GetAttribute("SimLocationX"); if (attri == "") { - string location = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid Location X", "997"); + string location = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GENERAL SETTING: Grid Location X", "997"); configData.SetAttribute("SimLocationX", location); this.RegionLocX = (uint)Convert.ToUInt32(location); } @@ -130,7 +133,7 @@ namespace OpenSim attri = configData.GetAttribute("SimLocationY"); if (attri == "") { - string location = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid Location Y", "996"); + string location = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GENERAL SETTING: Grid Location Y", "996"); configData.SetAttribute("SimLocationY", location); this.RegionLocY = (uint)Convert.ToUInt32(location); } @@ -144,7 +147,7 @@ namespace OpenSim attri = configData.GetAttribute("Datastore"); if (attri == "") { - string datastore = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Filename for local storage", "localworld.yap"); + string datastore = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GENERAL SETTING: Filename for local world storage", "localworld.yap"); configData.SetAttribute("Datastore", datastore); this.DataStore = datastore; } @@ -158,7 +161,7 @@ namespace OpenSim attri = configData.GetAttribute("SimListenPort"); if (attri == "") { - string port = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("UDP port for client connections", "9000"); + string port = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GENERAL SETTING: UDP port for client connections", "9000"); configData.SetAttribute("SimListenPort", port); this.IPListenPort = Convert.ToInt32(port); } @@ -171,7 +174,7 @@ namespace OpenSim attri = configData.GetAttribute("SimListenAddress"); if (attri == "") { - this.IPListenAddr = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("IP Address to listen on for client connections", "127.0.0.1"); + this.IPListenAddr = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GENERAL SETTING: IP Address to listen on for client connections", "127.0.0.1"); configData.SetAttribute("SimListenAddress", this.IPListenAddr); } else @@ -202,7 +205,7 @@ namespace OpenSim attri = configData.GetAttribute("TerrainFile"); if (attri == "") { - this.TerrainFile = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Terrain file default", "default.r32"); + this.TerrainFile = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GENERAL SETTING: Default Terrain File", "default.r32"); configData.SetAttribute("TerrainFile", this.TerrainFile); } else @@ -214,7 +217,7 @@ namespace OpenSim attri = configData.GetAttribute("TerrainMultiplier"); if (attri == "") { - string re = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Terrain multiplier", "60.0"); + string re = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GENERAL SETTING: Terrain Height Multiplier", "60.0"); this.TerrainMultiplier = Convert.ToDouble(re, CultureInfo.InvariantCulture); configData.SetAttribute("TerrainMultiplier", this.TerrainMultiplier.ToString()); } @@ -223,21 +226,48 @@ namespace OpenSim this.TerrainMultiplier = Convert.ToDouble(attri); } + attri = ""; + attri = configData.GetAttribute("MasterAvatarFirstName"); + if (attri == "") + { + this.MasterAvatarFirstName = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GENERAL SETTING: First name of Master Avatar", "Test"); + + configData.SetAttribute("MasterAvatarFirstName", this.MasterAvatarFirstName); + } + else + { + this.MasterAvatarFirstName = attri; + } attri = ""; - attri = configData.GetAttribute("RegionOwnerName"); + attri = configData.GetAttribute("MasterAvatarLastName"); if (attri == "") { - string name = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Region Owner Avatar Name", "Test User"); - this.RegionOwnerName = name; - configData.SetAttribute("RegionOwnerName", this.RegionOwnerName); + this.MasterAvatarLastName = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GENERAL SETTING: Last name of Master Avatar", "User"); + + configData.SetAttribute("MasterAvatarLastName", this.MasterAvatarLastName); } else { - this.RegionOwnerName = attri; + this.MasterAvatarLastName = attri; } - if (!isSandbox) + if (isSandbox) //Sandbox Mode Settings + { + attri = ""; + attri = configData.GetAttribute("MasterAvatarSandboxPassword"); + if (attri == "") + { + this.MasterAvatarSandboxPassword = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("SANDBOX MODE SETTING: Password of Master Avatar", "test"); + + configData.SetAttribute("MasterAvatarSandboxPassword", this.MasterAvatarSandboxPassword); + } + else + { + this.MasterAvatarSandboxPassword = attri; + } + } + else //Grid Mode Settings { //shouldn't be reading this data in here, it should be up to the classes implementing the server interfaces to read what they need from the config object @@ -246,7 +276,7 @@ namespace OpenSim attri = configData.GetAttribute("GridServerURL"); if (attri == "") { - this.GridURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid server URL","http://127.0.0.1:8001/"); + this.GridURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GRID MODE SETTING: Grid server URL", "http://127.0.0.1:8001/"); configData.SetAttribute("GridServerURL", this.GridURL); } else @@ -259,7 +289,7 @@ namespace OpenSim attri = configData.GetAttribute("GridSendKey"); if (attri == "") { - this.GridSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to grid server","null"); + this.GridSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GRID MODE SETTING: Key to send to grid server", "null"); configData.SetAttribute("GridSendKey", this.GridSendKey); } else @@ -272,7 +302,7 @@ namespace OpenSim attri = configData.GetAttribute("GridRecvKey"); if (attri == "") { - this.GridRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from grid server","null"); + this.GridRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GRID MODE SETTING: Key to expect from grid server", "null"); configData.SetAttribute("GridRecvKey", this.GridRecvKey); } else @@ -284,8 +314,8 @@ namespace OpenSim attri = configData.GetAttribute("AssetServerURL"); if (attri == "") { - this.AssetURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Asset server URL", "http://127.0.0.1:8003/"); - configData.SetAttribute("AssetServerURL", this.GridURL); + this.AssetURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GRID MODE SETTING: Asset server URL", "http://127.0.0.1:8003/"); + configData.SetAttribute("AssetServerURL", this.AssetURL); } else { @@ -293,6 +323,7 @@ namespace OpenSim } } + this.RegionHandle = Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256)); if (!this.isSandbox) { @@ -306,8 +337,8 @@ namespace OpenSim OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,e.ToString()); } - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Sim settings loaded:"); - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "UUID: " + this.SimUUID.ToStringHyphenated()); + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Simulator Settings Loaded"); + /* OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "UUID: " + this.SimUUID.ToStringHyphenated()); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Name: " + this.RegionName); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]"); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Region Handle: " + this.RegionHandle.ToString()); @@ -316,7 +347,7 @@ namespace OpenSim OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Asset URL: " + this.AssetURL); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Asset key: " + this.AssetSendKey); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Grid URL: " + this.GridURL); - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Grid key: " + this.GridSendKey); + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Grid key: " + this.GridSendKey); */ } } } diff --git a/OpenSim/OpenSim.RegionServer/world/ParcelManager.cs b/OpenSim/OpenSim.RegionServer/world/ParcelManager.cs index 53b14f3..213af46 100644 --- a/OpenSim/OpenSim.RegionServer/world/ParcelManager.cs +++ b/OpenSim/OpenSim.RegionServer/world/ParcelManager.cs @@ -351,10 +351,10 @@ namespace OpenSim.RegionServer.world fullSimParcel.parcelData.parcelName = "Your Sim Parcel"; fullSimParcel.parcelData.parcelDesc = ""; - fullSimParcel.parcelData.ownerID = LLUUID.Zero; - fullSimParcel.parcelData.salePrice = -1; - fullSimParcel.parcelData.parcelFlags = libsecondlife.Parcel.ParcelFlags.None; - fullSimParcel.parcelData.parcelStatus = libsecondlife.Parcel.ParcelStatus.Abandoned; + fullSimParcel.parcelData.ownerID = m_world.m_regInfo.MasterAvatarAssignedUUID; + fullSimParcel.parcelData.salePrice = 1; + fullSimParcel.parcelData.parcelFlags = libsecondlife.Parcel.ParcelFlags.ForSale; + fullSimParcel.parcelData.parcelStatus = libsecondlife.Parcel.ParcelStatus.Leased; addParcel(fullSimParcel); diff --git a/OpenSim/OpenSim/OpenSimMain.cs b/OpenSim/OpenSim/OpenSimMain.cs index 39ba55e..7624d88 100644 --- a/OpenSim/OpenSim/OpenSimMain.cs +++ b/OpenSim/OpenSim/OpenSimMain.cs @@ -184,6 +184,36 @@ namespace OpenSim // Start UDP server this.m_udpServer.ServerListener(); + //Setup Master Avatar + m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Setting up Master Avatar"); + if (this.m_sandbox) + { + OpenSim.Framework.User.UserProfile masterUser = adminLoginServer.LocalUserManager.GetProfileByName(this.regionData.MasterAvatarFirstName, this.regionData.MasterAvatarLastName); + if(masterUser == null) + { + m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Sandbox Mode; Master Avatar is a new user; creating account."); + adminLoginServer.CreateUserAccount(this.regionData.MasterAvatarFirstName, this.regionData.MasterAvatarLastName, this.regionData.MasterAvatarSandboxPassword); + masterUser = adminLoginServer.LocalUserManager.GetProfileByName(this.regionData.MasterAvatarFirstName, this.regionData.MasterAvatarLastName); + if(masterUser == null) //Still NULL?!!?! OMG FAIL! + { + throw new Exception("Failure to create master user account"); + } + } + m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Master User UUID: " + masterUser.UUID.ToStringHyphenated()); + regionData.MasterAvatarAssignedUUID = masterUser.UUID; + + } + else + { + m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Grid Mode; Do not know how to get the user's master key yet!"); + } + + Console.WriteLine("Creating ParcelManager"); + LocalWorld.parcelManager = new OpenSim.RegionServer.world.ParcelManager(this.LocalWorld); + + Console.WriteLine("Loading Parcels from DB..."); + LocalWorld.localStorage.LoadParcels((ILocalStorageParcelReceiver)LocalWorld.parcelManager); + m_heartbeatTimer.Enabled = true; m_heartbeatTimer.Interval = 100; m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat); @@ -254,12 +284,6 @@ namespace OpenSim LocalWorld.LoadStorageDLL("OpenSim.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded. LocalWorld.LoadWorldMap(); - Console.WriteLine("Creating ParcelManager"); - LocalWorld.parcelManager = new OpenSim.RegionServer.world.ParcelManager(this.LocalWorld); - - Console.WriteLine("Loading Parcels from DB..."); - LocalWorld.localStorage.LoadParcels((ILocalStorageParcelReceiver)LocalWorld.parcelManager); - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Starting up messaging system"); LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); LocalWorld.PhysScene.SetTerrain(LocalWorld.Terrain.getHeights1D()); -- cgit v1.1