public void CreateMapTileAsync(AssetBase Mapasset, AssetBase Terrainasset, UUID lastMapRegionUUID, UUID lastTerrainRegionUUID) { IMapImageGenerator terrain = m_scene.RequestModuleInterface <IMapImageGenerator>(); if (terrain == null) { return; } //Delete the old assets if (lastMapRegionUUID != UUID.Zero) { m_scene.AssetService.Delete(lastMapRegionUUID.ToString()); } if (lastTerrainRegionUUID != UUID.Zero) { m_scene.AssetService.Delete(lastTerrainRegionUUID.ToString()); } byte[] terraindata, mapdata; terrain.CreateMapTile(out terraindata, out mapdata); if (terraindata != null) { Terrainasset.Data = terraindata; m_scene.AssetService.Store(Terrainasset); } if (mapdata != null) { Mapasset.Data = mapdata; m_scene.AssetService.Store(Mapasset); RegenerateMaptile(Mapasset.ID, Mapasset.Data); } else if (Terrainasset != null) { RegenerateMaptile(Terrainasset.ID, Terrainasset.Data); } if (Terrainasset != null) { Terrainasset.Data = null; Terrainasset = null; } if (Mapasset != null) { Mapasset.Data = null; Mapasset = null; } //Update the grid map IGridRegisterModule gridRegModule = m_scene.RequestModuleInterface <IGridRegisterModule>(); if (gridRegModule != null) { gridRegModule.UpdateGridRegion(m_scene); } }
private void OnUpdateRegion(object source, ElapsedEventArgs e) { if (m_scene != null) { IGridRegisterModule gridRegModule = m_scene.RequestModuleInterface <IGridRegisterModule>(); if (gridRegModule != null) { gridRegModule.UpdateGridRegion(m_scene); } } }
private RegionInfo CreateRegionFromConsole(RegionInfo info) { if (info == null) { info = new RegionInfo(); info.RegionID = UUID.Random(); } info.RegionName = MainConsole.Instance.Prompt("Region Name: ", info.RegionName); info.RegionLocX = int.Parse(MainConsole.Instance.Prompt("Region Location X: ", ((info.RegionLocX == 0 ? 1000 : info.RegionLocX / Constants.RegionSize)).ToString())) * Constants.RegionSize; info.RegionLocY = int.Parse(MainConsole.Instance.Prompt("Region location Y: ", ((info.RegionLocY == 0 ? 1000 : info.RegionLocY / Constants.RegionSize)).ToString())) * Constants.RegionSize; info.RegionSizeX = int.Parse(MainConsole.Instance.Prompt("Region size X: ", info.RegionSizeX.ToString())); info.RegionSizeY = int.Parse(MainConsole.Instance.Prompt("Region size Y: ", info.RegionSizeY.ToString())); info.RegionType = MainConsole.Instance.Prompt("Region Type: ", (info.RegionType == "" ? "Mainland" : info.RegionType)); info.SeeIntoThisSimFromNeighbor = bool.Parse( MainConsole.Instance.Prompt("See into this sim from neighbors: ", info.SeeIntoThisSimFromNeighbor.ToString().ToLower(), new List <string>() { "true", "false" }).ToLower()); info.ObjectCapacity = int.Parse(MainConsole.Instance.Prompt("Object capacity: ", info.ObjectCapacity == 0 ? "50000" : info.ObjectCapacity.ToString())); if (m_scene != null) { IGridRegisterModule gridRegister = m_scene.RequestModuleInterface <IGridRegisterModule>(); gridRegister.UpdateGridRegion(m_scene); ForceBackup(); MainConsole.Instance.Info("[FileBasedSimulationData]: Save completed."); } return(info); }
/// <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); } }
protected void SetRegionInfoOption(string module, string[] cmdparams) { IScene scene = MainConsole.Instance.ConsoleScene; if (scene == null) { scene = m_scenes[0]; } #region 3 Params needed if (cmdparams.Length < 4) { m_log.Warn("Not enough parameters!"); return; } if (cmdparams[2] == "Maturity") { if (cmdparams[3] == "PG") { scene.RegionInfo.AccessLevel = Util.ConvertMaturityToAccessLevel(0); } else if (cmdparams[3] == "Mature") { scene.RegionInfo.AccessLevel = Util.ConvertMaturityToAccessLevel(1); } else if (cmdparams[3] == "Adult") { scene.RegionInfo.AccessLevel = Util.ConvertMaturityToAccessLevel(2); } else { m_log.Warn("Your parameter did not match any existing parameters. Try PG, Mature, or Adult"); return; } scene.RegionInfo.RegionSettings.Save(); //Tell the grid about the changes IGridRegisterModule gridRegModule = scene.RequestModuleInterface <IGridRegisterModule>(); if (gridRegModule != null) { gridRegModule.UpdateGridRegion(scene); } } #endregion #region 4 Params needed if (cmdparams.Length < 4) { m_log.Warn("Not enough parameters!"); return; } if (cmdparams[2] == "AddEstateBan".ToLower()) { EstateBan EB = new EstateBan(); EB.BannedUserID = m_scenes[0].UserAccountService.GetUserAccount(UUID.Zero, cmdparams[3], cmdparams[4]).PrincipalID; scene.RegionInfo.EstateSettings.AddBan(EB); } if (cmdparams[2] == "AddEstateManager".ToLower()) { scene.RegionInfo.EstateSettings.AddEstateManager(m_scenes[0].UserAccountService.GetUserAccount(UUID.Zero, cmdparams[3], cmdparams[4]).PrincipalID); } if (cmdparams[2] == "AddEstateAccess".ToLower()) { scene.RegionInfo.EstateSettings.AddEstateUser(m_scenes[0].UserAccountService.GetUserAccount(UUID.Zero, cmdparams[3], cmdparams[4]).PrincipalID); } if (cmdparams[2] == "RemoveEstateBan".ToLower()) { scene.RegionInfo.EstateSettings.RemoveBan(m_scenes[0].UserAccountService.GetUserAccount(UUID.Zero, cmdparams[3], cmdparams[4]).PrincipalID); } if (cmdparams[2] == "RemoveEstateManager".ToLower()) { scene.RegionInfo.EstateSettings.RemoveEstateManager(m_scenes[0].UserAccountService.GetUserAccount(UUID.Zero, cmdparams[3], cmdparams[4]).PrincipalID); } if (cmdparams[2] == "RemoveEstateAccess".ToLower()) { scene.RegionInfo.EstateSettings.RemoveEstateUser(m_scenes[0].UserAccountService.GetUserAccount(UUID.Zero, cmdparams[3], cmdparams[4]).PrincipalID); } #endregion scene.RegionInfo.RegionSettings.Save(); scene.RegionInfo.EstateSettings.Save(); }
/// <summary> /// The god has requested that we update something in the region configuration /// </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) { IEstateConnector estateConnector = Framework.Utilities.DataManager.RequestPlugin <IEstateConnector> (); //Check god perms if (!client.Scene.Permissions.IsGod(client.AgentId)) { return; } string oldRegionName = client.Scene.RegionInfo.RegionName; //Update their current region with new information if (Utils.BytesToString(SimName) != oldRegionName) { client.Scene.RegionInfo.RegionName = Utils.BytesToString(SimName); MainConsole.Instance.InfoFormat("[God] Region {0} has been renamed to {1}", oldRegionName, Utils.BytesToString(SimName)); client.SendAgentAlertMessage("Region has been renamed to " + Utils.BytesToString(SimName), true); } // Save the old region locations int oldRegionLocX = client.Scene.RegionInfo.RegionLocX; int oldRegionLocY = client.Scene.RegionInfo.RegionLocY; int newRegionLocX = oldRegionLocX; int newRegionLocY = oldRegionLocY; //Set the region loc X and Y if (RedirectX != 0) { client.Scene.RegionInfo.RegionLocX = RedirectX * Constants.RegionSize; newRegionLocX = RedirectX; } if (RedirectY != 0) { client.Scene.RegionInfo.RegionLocY = RedirectY * Constants.RegionSize; newRegionLocY = RedirectY; } // Check if there's changes to display the new coords on the console and inworld if (newRegionLocX != oldRegionLocX || newRegionLocY != oldRegionLocY) { var oldMapLocX = oldRegionLocX / Constants.RegionSize; var oldMapLocY = oldRegionLocY / Constants.RegionSize; var newMapLocX = newRegionLocX / Constants.RegionSize; var newMapLocY = newRegionLocY / Constants.RegionSize; MainConsole.Instance.InfoFormat("[God] Region {0} has been moved from {1},{2} to {3},{4}", client.Scene.RegionInfo.RegionName, oldMapLocX, oldMapLocY, newMapLocX, newMapLocY); client.SendAgentAlertMessage("Region has been moved from " + oldMapLocX + "," + oldMapLocY + " to " + newMapLocX + "," + newMapLocY, true); } //Update the estate ID if (client.Scene.RegionInfo.EstateSettings.EstateID != EstateID) { bool changed = estateConnector.LinkRegion(client.Scene.RegionInfo.RegionID, (int)EstateID); if (!changed) { client.SendAgentAlertMessage("Unable to connect to the given estate.", false); } else { client.Scene.RegionInfo.EstateSettings.EstateID = (uint)EstateID; estateConnector.SaveEstateSettings(client.Scene.RegionInfo.EstateSettings); } } //Set/Reset Estate settings client.Scene.RegionInfo.EstateSettings.BillableFactor = BillableFactor; client.Scene.RegionInfo.EstateSettings.PricePerMeter = PricePerMeter; client.Scene.RegionInfo.EstateSettings.SetFromFlags(RegionFlags); // Set/Reset Region flags 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 estateConnector.SaveEstateSettings(client.Scene.RegionInfo.EstateSettings); //Tell the clients to update all references to the new settings foreach (IScenePresence sp in client.Scene.GetScenePresences()) { HandleRegionInfoRequest(sp.ControllingClient, client.Scene); } //Update the grid server as well IGridRegisterModule gridRegisterModule = client.Scene.RequestModuleInterface <IGridRegisterModule> (); if (gridRegisterModule != null) { gridRegisterModule.UpdateGridRegion(client.Scene); } }
/// <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 (!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 * Constants.RegionSize; } if (RedirectY != 0) { client.Scene.RegionInfo.RegionLocY = RedirectY * Constants.RegionSize; } //Update the estate ID if (client.Scene.RegionInfo.EstateSettings.EstateID != EstateID) { bool changed = DataManager.DataManager.RequestPlugin <IEstateConnector>().LinkRegion( client.Scene.RegionInfo.RegionID, (int)EstateID); 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, client.Scene); } //Update the grid server as well IGridRegisterModule gridRegisterModule = client.Scene.RequestModuleInterface <IGridRegisterModule>(); if (gridRegisterModule != null) { gridRegisterModule.UpdateGridRegion(client.Scene); } }
public void CreateMapTileAsync(object worthless) { IMapImageGenerator terrain = m_scene.RequestModuleInterface <IMapImageGenerator>(); if (terrain == null) { return; } bool changed = false; byte[] terraindata, mapdata; terrain.CreateMapTile(out terraindata, out mapdata); if (terraindata != null) { UUID newID = UUID.Zero; if (m_scene.RegionInfo.RegionSettings.TerrainMapImageID != UUID.Zero) { m_scene.AssetService.UpdateContent(m_scene.RegionInfo.RegionSettings.TerrainMapImageID, terraindata, out newID); m_scene.RegionInfo.RegionSettings.TerrainMapImageID = newID; changed = true; } if (m_scene.RegionInfo.RegionSettings.TerrainMapImageID == UUID.Zero) { AssetBase Terrainasset = new AssetBase( UUID.Random(), "terrainMapImage_" + m_scene.RegionInfo.RegionID.ToString(), AssetType.Simstate, m_scene.RegionInfo.RegionID) { Data = terraindata, Description = m_scene.RegionInfo.RegionName, Flags = AssetFlags.Deletable | AssetFlags.Rewritable | AssetFlags.Maptile }; newID = m_scene.AssetService.Store(Terrainasset); } if (m_scene.RegionInfo.RegionSettings.TerrainMapImageID != newID) { m_scene.RegionInfo.RegionSettings.TerrainMapImageID = newID; changed = true; } } if (mapdata != null) { UUID newID = UUID.Zero; if (m_scene.RegionInfo.RegionSettings.TerrainImageID != UUID.Zero) { m_scene.AssetService.UpdateContent(m_scene.RegionInfo.RegionSettings.TerrainImageID, mapdata, out newID); m_scene.RegionInfo.RegionSettings.TerrainImageID = newID; changed = true; } if (m_scene.RegionInfo.RegionSettings.TerrainImageID == UUID.Zero) { AssetBase Mapasset = new AssetBase( UUID.Random(), "terrainImage_" + m_scene.RegionInfo.RegionID.ToString(), AssetType.Simstate, m_scene.RegionInfo.RegionID) { Data = mapdata, Description = m_scene.RegionInfo.RegionName, Flags = AssetFlags.Deletable | AssetFlags.Rewritable | AssetFlags.Maptile }; newID = m_scene.AssetService.Store(Mapasset); } if (m_scene.RegionInfo.RegionSettings.TerrainImageID != newID) { m_scene.RegionInfo.RegionSettings.TerrainImageID = newID; changed = true; } } if (changed)//Make sure to update the db with the new settings { m_scene.RegionInfo.RegionSettings.Save(); } //Update the grid map IGridRegisterModule gridRegModule = m_scene.RequestModuleInterface <IGridRegisterModule>(); if (gridRegModule != null) { gridRegModule.UpdateGridRegion(m_scene); } }
public void CreateMapTileAsync(object worthless) { IMapImageGenerator terrain = m_scene.RequestModuleInterface <IMapImageGenerator>(); if (terrain == null) { return; } byte[] terraindata, mapdata; terrain.CreateMapTile(out terraindata, out mapdata); if (terraindata != null) { if (m_scene.RegionInfo.RegionSettings.TerrainMapImageID != UUID.Zero) { m_scene.RegionInfo.RegionSettings.TerrainMapImageID = m_scene.AssetService.UpdateContent(m_scene.RegionInfo.RegionSettings.TerrainMapImageID, terraindata); } if (m_scene.RegionInfo.RegionSettings.TerrainMapImageID == UUID.Zero) //Do not optimize away! UpdateContent can fail sometimes! { AssetBase Terrainasset = new AssetBase( UUID.Random(), "terrainMapImage_" + m_scene.RegionInfo.RegionID.ToString(), AssetType.Simstate, m_scene.RegionInfo.RegionID) { Data = terraindata, Description = m_scene.RegionInfo.RegionName, Flags = AssetFlags.Deletable | AssetFlags.Rewritable | AssetFlags.Maptile }; m_scene.RegionInfo.RegionSettings.TerrainMapImageID = m_scene.AssetService.Store(Terrainasset); } } if (mapdata != null) { if (m_scene.RegionInfo.RegionSettings.TerrainImageID != UUID.Zero) { m_scene.RegionInfo.RegionSettings.TerrainImageID = m_scene.AssetService.UpdateContent(m_scene.RegionInfo.RegionSettings.TerrainImageID, mapdata); } if (m_scene.RegionInfo.RegionSettings.TerrainImageID == UUID.Zero) //Do not optimize away! UpdateContent can fail sometimes! { AssetBase Mapasset = new AssetBase( UUID.Random(), "terrainImage_" + m_scene.RegionInfo.RegionID.ToString(), AssetType.Simstate, m_scene.RegionInfo.RegionID) { Data = mapdata, Description = m_scene.RegionInfo.RegionName, Flags = AssetFlags.Deletable | AssetFlags.Rewritable | AssetFlags.Maptile }; m_scene.RegionInfo.RegionSettings.TerrainImageID = m_scene.AssetService.Store(Mapasset); } } byte[] overlay = GenerateOverlay(); if (overlay != null) { if (m_scene.RegionInfo.RegionSettings.ParcelMapImageID != UUID.Zero) { m_scene.RegionInfo.RegionSettings.ParcelMapImageID = m_scene.AssetService.UpdateContent(m_scene.RegionInfo.RegionSettings.ParcelMapImageID, overlay); } if (m_scene.RegionInfo.RegionSettings.ParcelMapImageID == UUID.Zero) //Do not optimize away! UpdateContent can fail sometimes! { AssetBase Parcelasset = new AssetBase( UUID.Random(), "terrainMapImage_" + m_scene.RegionInfo.RegionID.ToString(), AssetType.Simstate, m_scene.RegionInfo.RegionID) { Data = overlay, Description = m_scene.RegionInfo.RegionName, Flags = AssetFlags.Deletable | AssetFlags.Rewritable | AssetFlags.Maptile }; m_scene.RegionInfo.RegionSettings.ParcelMapImageID = m_scene.AssetService.Store(Parcelasset); } } else { m_scene.RegionInfo.RegionSettings.ParcelMapImageID = UUID.Zero; } m_scene.RegionInfo.RegionSettings.TerrainMapLastRegenerated = DateTime.Now; //Update the grid map IGridRegisterModule gridRegModule = m_scene.RequestModuleInterface <IGridRegisterModule>(); if (gridRegModule != null) { gridRegModule.UpdateGridRegion(m_scene); } }
protected void SetRegionInfoOption(IScene scene, string[] cmdparams) { #region 3 Params needed if (cmdparams.Length < 4) { MainConsole.Instance.Warn("Not enough parameters!"); return; } if (cmdparams[2] == "Maturity") { switch (cmdparams[3]) { case "PG": m_scene.RegionInfo.AccessLevel = Util.ConvertMaturityToAccessLevel(0); break; case "Mature": m_scene.RegionInfo.AccessLevel = Util.ConvertMaturityToAccessLevel(1); break; case "Adult": m_scene.RegionInfo.AccessLevel = Util.ConvertMaturityToAccessLevel(2); break; default: MainConsole.Instance.Warn( "Your parameter did not match any existing parameters. Try PG, Mature, or Adult"); return; } //Tell the grid about the changes IGridRegisterModule gridRegModule = m_scene.RequestModuleInterface <IGridRegisterModule>(); if (gridRegModule != null) { gridRegModule.UpdateGridRegion(m_scene); } } #endregion #region 4 Params needed if (cmdparams.Length < 4) { MainConsole.Instance.Warn("Not enough parameters!"); return; } if (cmdparams[2] == "AddEstateBan".ToLower()) { EstateBan EB = new EstateBan { BannedUserID = m_scene.UserAccountService.GetUserAccount(null, cmdparams[3], cmdparams[4]).PrincipalID }; m_scene.RegionInfo.EstateSettings.AddBan(EB); } if (cmdparams[2] == "AddEstateManager".ToLower()) { m_scene.RegionInfo.EstateSettings.AddEstateManager( m_scene.UserAccountService.GetUserAccount(null, cmdparams[3], cmdparams[4]).PrincipalID); } if (cmdparams[2] == "AddEstateAccess".ToLower()) { m_scene.RegionInfo.EstateSettings.AddEstateUser( m_scene.UserAccountService.GetUserAccount(null, cmdparams[3], cmdparams[4]).PrincipalID); } if (cmdparams[2] == "RemoveEstateBan".ToLower()) { m_scene.RegionInfo.EstateSettings.RemoveBan( m_scene.UserAccountService.GetUserAccount(null, cmdparams[3], cmdparams[4]).PrincipalID); } if (cmdparams[2] == "RemoveEstateManager".ToLower()) { m_scene.RegionInfo.EstateSettings.RemoveEstateManager( m_scene.UserAccountService.GetUserAccount(null, cmdparams[3], cmdparams[4]).PrincipalID); } if (cmdparams[2] == "RemoveEstateAccess".ToLower()) { m_scene.RegionInfo.EstateSettings.RemoveEstateUser( m_scene.UserAccountService.GetUserAccount(null, cmdparams[3], cmdparams[4]).PrincipalID); } #endregion Aurora.Framework.Utilities.DataManager.RequestPlugin <IEstateConnector>(). SaveEstateSettings(m_scene.RegionInfo.EstateSettings); }