From 63c104efde89ce5b05aa448e12bfc8730271ddb5 Mon Sep 17 00:00:00 2001 From: mingchen Date: Sun, 4 May 2008 18:59:18 +0000 Subject: *Fixed up EstateManagementModule to the module standard - no more packets allowed! *Started cleaning up the land module --- .../Modules/World/Estate/EstateManagementModule.cs | 678 ++++++--------------- .../Modules/World/Land/LandManagementModule.cs | 15 + OpenSim/Region/Environment/Scenes/Scene.cs | 14 +- 3 files changed, 197 insertions(+), 510 deletions(-) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs index daabd9b..e0bf11b 100644 --- a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs @@ -30,7 +30,6 @@ using System.Collections.Generic; using System.Reflection; using libsecondlife; -using libsecondlife.Packets; using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Scenes; using OpenSim.Framework; @@ -45,64 +44,120 @@ namespace OpenSim.Region.Environment.Modules.World.Estate private Scene m_scene; - public enum EstateAccessCodex : uint + + + + #region Packet Data Responders + private void sendDetailedEstateData(IClientAPI remote_client, LLUUID invoice) { - AccessOptions = 17, - AllowedGroups = 18, - EstateBans = 20, - EstateManagers = 24 - } + EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); + packet.MethodData.Invoice = invoice; + packet.AgentData.TransactionID = LLUUID.Random(); + packet.MethodData.Method = Helpers.StringToField("estateupdateinfo"); + EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[9]; - #region Helper Functions + for (int i = 0; i < 9; i++) + { + returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock(); + } - private bool convertParamStringToBool(byte[] field) + //Sending Estate Settings + returnblock[0].Parameter = Helpers.StringToField(m_scene.RegionInfo.EstateSettings.estateName); + returnblock[1].Parameter = Helpers.StringToField(m_scene.RegionInfo.MasterAvatarAssignedUUID.ToString()); + returnblock[2].Parameter = Helpers.StringToField(m_scene.RegionInfo.EstateSettings.estateID.ToString()); + + // TODO: Resolve Magic numbers here + returnblock[3].Parameter = Helpers.StringToField("269516800"); + returnblock[4].Parameter = Helpers.StringToField("0"); + returnblock[5].Parameter = Helpers.StringToField("1"); + returnblock[6].Parameter = Helpers.StringToField(m_scene.RegionInfo.RegionID.ToString()); + returnblock[7].Parameter = Helpers.StringToField("1160895077"); + returnblock[8].Parameter = Helpers.StringToField("1"); + + packet.ParamList = returnblock; + packet.Header.Reliable = false; + //System.Console.WriteLine("[ESTATE]: SIM--->" + packet.ToString()); + remote_client.OutPacket(packet, ThrottleOutPacketType.Task); + + remote_client.sendEstateManagersList(invoice); + + } + + private void estateSetRegionInfoHandler(bool blockTerraform, bool noFly, bool allowDamage, bool blockLandResell, int maxAgents, float objectBonusFactor, int matureLevel, bool restrictPushObject, bool allowParcelChanges) { - string s = Helpers.FieldToUTF8String(field); - if (s == "1" || s.ToLower() == "y" || s.ToLower() == "yes" || s.ToLower() == "t" || s.ToLower() == "true") + + m_scene.RegionInfo.EstateSettings.regionFlags = Simulator.RegionFlags.None; + + if (blockTerraform) + { + m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | + Simulator.RegionFlags.BlockTerraform; + } + + if (noFly) { - return true; + m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | + Simulator.RegionFlags.NoFly; } - return false; + + if (allowDamage) + { + m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | + Simulator.RegionFlags.AllowDamage; + } + + if (blockLandResell) + { + m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | + Simulator.RegionFlags.BlockLandResell; + } + + m_scene.RegionInfo.EstateSettings.maxAgents = (byte)maxAgents; + + m_scene.RegionInfo.EstateSettings.objectBonusFactor = objectBonusFactor; + + m_scene.RegionInfo.EstateSettings.simAccess = (Simulator.SimAccess)matureLevel; + + + if (restrictPushObject) + { + m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | + Simulator.RegionFlags.RestrictPushObject; + } + + if (allowParcelChanges) + { + m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | + Simulator.RegionFlags.AllowParcelChanges; + } + + sendRegionInfoPacketToAll(); + } - /// - /// Sets terrain texture heights for each of the four corners of the region - textures are distributed as a linear range between the two heights. - /// - /// Which corner - /// Minimum height that texture range should cover - /// Maximum height that texture range should cover - public void setEstateTextureRange(Int16 corner, float lowValue, float highValue) + public void setEstateTerrainBaseTexture(IClientAPI remoteClient, int corner, LLUUID texture) { switch (corner) { case 0: - m_scene.RegionInfo.EstateSettings.terrainStartHeight0 = lowValue; - m_scene.RegionInfo.EstateSettings.terrainHeightRange0 = highValue; + m_scene.RegionInfo.EstateSettings.terrainBase0 = texture; break; case 1: - m_scene.RegionInfo.EstateSettings.terrainStartHeight1 = lowValue; - m_scene.RegionInfo.EstateSettings.terrainHeightRange1 = highValue; + m_scene.RegionInfo.EstateSettings.terrainBase1 = texture; break; case 2: - m_scene.RegionInfo.EstateSettings.terrainStartHeight2 = lowValue; - m_scene.RegionInfo.EstateSettings.terrainHeightRange2 = highValue; + m_scene.RegionInfo.EstateSettings.terrainBase2 = texture; break; case 3: - m_scene.RegionInfo.EstateSettings.terrainStartHeight3 = lowValue; - m_scene.RegionInfo.EstateSettings.terrainHeightRange3 = highValue; + m_scene.RegionInfo.EstateSettings.terrainBase3 = texture; break; } } - /// - /// Sets the 'detail' terrain texture on each of the bands. - /// - /// Which texture band - /// The UUID of the texture - public void setTerrainTexture(Int16 band, LLUUID textureUUID) + public void setEstateTerrainDetailTexture(IClientAPI client, int corner, LLUUID textureUUID) { - switch (band) + switch (corner) { case 0: m_scene.RegionInfo.EstateSettings.terrainDetail0 = textureUUID; @@ -119,260 +174,67 @@ namespace OpenSim.Region.Environment.Modules.World.Estate } } - /// - /// Sets common region settings - /// - /// Water height of the waterplane (may not nessecarily be one value) - /// Maximum amount terrain can be raised from previous baking - /// Minimum amount terrain can be lowered from previous baking - /// Use a fixed time of day on the sun? - /// The offset hour of the day - public void setRegionSettings(float WaterHeight, float TerrainRaiseLimit, float TerrainLowerLimit, - bool UseFixedSun, float SunHour) - { - // Water Height - m_scene.RegionInfo.EstateSettings.waterHeight = WaterHeight; - - // Terraforming limits - m_scene.RegionInfo.EstateSettings.terrainRaiseLimit = TerrainRaiseLimit; - m_scene.RegionInfo.EstateSettings.terrainLowerLimit = TerrainLowerLimit; - - // Time of day / fixed sun - m_scene.RegionInfo.EstateSettings.useFixedSun = UseFixedSun; - m_scene.RegionInfo.EstateSettings.sunHour = SunHour; - } - #endregion - - #region Packet Handlers - - public void handleEstateOwnerMessage(EstateOwnerMessagePacket packet, IClientAPI remote_client) + public void setEstateTerrainTextureHeights(IClientAPI client, int corner, float lowValue, float highValue) { - switch (Helpers.FieldToUTF8String(packet.MethodData.Method)) + switch (corner) { - case "getinfo": - - //System.Console.WriteLine("[ESTATE]: CLIENT--->" + packet.ToString()); - //sendRegionInfoPacketToAll(); - if (m_scene.PermissionsMngr.GenericEstatePermission(remote_client.AgentId)) - { - sendDetailedEstateData(remote_client, packet); - } - break; - case "setregioninfo": - if (m_scene.PermissionsMngr.CanEditEstateTerrain(remote_client.AgentId)) - estateSetRegionInfoHandler(packet); - break; - case "texturebase": - if (m_scene.PermissionsMngr.CanEditEstateTerrain(remote_client.AgentId)) - estateTextureBaseHandler(packet); - break; - case "texturedetail": - if (m_scene.PermissionsMngr.CanEditEstateTerrain(remote_client.AgentId)) - estateTextureDetailHandler(packet); - break; - case "textureheights": - if (m_scene.PermissionsMngr.CanEditEstateTerrain(remote_client.AgentId)) - estateTextureHeightsHandler(packet); - break; - case "texturecommit": - sendRegionHandshakeToAll(); - break; - case "setregionterrain": - if (m_scene.PermissionsMngr.CanEditEstateTerrain(remote_client.AgentId)) - estateSetRegionTerrainHandler(packet); - break; - case "restart": - if (m_scene.PermissionsMngr.CanRestartSim(remote_client.AgentId)) - { - estateRestartSim(packet); - } - break; - case "estatechangecovenantid": - if (m_scene.PermissionsMngr.CanEditEstateTerrain(remote_client.AgentId)) - { - EstateChangeCovenant(packet); - } - break; - case "estateaccessdelta": // Estate access delta manages the banlist and allow list too. - if (m_scene.PermissionsMngr.GenericEstatePermission(remote_client.AgentId)) - { - estateAccessDelta(remote_client, packet); - } - break; - case "simulatormessage": - if (m_scene.PermissionsMngr.GenericEstatePermission(remote_client.AgentId)) - { - SendSimulatorBlueBoxMessage(remote_client, packet); - } - break; - case "instantmessage": - if (m_scene.PermissionsMngr.GenericEstatePermission(remote_client.AgentId)) - { - SendEstateBlueBoxMessage(remote_client, packet); - } + case 0: + m_scene.RegionInfo.EstateSettings.terrainStartHeight0 = lowValue; + m_scene.RegionInfo.EstateSettings.terrainHeightRange0 = highValue; break; - case "setregiondebug": - if (m_scene.PermissionsMngr.GenericEstatePermission(remote_client.AgentId)) - { - SetRegionDebug(remote_client, packet); - } + case 1: + m_scene.RegionInfo.EstateSettings.terrainStartHeight1 = lowValue; + m_scene.RegionInfo.EstateSettings.terrainHeightRange1 = highValue; break; - case "teleporthomeuser": - if (m_scene.PermissionsMngr.GenericEstatePermission(remote_client.AgentId)) - { - TeleportOneUserHome(remote_client, packet); - } + case 2: + m_scene.RegionInfo.EstateSettings.terrainStartHeight2 = lowValue; + m_scene.RegionInfo.EstateSettings.terrainHeightRange2 = highValue; break; - default: - m_log.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString()); + case 3: + m_scene.RegionInfo.EstateSettings.terrainStartHeight3 = lowValue; + m_scene.RegionInfo.EstateSettings.terrainHeightRange3 = highValue; break; } - - } - private void TeleportOneUserHome(object remove_client, EstateOwnerMessagePacket packet) + private void handleCommitEstateTerrainTextureRequest(IClientAPI remoteClient) { - LLUUID invoice = packet.MethodData.Invoice; - LLUUID SenderID = packet.AgentData.AgentID; - LLUUID Prey = LLUUID.Zero; - - Helpers.TryParse(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter), out Prey); - if (Prey != LLUUID.Zero) - { - ScenePresence s = m_scene.GetScenePresence(Prey); - if (s != null) - { - m_scene.TeleportClientHome(Prey, s.ControllingClient); - } - } + sendRegionHandshakeToAll(); } - private void SetRegionDebug(IClientAPI remote_client, EstateOwnerMessagePacket packet) + public void setRegionTerrainSettings(float WaterHeight, float TerrainRaiseLimit, float TerrainLowerLimit, + bool UseFixedSun, float SunHour) { - LLUUID invoice = packet.MethodData.Invoice; - LLUUID SenderID = packet.AgentData.AgentID; - bool scripted = convertParamStringToBool(packet.ParamList[0].Parameter); - bool collisionEvents = convertParamStringToBool(packet.ParamList[1].Parameter); - bool physics = convertParamStringToBool(packet.ParamList[2].Parameter); - - if (physics) - { - m_scene.RegionInfo.EstateSettings.regionFlags |= Simulator.RegionFlags.SkipPhysics; - } - else - { - m_scene.RegionInfo.EstateSettings.regionFlags &= ~Simulator.RegionFlags.SkipPhysics; - } - - if (scripted) - { - m_scene.RegionInfo.EstateSettings.regionFlags |= Simulator.RegionFlags.SkipScripts; - } - else - { - m_scene.RegionInfo.EstateSettings.regionFlags &= ~Simulator.RegionFlags.SkipScripts; - } - + // Water Height + m_scene.RegionInfo.EstateSettings.waterHeight = WaterHeight; - m_scene.SetSceneCoreDebug(scripted, collisionEvents, physics); - } + // Terraforming limits + m_scene.RegionInfo.EstateSettings.terrainRaiseLimit = TerrainRaiseLimit; + m_scene.RegionInfo.EstateSettings.terrainLowerLimit = TerrainLowerLimit; - private void SendSimulatorBlueBoxMessage(IClientAPI remote_client, EstateOwnerMessagePacket packet) - { - LLUUID invoice = packet.MethodData.Invoice; - LLUUID SenderID = new LLUUID(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter)); - string SenderName = Helpers.FieldToUTF8String(packet.ParamList[3].Parameter); - string Message = Helpers.FieldToUTF8String(packet.ParamList[4].Parameter); - m_scene.SendRegionMessageFromEstateTools(SenderID, packet.AgentData.SessionID, SenderName, Message); + // Time of day / fixed sun + m_scene.RegionInfo.EstateSettings.useFixedSun = UseFixedSun; + m_scene.RegionInfo.EstateSettings.sunHour = SunHour; + sendRegionInfoPacketToAll(); } - private void SendEstateBlueBoxMessage(IClientAPI remote_client, EstateOwnerMessagePacket packet) - { - LLUUID invoice = packet.MethodData.Invoice; - LLUUID SenderID = packet.AgentData.AgentID; - string SenderName = Helpers.FieldToUTF8String(packet.ParamList[0].Parameter); - string Message = Helpers.FieldToUTF8String(packet.ParamList[1].Parameter); - m_scene.SendEstateMessageFromEstateTools(SenderID, packet.AgentData.SessionID, SenderName, Message); - } - private void sendDetailedEstateData(IClientAPI remote_client, EstateOwnerMessagePacket packet) + private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds) { - - LLUUID invoice = packet.MethodData.Invoice; - packet.AgentData.TransactionID = LLUUID.Random(); - packet.MethodData.Method = Helpers.StringToField("estateupdateinfo"); - EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[9]; - - for (int i = 0; i < 9; i++) - { - returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock(); - } - - //Sending Estate Settings - returnblock[0].Parameter = Helpers.StringToField(m_scene.RegionInfo.EstateSettings.estateName); - returnblock[1].Parameter = Helpers.StringToField(m_scene.RegionInfo.MasterAvatarAssignedUUID.ToString()); - returnblock[2].Parameter = Helpers.StringToField(m_scene.RegionInfo.EstateSettings.estateID.ToString()); - - // TODO: Resolve Magic numbers here - returnblock[3].Parameter = Helpers.StringToField("269516800"); - returnblock[4].Parameter = Helpers.StringToField("0"); - returnblock[5].Parameter = Helpers.StringToField("1"); - returnblock[6].Parameter = Helpers.StringToField(m_scene.RegionInfo.RegionID.ToString()); - returnblock[7].Parameter = Helpers.StringToField("1160895077"); - returnblock[8].Parameter = Helpers.StringToField("1"); - - packet.ParamList = returnblock; - packet.Header.Reliable = false; - //System.Console.WriteLine("[ESTATE]: SIM--->" + packet.ToString()); - remote_client.OutPacket(packet, ThrottleOutPacketType.Task); - - sendEstateManagerList(remote_client, packet); - + m_scene.Restart(timeInSeconds); } - private void sendEstateManagerList(IClientAPI remote_client, EstateOwnerMessagePacket packet) + private void handleChangeEstateCovenantRequest(IClientAPI remoteClient, LLUUID estateCovenantID) { - LLUUID invoice = packet.MethodData.Invoice; - - //Sending Estate Managers - packet = new EstateOwnerMessagePacket(); - packet.AgentData.TransactionID = LLUUID.Random(); - packet.AgentData.AgentID = remote_client.AgentId; - packet.AgentData.SessionID = remote_client.SessionId; - packet.MethodData.Invoice = invoice; - packet.MethodData.Method = Helpers.StringToField("setaccess"); - LLUUID[] EstateManagers = m_scene.RegionInfo.EstateSettings.estateManagers; + m_scene.RegionInfo.CovenantID = estateCovenantID; + m_scene.RegionInfo.SaveEstatecovenantUUID(estateCovenantID); - EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + EstateManagers.Length]; - - for (int i = 0; i < (6 + EstateManagers.Length); i++) - { - returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock(); - } - int j = 0; - - returnblock[j].Parameter = Helpers.StringToField(m_scene.RegionInfo.EstateSettings.estateID.ToString()); j++; - returnblock[j].Parameter = Helpers.StringToField(((int)EstateAccessCodex.EstateManagers).ToString()); j++; - returnblock[j].Parameter = Helpers.StringToField("0"); j++; - returnblock[j].Parameter = Helpers.StringToField("0"); j++; - returnblock[j].Parameter = Helpers.StringToField("0"); j++; - returnblock[j].Parameter = Helpers.StringToField(EstateManagers.Length.ToString()); j++; - for (int i = 0; i < EstateManagers.Length; i++) - { - returnblock[j].Parameter = EstateManagers[i].GetBytes(); j++; - } - packet.ParamList = returnblock; - packet.Header.Reliable = false; - //System.Console.WriteLine("[ESTATE]: SIM--->" + packet.ToString()); - remote_client.OutPacket(packet, ThrottleOutPacketType.Task); } - private void estateAccessDelta(IClientAPI remote_client, EstateOwnerMessagePacket packet) + private void handleEstateAccessDeltaRequest(IClientAPI remote_client, LLUUID invoice, int estateAccessType, LLUUID user) { // EstateAccessDelta handles Estate Managers, Sim Access, Sim Banlist, allowed Groups.. etc. - int estateAccessType = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter)); switch (estateAccessType) { @@ -380,10 +242,10 @@ namespace OpenSim.Region.Environment.Modules.World.Estate // This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml // So make sure you really trust your region owners. because they can add other estate manaagers to your other estates - if (packet.AgentData.AgentID == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.PermissionsMngr.BypassPermissions) + if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.PermissionsMngr.BypassPermissions) { - m_scene.RegionInfo.EstateSettings.AddEstateManager(new LLUUID(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter))); - sendEstateManagerList(remote_client, packet); + m_scene.RegionInfo.EstateSettings.AddEstateManager(user); + remote_client.sendEstateManagersList(invoice); } else { @@ -394,10 +256,10 @@ namespace OpenSim.Region.Environment.Modules.World.Estate case 512: // This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml // So make sure you really trust your region owners. because they can add other estate manaagers to your other estates - if (packet.AgentData.AgentID == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.PermissionsMngr.BypassPermissions) + if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.PermissionsMngr.BypassPermissions) { - m_scene.RegionInfo.EstateSettings.RemoveEstateManager(new LLUUID(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter))); - sendEstateManagerList(remote_client, packet); + m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user); + remote_client.sendEstateManagersList(invoice); } else { @@ -407,236 +269,73 @@ namespace OpenSim.Region.Environment.Modules.World.Estate default: - m_log.Error("EstateOwnerMessage: Unknown EstateAccessType requested in estateAccessDelta\n" + packet.ToString()); + m_log.Error("EstateOwnerMessage: Unknown EstateAccessType requested in estateAccessDelta"); break; } - //m_log.Error("EstateOwnerMessage: estateAccessDelta\n" + packet.ToString()); + } + private void SendSimulatorBlueBoxMessage(IClientAPI remote_client, LLUUID invoice, LLUUID senderID, LLUUID sessionID, string senderName, string message) + { + m_scene.SendRegionMessageFromEstateTools(senderID, sessionID, senderName, message); } - private void estateSetRegionInfoHandler(EstateOwnerMessagePacket packet) + private void SendEstateBlueBoxMessage(IClientAPI remote_client, LLUUID invoice, LLUUID senderID, LLUUID sessionID, string senderName, string message) { - if (packet.ParamList.Length != 9) - { - m_log.Error("EstateOwnerMessage: SetRegionInfo method has a ParamList of invalid length"); - } - else - { - m_scene.RegionInfo.EstateSettings.regionFlags = Simulator.RegionFlags.None; - - if (convertParamStringToBool(packet.ParamList[0].Parameter)) - { - m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | - Simulator.RegionFlags.BlockTerraform; - } - - if (convertParamStringToBool(packet.ParamList[1].Parameter)) - { - m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | - Simulator.RegionFlags.NoFly; - } - - if (convertParamStringToBool(packet.ParamList[2].Parameter)) - { - m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | - Simulator.RegionFlags.AllowDamage; - } - - if (convertParamStringToBool(packet.ParamList[3].Parameter) == false) - { - m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | - Simulator.RegionFlags.BlockLandResell; - } - - - int tempMaxAgents = - Convert.ToInt16(Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[4].Parameter))); - m_scene.RegionInfo.EstateSettings.maxAgents = (byte)tempMaxAgents; - - float tempObjectBonusFactor = - (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); - m_scene.RegionInfo.EstateSettings.objectBonusFactor = tempObjectBonusFactor; - - int tempMatureLevel = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[6].Parameter)); - m_scene.RegionInfo.EstateSettings.simAccess = (Simulator.SimAccess)tempMatureLevel; - - - if (convertParamStringToBool(packet.ParamList[7].Parameter)) - { - m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | - Simulator.RegionFlags.RestrictPushObject; - } - - if (convertParamStringToBool(packet.ParamList[8].Parameter)) - { - m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | - Simulator.RegionFlags.AllowParcelChanges; - } - - sendRegionInfoPacketToAll(); - } + m_scene.SendEstateMessageFromEstateTools(senderID, sessionID, senderName, message); } - private void estateSetRegionTerrainHandler(EstateOwnerMessagePacket packet) + private void handleEstateDebugRegionRequest(IClientAPI remote_client, LLUUID invoice, LLUUID senderID, bool scripted, bool collisionEvents, bool physics) { - if (packet.ParamList.Length != 9) + + + if (physics) { - m_log.Error("EstateOwnerMessage: SetRegionTerrain method has a ParamList of invalid length"); + m_scene.RegionInfo.EstateSettings.regionFlags |= Simulator.RegionFlags.SkipPhysics; } else { - try - { - string tmp; - tmp = Helpers.FieldToUTF8String(packet.ParamList[0].Parameter); - if (!tmp.Contains(".")) tmp += ".00"; - float WaterHeight = (float)Convert.ToDecimal(tmp); - tmp = Helpers.FieldToUTF8String(packet.ParamList[1].Parameter); - if (!tmp.Contains(".")) tmp += ".00"; - float TerrainRaiseLimit = (float)Convert.ToDecimal(tmp); - tmp = Helpers.FieldToUTF8String(packet.ParamList[2].Parameter); - if (!tmp.Contains(".")) tmp += ".00"; - float TerrainLowerLimit = (float)Convert.ToDecimal(tmp); - bool UseFixedSun = convertParamStringToBool(packet.ParamList[4].Parameter); - float SunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); - - setRegionSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseFixedSun, SunHour); - - sendRegionInfoPacketToAll(); - } - catch (Exception ex) - { - m_log.Error("EstateManager: Exception while setting terrain settings: \n" + packet.ToString() + "\n" + ex.ToString()); - } + m_scene.RegionInfo.EstateSettings.regionFlags &= ~Simulator.RegionFlags.SkipPhysics; } - } - private void estateTextureHeightsHandler(EstateOwnerMessagePacket packet) - { - foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) + if (scripted) { - string s = Helpers.FieldToUTF8String(block.Parameter); - string[] splitField = s.Split(' '); - if (splitField.Length == 3) - { - Int16 corner = Convert.ToInt16(splitField[0]); - float lowValue = (float)Convert.ToDecimal(splitField[1]); - float highValue = (float)Convert.ToDecimal(splitField[2]); - - setEstateTextureRange(corner, lowValue, highValue); - } + m_scene.RegionInfo.EstateSettings.regionFlags |= Simulator.RegionFlags.SkipScripts; } - } - - private void estateTextureDetailHandler(EstateOwnerMessagePacket packet) - { - foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) + else { - string s = Helpers.FieldToUTF8String(block.Parameter); - string[] splitField = s.Split(' '); - if (splitField.Length == 2) - { - Int16 corner = Convert.ToInt16(splitField[0]); - LLUUID textureUUID = new LLUUID(splitField[1]); - - setTerrainTexture(corner, textureUUID); - } + m_scene.RegionInfo.EstateSettings.regionFlags &= ~Simulator.RegionFlags.SkipScripts; } + + + m_scene.SetSceneCoreDebug(scripted, collisionEvents, physics); } - private void estateTextureBaseHandler(EstateOwnerMessagePacket packet) + private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, LLUUID invoice, LLUUID senderID, LLUUID prey) { - foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) + + if (prey != LLUUID.Zero) { - string s = Helpers.FieldToUTF8String(block.Parameter); - string[] splitField = s.Split(' '); - if (splitField.Length == 2) + ScenePresence s = m_scene.GetScenePresence(prey); + if (s != null) { - LLUUID tempUUID = new LLUUID(splitField[1]); - switch (Convert.ToInt16(splitField[0])) - { - case 0: - m_scene.RegionInfo.EstateSettings.terrainBase0 = tempUUID; - break; - case 1: - m_scene.RegionInfo.EstateSettings.terrainBase1 = tempUUID; - break; - case 2: - m_scene.RegionInfo.EstateSettings.terrainBase2 = tempUUID; - break; - case 3: - m_scene.RegionInfo.EstateSettings.terrainBase3 = tempUUID; - break; - } + m_scene.TeleportClientHome(prey, s.ControllingClient); } } } - private void estateRestartSim(EstateOwnerMessagePacket packet) + private void HandleRegionInfoRequest(IClientAPI remote_client) { - // There's only 1 block in the estateResetSim.. and that's the number of seconds till restart. - foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) - { - float timeSeconds = 0; - Helpers.TryParse(Helpers.FieldToUTF8String(block.Parameter), out timeSeconds); - timeSeconds = (int)timeSeconds; - m_scene.Restart(timeSeconds); - - } + remote_client.sendRegionInfoToEstateMenu(); } - private void EstateChangeCovenant(EstateOwnerMessagePacket packet) + private void HandleEstateCovenantRequest(IClientAPI remote_client) { - foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) - { - LLUUID newCovenantID = new LLUUID(Helpers.FieldToUTF8String(block.Parameter)); - m_scene.RegionInfo.CovenantID = newCovenantID; - m_scene.RegionInfo.SaveEstatecovenantUUID(newCovenantID); - } + remote_client.sendEstateCovenantInformation(); } - public void HandleRegionInfoRequest(IClientAPI client, LLUUID sessionID) - { - RegionInfoPacket rinfopack = new RegionInfoPacket(); - RegionInfoPacket.RegionInfoBlock rinfoblk = new RegionInfoPacket.RegionInfoBlock(); - rinfopack.AgentData.AgentID = client.AgentId; - rinfopack.AgentData.SessionID = client.SessionId; - rinfoblk.BillableFactor = m_scene.RegionInfo.EstateSettings.billableFactor; - rinfoblk.EstateID = m_scene.RegionInfo.EstateSettings.estateID; - rinfoblk.MaxAgents = m_scene.RegionInfo.EstateSettings.maxAgents; - rinfoblk.ObjectBonusFactor = m_scene.RegionInfo.EstateSettings.objectBonusFactor; - rinfoblk.ParentEstateID = m_scene.RegionInfo.EstateSettings.parentEstateID; - rinfoblk.PricePerMeter = m_scene.RegionInfo.EstateSettings.pricePerMeter; - rinfoblk.RedirectGridX = m_scene.RegionInfo.EstateSettings.redirectGridX; - rinfoblk.RedirectGridY = m_scene.RegionInfo.EstateSettings.redirectGridY; - rinfoblk.RegionFlags = (uint)(m_scene.RegionInfo.EstateSettings.regionFlags); - rinfoblk.SimAccess = (byte)m_scene.RegionInfo.EstateSettings.simAccess; - rinfoblk.SunHour = m_scene.RegionInfo.EstateSettings.sunHour; - rinfoblk.TerrainLowerLimit = m_scene.RegionInfo.EstateSettings.terrainLowerLimit; - rinfoblk.TerrainRaiseLimit = m_scene.RegionInfo.EstateSettings.terrainRaiseLimit; - rinfoblk.UseEstateSun = !m_scene.RegionInfo.EstateSettings.useFixedSun; - rinfoblk.WaterHeight = m_scene.RegionInfo.EstateSettings.waterHeight; - rinfoblk.SimName = Helpers.StringToField(m_scene.RegionInfo.RegionName); - - rinfopack.RegionInfo = rinfoblk; - - client.OutPacket(rinfopack, ThrottleOutPacketType.Task); - } - public void HandleEstateCovenantRequest(IClientAPI client, LLUUID sessionID) - { - EstateCovenantReplyPacket einfopack = new EstateCovenantReplyPacket(); - EstateCovenantReplyPacket.DataBlock edata = new EstateCovenantReplyPacket.DataBlock(); - edata.CovenantID = m_scene.RegionInfo.CovenantID; - edata.CovenantTimestamp = 0; - edata.EstateOwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID; - edata.EstateName = - Helpers.StringToField(m_scene.RegionInfo.MasterAvatarFirstName + " " + m_scene.RegionInfo.MasterAvatarLastName); - einfopack.Data = edata; - client.OutPacket(einfopack, ThrottleOutPacketType.Task); - } +#endregion - #endregion #region Outgoing Packets @@ -646,9 +345,13 @@ namespace OpenSim.Region.Environment.Modules.World.Estate for (int i = 0; i < avatars.Count; i++) { - sendRegionInfoPacket(avatars[i].ControllingClient); + avatars[i].ControllingClient.sendRegionInfoToEstateMenu(); } } + public void sendRegionHandshake(IClientAPI remoteClient) + { + remoteClient.SendRegionHandshake(m_scene.RegionInfo); + } public void sendRegionHandshakeToAll() { @@ -657,39 +360,6 @@ namespace OpenSim.Region.Environment.Modules.World.Estate ); } - public void sendRegionInfoPacket(IClientAPI remote_client) - { - AgentCircuitData circuitData = remote_client.RequestClientInfo(); - - RegionInfoPacket regionInfoPacket = new RegionInfoPacket(); - regionInfoPacket.AgentData.AgentID = circuitData.AgentID; - regionInfoPacket.AgentData.SessionID = circuitData.SessionID; - regionInfoPacket.RegionInfo.BillableFactor = m_scene.RegionInfo.EstateSettings.billableFactor; - regionInfoPacket.RegionInfo.EstateID = m_scene.RegionInfo.EstateSettings.estateID; - regionInfoPacket.RegionInfo.MaxAgents = m_scene.RegionInfo.EstateSettings.maxAgents; - regionInfoPacket.RegionInfo.ObjectBonusFactor = m_scene.RegionInfo.EstateSettings.objectBonusFactor; - regionInfoPacket.RegionInfo.ParentEstateID = m_scene.RegionInfo.EstateSettings.parentEstateID; - regionInfoPacket.RegionInfo.PricePerMeter = m_scene.RegionInfo.EstateSettings.pricePerMeter; - regionInfoPacket.RegionInfo.RedirectGridX = m_scene.RegionInfo.EstateSettings.redirectGridX; - regionInfoPacket.RegionInfo.RedirectGridY = m_scene.RegionInfo.EstateSettings.redirectGridY; - regionInfoPacket.RegionInfo.RegionFlags = (uint)(m_scene.RegionInfo.EstateSettings.regionFlags); - regionInfoPacket.RegionInfo.SimAccess = (byte)m_scene.RegionInfo.EstateSettings.simAccess; - regionInfoPacket.RegionInfo.SimName = Helpers.StringToField(m_scene.RegionInfo.RegionName); - regionInfoPacket.RegionInfo.SunHour = m_scene.RegionInfo.EstateSettings.sunHour; - regionInfoPacket.RegionInfo.TerrainLowerLimit = m_scene.RegionInfo.EstateSettings.terrainLowerLimit; - regionInfoPacket.RegionInfo.TerrainRaiseLimit = m_scene.RegionInfo.EstateSettings.terrainRaiseLimit; - regionInfoPacket.RegionInfo.UseEstateSun = !m_scene.RegionInfo.EstateSettings.useFixedSun; - regionInfoPacket.RegionInfo.WaterHeight = m_scene.RegionInfo.EstateSettings.waterHeight; - - - remote_client.OutPacket(regionInfoPacket, ThrottleOutPacketType.Task); - } - - public void sendRegionHandshake(IClientAPI remoteClient) - { - remoteClient.SendRegionHandshake(m_scene.RegionInfo); - } - #endregion #region IRegionModule Members @@ -704,7 +374,21 @@ namespace OpenSim.Region.Environment.Modules.World.Estate void EventManager_OnNewClient(IClientAPI client) { - client.OnEstateOwnerMessage += handleEstateOwnerMessage; + client.OnDetailedEstateDataRequest += sendDetailedEstateData; + client.OnSetEstateFlagsRequest += estateSetRegionInfoHandler; + client.OnSetEstateTerrainBaseTexture += setEstateTerrainBaseTexture; + client.OnSetEstateTerrainDetailTexture += setEstateTerrainDetailTexture; + client.OnSetEstateTerrainTextureHeights += setEstateTerrainTextureHeights; + client.OnCommitEstateTerrainTextureRequest += handleCommitEstateTerrainTextureRequest; + client.OnSetRegionTerrainSettings += setRegionTerrainSettings; + client.OnEstateRestartSimRequest += handleEstateRestartSimRequest; + client.OnEstateChangeCovenantRequest += handleChangeEstateCovenantRequest; + client.OnUpdateEstateAccessDeltaRequest += handleEstateAccessDeltaRequest; + client.OnSimulatorBlueBoxMessageRequest += SendSimulatorBlueBoxMessage; + client.OnEstateBlueBoxMessageRequest += SendEstateBlueBoxMessage; + client.OnEstateDebugRegionRequest += handleEstateDebugRegionRequest; + client.OnEstateTeleportOneUserHomeRequest += handleEstateTeleportOneUserHomeRequest; + client.OnRegionInfoRequest += HandleRegionInfoRequest; client.OnEstateCovenantRequest += HandleEstateCovenantRequest; sendRegionHandshake(client); @@ -735,7 +419,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate public void changeWaterHeight(float height) { - setRegionSettings(height, m_scene.RegionInfo.EstateSettings.terrainRaiseLimit, m_scene.RegionInfo.EstateSettings.terrainLowerLimit, m_scene.RegionInfo.EstateSettings.useFixedSun, m_scene.RegionInfo.EstateSettings.sunHour); + setRegionTerrainSettings(height, m_scene.RegionInfo.EstateSettings.terrainRaiseLimit, m_scene.RegionInfo.EstateSettings.terrainLowerLimit, m_scene.RegionInfo.EstateSettings.useFixedSun, m_scene.RegionInfo.EstateSettings.sunHour); sendRegionInfoPacketToAll(); } #endregion diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs index 877bed5..f891332 100644 --- a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs @@ -28,6 +28,7 @@ using Nini.Config; using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Scenes; +using OpenSim.Framework; namespace OpenSim.Region.Environment.Modules.World.Land { @@ -49,6 +50,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land m_scene.EventManager.OnClientMovement += new EventManager.ClientMovement(landChannel.handleAnyClientMovement); m_scene.EventManager.OnValidateLandBuy += landChannel.handleLandValidationRequest; m_scene.EventManager.OnLandBuy += landChannel.handleLandBuyRequest; + m_scene.EventManager.OnNewClient += new EventManager.OnNewClientDelegate(EventManager_OnNewClient); lock (m_scene) { @@ -56,6 +58,19 @@ namespace OpenSim.Region.Environment.Modules.World.Land } } + void EventManager_OnNewClient(IClientAPI client) + { + //Register some client events + client.OnParcelPropertiesRequest += new ParcelPropertiesRequest(landChannel.handleParcelPropertiesRequest); + client.OnParcelDivideRequest += new ParcelDivideRequest(landChannel.handleParcelDivideRequest); + client.OnParcelJoinRequest += new ParcelJoinRequest(landChannel.handleParcelJoinRequest); + client.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(landChannel.handleParcelPropertiesUpdateRequest); + client.OnParcelSelectObjects += new ParcelSelectObjects(landChannel.handleParcelSelectObjectsRequest); + client.OnParcelObjectOwnerRequest += new ParcelObjectOwnerRequest(landChannel.handleParcelObjectOwnersRequest); + client.OnParcelAccessListRequest += new ParcelAccessListRequest(landChannel.handleParcelAccessRequest); + client.OnParcelAccessListUpdateRequest += new ParcelAccessListUpdateRequest(landChannel.handleParcelAccessUpdateRequest); + } + public void PostInitialise() { } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 13f8b61..3cc2cbc 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1550,18 +1550,6 @@ namespace OpenSim.Region.Environment.Scenes client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay; client.OnUpdatePrimFlags += m_innerScene.UpdatePrimFlags; client.OnRequestObjectPropertiesFamily += m_innerScene.RequestObjectPropertiesFamily; - client.OnParcelPropertiesRequest += new ParcelPropertiesRequest(LandChannel.handleParcelPropertiesRequest); - client.OnParcelDivideRequest += new ParcelDivideRequest(LandChannel.handleParcelDivideRequest); - client.OnParcelJoinRequest += new ParcelJoinRequest(LandChannel.handleParcelJoinRequest); - client.OnParcelPropertiesUpdateRequest += - new ParcelPropertiesUpdateRequest(LandChannel.handleParcelPropertiesUpdateRequest); - client.OnParcelSelectObjects += new ParcelSelectObjects(LandChannel.handleParcelSelectObjectsRequest); - client.OnParcelObjectOwnerRequest += - new ParcelObjectOwnerRequest(LandChannel.handleParcelObjectOwnersRequest); - client.OnParcelAccessListRequest += new ParcelAccessListRequest(LandChannel.handleParcelAccessRequest); - client.OnParcelAccessListUpdateRequest += - new ParcelAccessListUpdateRequest(LandChannel.handleParcelAccessUpdateRequest); - client.OnRequestGodlikePowers += handleRequestGodlikePowers; client.OnGodKickUser += HandleGodlikeKickUser; @@ -1599,7 +1587,7 @@ namespace OpenSim.Region.Environment.Scenes client.OnSetStartLocationRequest += SetHomeRezPoint; client.OnUndo += m_innerScene.HandleUndo; - + EventManager.TriggerOnNewClient(client); } public virtual void TeleportClientHome(LLUUID AgentId, IClientAPI client) -- cgit v1.1