/// <summary> /// The god has requested that we update something in the region configs /// </summary> /// <param name="client"></param> /// <param name="BillableFactor"></param> /// <param name="PricePerMeter"></param> /// <param name="EstateID"></param> /// <param name="RegionFlags"></param> /// <param name="SimName"></param> /// <param name="RedirectX"></param> /// <param name="RedirectY"></param> public void GodUpdateRegionInfoUpdate(IClientAPI client, float BillableFactor, int PricePerMeter, ulong EstateID, ulong RegionFlags, byte[] SimName, int RedirectX, int RedirectY) { //Check god perms if (!((Scene)client.Scene).Permissions.IsGod(client.AgentId)) { return; } //Update their current region with new information string oldRegionName = client.Scene.RegionInfo.RegionName; client.Scene.RegionInfo.RegionName = Utils.BytesToString(SimName); //Set the region loc X and Y if (RedirectX != 0) { client.Scene.RegionInfo.RegionLocX = RedirectX * (int)Constants.RegionSize; } if (RedirectY != 0) { client.Scene.RegionInfo.RegionLocY = RedirectY * (int)Constants.RegionSize; } //Update the estate ID if (client.Scene.RegionInfo.EstateSettings.EstateID != EstateID) { //If they are changing estates, we have to ask them for the password to the estate, so send them an llTextBox string Password = ""; IWorldComm comm = client.Scene.RequestModuleInterface <IWorldComm>(); IDialogModule dialog = client.Scene.RequestModuleInterface <IDialogModule>(); //If the comms module is not null, we send the user a text box on a random channel so that they cannot be tapped into if (comm != null && dialog != null) { int Channel = new Random().Next(1000, 100000); //Block the channel so NOONE can access it until the question is answered comm.AddBlockedChannel(Channel); ChannelDirectory.Add(client.AgentId, new EstateChange() { Channel = Channel, EstateID = (uint)EstateID, OldEstateID = ((Scene)client.Scene).RegionInfo.EstateSettings.EstateID }); //Set the ID temperarily, if it doesn't work, we will revert it later ((Scene)client.Scene).RegionInfo.EstateSettings.EstateID = (uint)EstateID; client.OnChatFromClient += OnChatFromClient; dialog.SendTextBoxToUser(client.AgentId, "Please type the password for the estate you wish to join. (Note: this channel is secured and will not be able to be listened in on)", Channel, "Server", UUID.Zero, UUID.Zero); } else { bool changed = DataManager.DataManager.RequestPlugin <IEstateConnector>().LinkRegion(((Scene)client.Scene).RegionInfo.RegionID, (int)EstateID, Util.Md5Hash(Password)); if (!changed) { client.SendAgentAlertMessage("Unable to connect to the given estate.", false); } else { client.Scene.RegionInfo.EstateSettings.EstateID = (uint)EstateID; client.Scene.RegionInfo.EstateSettings.Save(); } } } //Set the other settings client.Scene.RegionInfo.EstateSettings.BillableFactor = BillableFactor; client.Scene.RegionInfo.EstateSettings.PricePerMeter = PricePerMeter; client.Scene.RegionInfo.EstateSettings.SetFromFlags(RegionFlags); client.Scene.RegionInfo.RegionSettings.AllowDamage = ((RegionFlags & (ulong)OpenMetaverse.RegionFlags.AllowDamage) == (ulong)OpenMetaverse.RegionFlags.AllowDamage); client.Scene.RegionInfo.RegionSettings.FixedSun = ((RegionFlags & (ulong)OpenMetaverse.RegionFlags.SunFixed) == (ulong)OpenMetaverse.RegionFlags.SunFixed); client.Scene.RegionInfo.RegionSettings.BlockTerraform = ((RegionFlags & (ulong)OpenMetaverse.RegionFlags.BlockTerraform) == (ulong)OpenMetaverse.RegionFlags.BlockTerraform); client.Scene.RegionInfo.RegionSettings.Sandbox = ((RegionFlags & (ulong)OpenMetaverse.RegionFlags.Sandbox) == (ulong)OpenMetaverse.RegionFlags.Sandbox); //Update skipping scripts/physics/collisions IEstateModule mod = client.Scene.RequestModuleInterface <IEstateModule>(); if (mod != null) { mod.SetSceneCoreDebug(((RegionFlags & (ulong)OpenMetaverse.RegionFlags.SkipScripts) == (ulong)OpenMetaverse.RegionFlags.SkipScripts), ((RegionFlags & (ulong)OpenMetaverse.RegionFlags.SkipCollisions) == (ulong)OpenMetaverse.RegionFlags.SkipCollisions), ((RegionFlags & (ulong)OpenMetaverse.RegionFlags.SkipPhysics) == (ulong)OpenMetaverse.RegionFlags.SkipPhysics)); } //Save the changes client.Scene.RegionInfo.EstateSettings.Save(); client.Scene.RegionInfo.RegionSettings.Save(); //Save the changes IConfig config = m_config.Configs["RegionStartup"]; if (config != null) { //TERRIBLE! Needs to be modular, but we can't access the module from a scene module! if (config.GetString("Default") == "RegionLoaderDataBaseSystem") { SaveChangesDatabase(client.Scene.RegionInfo); } else { SaveChangesFile(oldRegionName, client.Scene.RegionInfo); } } else { SaveChangesFile(oldRegionName, client.Scene.RegionInfo); } //Tell the clients to update all references to the new settings foreach (IScenePresence sp in client.Scene.GetScenePresences()) { HandleRegionInfoRequest(sp.ControllingClient, ((Scene)client.Scene)); } //Update the grid server as well IGridRegisterModule gridRegisterModule = client.Scene.RequestModuleInterface <IGridRegisterModule>(); if (gridRegisterModule != null) { gridRegisterModule.UpdateGridRegion(client.Scene); } }