aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authormingchen2008-05-04 18:59:18 +0000
committermingchen2008-05-04 18:59:18 +0000
commit63c104efde89ce5b05aa448e12bfc8730271ddb5 (patch)
tree2ed7e360fbe6db49de42d51acb4df4b3dda9d0db
parent* Refactor: A final root folder special case removal, this time in HandleFetc... (diff)
downloadopensim-SC_OLD-63c104efde89ce5b05aa448e12bfc8730271ddb5.zip
opensim-SC_OLD-63c104efde89ce5b05aa448e12bfc8730271ddb5.tar.gz
opensim-SC_OLD-63c104efde89ce5b05aa448e12bfc8730271ddb5.tar.bz2
opensim-SC_OLD-63c104efde89ce5b05aa448e12bfc8730271ddb5.tar.xz
*Fixed up EstateManagementModule to the module standard - no more packets allowed!
*Started cleaning up the land module
-rw-r--r--OpenSim/Framework/Constants.cs8
-rw-r--r--OpenSim/Framework/IClientAPI.cs44
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs302
-rw-r--r--OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs678
-rw-r--r--OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs15
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs14
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs26
7 files changed, 566 insertions, 521 deletions
diff --git a/OpenSim/Framework/Constants.cs b/OpenSim/Framework/Constants.cs
index 395b71d..7a7d5d3 100644
--- a/OpenSim/Framework/Constants.cs
+++ b/OpenSim/Framework/Constants.cs
@@ -31,5 +31,13 @@ namespace OpenSim.Framework
31 { 31 {
32 public const uint RegionSize = 256; 32 public const uint RegionSize = 256;
33 public const byte TerrainPatchSize = 16; 33 public const byte TerrainPatchSize = 16;
34
35 public enum EstateAccessCodex : uint
36 {
37 AccessOptions = 17,
38 AllowedGroups = 18,
39 EstateBans = 20,
40 EstateManagers = 24
41 }
34 } 42 }
35} \ No newline at end of file 43} \ No newline at end of file
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 02dfc8c..b413c2c3 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -355,9 +355,9 @@ namespace OpenSim.Framework
355 355
356 public delegate void EstateOwnerMessageRequest(EstateOwnerMessagePacket packet, IClientAPI remote_client); 356 public delegate void EstateOwnerMessageRequest(EstateOwnerMessagePacket packet, IClientAPI remote_client);
357 357
358 public delegate void RegionInfoRequest(IClientAPI remote_client, LLUUID sessionID); 358 public delegate void RegionInfoRequest(IClientAPI remote_client);
359 359
360 public delegate void EstateCovenantRequest(IClientAPI remote_client, LLUUID sessionID); 360 public delegate void EstateCovenantRequest(IClientAPI remote_client);
361 361
362 public delegate void UUIDNameRequest(LLUUID id, IClientAPI remote_client); 362 public delegate void UUIDNameRequest(LLUUID id, IClientAPI remote_client);
363 363
@@ -456,6 +456,22 @@ namespace OpenSim.Framework
456 public delegate void ScriptAnswer(IClientAPI remoteClient, LLUUID objectID, LLUUID itemID, int answer); 456 public delegate void ScriptAnswer(IClientAPI remoteClient, LLUUID objectID, LLUUID itemID, int answer);
457 457
458 public delegate void RequestPayPrice(IClientAPI remoteClient, LLUUID objectID); 458 public delegate void RequestPayPrice(IClientAPI remoteClient, LLUUID objectID);
459
460 //Estate Requests
461 public delegate void DetailedEstateDataRequest(IClientAPI remoteClient, LLUUID invoice);
462 public delegate void SetEstateFlagsRequest(bool blockTerraform, bool noFly, bool allowDamage, bool blockLandResell, int maxAgents, float objectBonusFactor, int matureLevel, bool restrictPushObject, bool allowParcelChanges);
463 public delegate void SetEstateTerrainBaseTexture(IClientAPI remoteClient, int corner, LLUUID side);
464 public delegate void SetEstateTerrainDetailTexture(IClientAPI remoteClient, int corner, LLUUID side);
465 public delegate void SetEstateTerrainTextureHeights(IClientAPI remoteClient, int corner, float lowVal, float highVal);
466 public delegate void CommitEstateTerrainTextureRequest(IClientAPI remoteClient);
467 public delegate void SetRegionTerrainSettings(float waterHeight, float terrainRaiseLimit, float terrainLowerLimit, bool fixedSun, float sunHour);
468 public delegate void EstateRestartSimRequest(IClientAPI remoteClient, int secondsTilReboot);
469 public delegate void EstateChangeCovenantRequest(IClientAPI remoteClient, LLUUID newCovenantID);
470 public delegate void UpdateEstateAccessDeltaRequest(IClientAPI remote_client, LLUUID invoice, int estateAccessType, LLUUID user);
471 public delegate void SimulatorBlueBoxMessageRequest(IClientAPI remoteClient, LLUUID invoice, LLUUID senderID, LLUUID sessionID, string senderName, string message);
472 public delegate void EstateBlueBoxMessageRequest(IClientAPI remoteClient, LLUUID invoice, LLUUID senderID, LLUUID sessionID, string senderName, string message);
473 public delegate void EstateDebugRegionRequest(IClientAPI remoteClient, LLUUID invoice, LLUUID senderID, bool scripted, bool collisionEvents, bool physics);
474 public delegate void EstateTeleportOneUserHomeRequest(IClientAPI remoteClient, LLUUID invoice, LLUUID senderID, LLUUID prey);
459 475
460 public interface IClientAPI 476 public interface IClientAPI
461 { 477 {
@@ -587,7 +603,6 @@ namespace OpenSim.Framework
587 event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; 603 event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
588 event ParcelSelectObjects OnParcelSelectObjects; 604 event ParcelSelectObjects OnParcelSelectObjects;
589 event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest; 605 event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
590 event EstateOwnerMessageRequest OnEstateOwnerMessage;
591 event RegionInfoRequest OnRegionInfoRequest; 606 event RegionInfoRequest OnRegionInfoRequest;
592 event EstateCovenantRequest OnEstateCovenantRequest; 607 event EstateCovenantRequest OnEstateCovenantRequest;
593 608
@@ -613,6 +628,24 @@ namespace OpenSim.Framework
613 628
614 event AgentSit OnUndo; 629 event AgentSit OnUndo;
615 630
631 event DetailedEstateDataRequest OnDetailedEstateDataRequest;
632 event SetEstateFlagsRequest OnSetEstateFlagsRequest;
633 event SetEstateTerrainBaseTexture OnSetEstateTerrainBaseTexture;
634 event SetEstateTerrainDetailTexture OnSetEstateTerrainDetailTexture;
635 event SetEstateTerrainTextureHeights OnSetEstateTerrainTextureHeights;
636 event CommitEstateTerrainTextureRequest OnCommitEstateTerrainTextureRequest;
637 event SetRegionTerrainSettings OnSetRegionTerrainSettings;
638 event EstateRestartSimRequest OnEstateRestartSimRequest;
639 event EstateChangeCovenantRequest OnEstateChangeCovenantRequest;
640 event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest;
641 event SimulatorBlueBoxMessageRequest OnSimulatorBlueBoxMessageRequest;
642 event EstateBlueBoxMessageRequest OnEstateBlueBoxMessageRequest;
643 event EstateDebugRegionRequest OnEstateDebugRegionRequest;
644 event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
645
646
647
648
616 void OutPacket(Packet newPack, ThrottleOutPacketType packType); 649 void OutPacket(Packet newPack, ThrottleOutPacketType packType);
617 void SendWearables(AvatarWearable[] wearables, int serial); 650 void SendWearables(AvatarWearable[] wearables, int serial);
618 void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry); 651 void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry);
@@ -731,6 +764,11 @@ namespace OpenSim.Framework
731 void SendScriptQuestion(LLUUID taskID, string taskName, string ownerName, LLUUID itemID, int question); 764 void SendScriptQuestion(LLUUID taskID, string taskName, string ownerName, LLUUID itemID, int question);
732 void SendHealth(float health); 765 void SendHealth(float health);
733 766
767
768 void sendEstateManagersList(LLUUID invoice);
769 void sendRegionInfoToEstateMenu();
770 void sendEstateCovenantInformation();
771
734 byte[] GetThrottlesPacked(float multiplier); 772 byte[] GetThrottlesPacked(float multiplier);
735 773
736 774
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index c890b31..7ca5050 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -214,7 +214,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
214 private ParcelPropertiesUpdateRequest handlerParcelPropertiesUpdateRequest = null; //OnParcelPropertiesUpdateRequest; 214 private ParcelPropertiesUpdateRequest handlerParcelPropertiesUpdateRequest = null; //OnParcelPropertiesUpdateRequest;
215 private ParcelSelectObjects handlerParcelSelectObjects = null; //OnParcelSelectObjects; 215 private ParcelSelectObjects handlerParcelSelectObjects = null; //OnParcelSelectObjects;
216 private ParcelObjectOwnerRequest handlerParcelObjectOwnerRequest = null; //OnParcelObjectOwnerRequest; 216 private ParcelObjectOwnerRequest handlerParcelObjectOwnerRequest = null; //OnParcelObjectOwnerRequest;
217 private EstateOwnerMessageRequest handlerEstateOwnerMessage = null; //OnEstateOwnerMessage;
218 private RegionInfoRequest handlerRegionInfoRequest = null; //OnRegionInfoRequest; 217 private RegionInfoRequest handlerRegionInfoRequest = null; //OnRegionInfoRequest;
219 private EstateCovenantRequest handlerEstateCovenantRequest = null; //OnEstateCovenantRequest; 218 private EstateCovenantRequest handlerEstateCovenantRequest = null; //OnEstateCovenantRequest;
220 private RequestGodlikePowers handlerReqGodlikePowers = null; //OnRequestGodlikePowers; 219 private RequestGodlikePowers handlerReqGodlikePowers = null; //OnRequestGodlikePowers;
@@ -781,7 +780,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
781 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; 780 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
782 public event ParcelSelectObjects OnParcelSelectObjects; 781 public event ParcelSelectObjects OnParcelSelectObjects;
783 public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest; 782 public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
784 public event EstateOwnerMessageRequest OnEstateOwnerMessage;
785 public event RegionInfoRequest OnRegionInfoRequest; 783 public event RegionInfoRequest OnRegionInfoRequest;
786 public event EstateCovenantRequest OnEstateCovenantRequest; 784 public event EstateCovenantRequest OnEstateCovenantRequest;
787 785
@@ -803,6 +801,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
803 public event RequestPayPrice OnRequestPayPrice; 801 public event RequestPayPrice OnRequestPayPrice;
804 public event AgentSit OnUndo; 802 public event AgentSit OnUndo;
805 803
804 public event DetailedEstateDataRequest OnDetailedEstateDataRequest;
805 public event SetEstateFlagsRequest OnSetEstateFlagsRequest;
806 public event SetEstateTerrainBaseTexture OnSetEstateTerrainBaseTexture;
807 public event SetEstateTerrainDetailTexture OnSetEstateTerrainDetailTexture;
808 public event SetEstateTerrainTextureHeights OnSetEstateTerrainTextureHeights;
809 public event CommitEstateTerrainTextureRequest OnCommitEstateTerrainTextureRequest;
810 public event SetRegionTerrainSettings OnSetRegionTerrainSettings;
811 public event EstateRestartSimRequest OnEstateRestartSimRequest;
812 public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest;
813 public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest;
814 public event SimulatorBlueBoxMessageRequest OnSimulatorBlueBoxMessageRequest;
815 public event EstateBlueBoxMessageRequest OnEstateBlueBoxMessageRequest;
816 public event EstateDebugRegionRequest OnEstateDebugRegionRequest;
817 public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
818
806 #region Scene/Avatar to Client 819 #region Scene/Avatar to Client
807 820
808 /// <summary> 821 /// <summary>
@@ -2142,6 +2155,93 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2142 2155
2143 #endregion 2156 #endregion
2144 2157
2158 #region Estate Data Sending Methods
2159 private bool convertParamStringToBool(byte[] field)
2160 {
2161 string s = Helpers.FieldToUTF8String(field);
2162 if (s == "1" || s.ToLower() == "y" || s.ToLower() == "yes" || s.ToLower() == "t" || s.ToLower() == "true")
2163 {
2164 return true;
2165 }
2166 return false;
2167 }
2168
2169 public void sendEstateManagersList(LLUUID invoice)
2170 {
2171 EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket();
2172 packet.AgentData.TransactionID = LLUUID.Random();
2173 packet.AgentData.AgentID = this.AgentId;
2174 packet.AgentData.SessionID = this.SessionId;
2175 packet.MethodData.Invoice = invoice;
2176 packet.MethodData.Method = Helpers.StringToField("setaccess");
2177
2178 LLUUID[] EstateManagers = m_scene.RegionInfo.EstateSettings.estateManagers;
2179
2180 EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + EstateManagers.Length];
2181
2182 for (int i = 0; i < (6 + EstateManagers.Length); i++)
2183 {
2184 returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock();
2185 }
2186 int j = 0;
2187
2188 returnblock[j].Parameter = Helpers.StringToField(m_scene.RegionInfo.EstateSettings.estateID.ToString()); j++;
2189 returnblock[j].Parameter = Helpers.StringToField(((int)Constants.EstateAccessCodex.EstateManagers).ToString()); j++;
2190 returnblock[j].Parameter = Helpers.StringToField("0"); j++;
2191 returnblock[j].Parameter = Helpers.StringToField("0"); j++;
2192 returnblock[j].Parameter = Helpers.StringToField("0"); j++;
2193 returnblock[j].Parameter = Helpers.StringToField(EstateManagers.Length.ToString()); j++;
2194 for (int i = 0; i < EstateManagers.Length; i++)
2195 {
2196 returnblock[j].Parameter = EstateManagers[i].GetBytes(); j++;
2197 }
2198 packet.ParamList = returnblock;
2199 packet.Header.Reliable = false;
2200 this.OutPacket(packet, ThrottleOutPacketType.Task);
2201 }
2202
2203 public void sendRegionInfoToEstateMenu()
2204 {
2205 RegionInfoPacket rinfopack = new RegionInfoPacket();
2206 RegionInfoPacket.RegionInfoBlock rinfoblk = new RegionInfoPacket.RegionInfoBlock();
2207 rinfopack.AgentData.AgentID = this.AgentId;
2208 rinfopack.AgentData.SessionID = this.SessionId;
2209 rinfoblk.BillableFactor = m_scene.RegionInfo.EstateSettings.billableFactor;
2210 rinfoblk.EstateID = m_scene.RegionInfo.EstateSettings.estateID;
2211 rinfoblk.MaxAgents = m_scene.RegionInfo.EstateSettings.maxAgents;
2212 rinfoblk.ObjectBonusFactor = m_scene.RegionInfo.EstateSettings.objectBonusFactor;
2213 rinfoblk.ParentEstateID = m_scene.RegionInfo.EstateSettings.parentEstateID;
2214 rinfoblk.PricePerMeter = m_scene.RegionInfo.EstateSettings.pricePerMeter;
2215 rinfoblk.RedirectGridX = m_scene.RegionInfo.EstateSettings.redirectGridX;
2216 rinfoblk.RedirectGridY = m_scene.RegionInfo.EstateSettings.redirectGridY;
2217 rinfoblk.RegionFlags = (uint)(m_scene.RegionInfo.EstateSettings.regionFlags);
2218 rinfoblk.SimAccess = (byte)m_scene.RegionInfo.EstateSettings.simAccess;
2219 rinfoblk.SunHour = m_scene.RegionInfo.EstateSettings.sunHour;
2220 rinfoblk.TerrainLowerLimit = m_scene.RegionInfo.EstateSettings.terrainLowerLimit;
2221 rinfoblk.TerrainRaiseLimit = m_scene.RegionInfo.EstateSettings.terrainRaiseLimit;
2222 rinfoblk.UseEstateSun = !m_scene.RegionInfo.EstateSettings.useFixedSun;
2223 rinfoblk.WaterHeight = m_scene.RegionInfo.EstateSettings.waterHeight;
2224 rinfoblk.SimName = Helpers.StringToField(m_scene.RegionInfo.RegionName);
2225
2226 rinfopack.RegionInfo = rinfoblk;
2227
2228 this.OutPacket(rinfopack, ThrottleOutPacketType.Task);
2229 }
2230
2231 public void sendEstateCovenantInformation()
2232 {
2233 EstateCovenantReplyPacket einfopack = new EstateCovenantReplyPacket();
2234 EstateCovenantReplyPacket.DataBlock edata = new EstateCovenantReplyPacket.DataBlock();
2235 edata.CovenantID = m_scene.RegionInfo.CovenantID;
2236 edata.CovenantTimestamp = 0;
2237 edata.EstateOwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID;
2238 edata.EstateName =
2239 Helpers.StringToField(m_scene.RegionInfo.MasterAvatarFirstName + " " + m_scene.RegionInfo.MasterAvatarLastName);
2240 einfopack.Data = edata;
2241 this.OutPacket(einfopack, ThrottleOutPacketType.Task);
2242 }
2243 #endregion
2244
2145 #region Helper Methods 2245 #region Helper Methods
2146 2246
2147 protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateAvatarImprovedBlock(uint localID, LLVector3 pos, 2247 protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateAvatarImprovedBlock(uint localID, LLVector3 pos,
@@ -4604,11 +4704,199 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4604 case PacketType.EstateOwnerMessage: 4704 case PacketType.EstateOwnerMessage:
4605 EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack; 4705 EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack;
4606 4706
4607 handlerEstateOwnerMessage = OnEstateOwnerMessage;
4608 4707
4609 if (handlerEstateOwnerMessage != null) 4708 switch (Helpers.FieldToUTF8String(messagePacket.MethodData.Method))
4610 { 4709 {
4611 handlerEstateOwnerMessage(messagePacket, this); 4710 case "getinfo":
4711
4712 if (((Scene)m_scene).PermissionsMngr.GenericEstatePermission(this.AgentId))
4713 {
4714 OnDetailedEstateDataRequest(this, messagePacket.MethodData.Invoice);
4715 }
4716 break;
4717 case "setregioninfo":
4718 if (((Scene)m_scene).PermissionsMngr.CanEditEstateTerrain(this.AgentId))
4719 {
4720 OnSetEstateFlagsRequest(convertParamStringToBool(messagePacket.ParamList[0].Parameter),convertParamStringToBool(messagePacket.ParamList[1].Parameter),
4721 convertParamStringToBool(messagePacket.ParamList[2].Parameter), !convertParamStringToBool(messagePacket.ParamList[3].Parameter),
4722 Convert.ToInt16(Convert.ToDecimal(Helpers.FieldToUTF8String(messagePacket.ParamList[4].Parameter))),
4723 (float)Convert.ToDecimal(Helpers.FieldToUTF8String(messagePacket.ParamList[5].Parameter)),
4724 Convert.ToInt16(Helpers.FieldToUTF8String(messagePacket.ParamList[6].Parameter)),
4725 convertParamStringToBool(messagePacket.ParamList[7].Parameter),convertParamStringToBool(messagePacket.ParamList[8].Parameter));
4726
4727 }
4728
4729 break;
4730 case "texturebase":
4731 if (((Scene)m_scene).PermissionsMngr.CanEditEstateTerrain(this.AgentId))
4732 {
4733 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
4734 {
4735 string s = Helpers.FieldToUTF8String(block.Parameter);
4736 string[] splitField = s.Split(' ');
4737 if (splitField.Length == 2)
4738 {
4739 LLUUID tempUUID = new LLUUID(splitField[1]);
4740 OnSetEstateTerrainBaseTexture(this, Convert.ToInt16(splitField[0]), tempUUID);
4741 }
4742 }
4743 }
4744 break;
4745 case "texturedetail":
4746 if (((Scene)m_scene).PermissionsMngr.CanEditEstateTerrain(this.AgentId))
4747 {
4748 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
4749 {
4750 string s = Helpers.FieldToUTF8String(block.Parameter);
4751 string[] splitField = s.Split(' ');
4752 if (splitField.Length == 2)
4753 {
4754 Int16 corner = Convert.ToInt16(splitField[0]);
4755 LLUUID textureUUID = new LLUUID(splitField[1]);
4756
4757 OnSetEstateTerrainDetailTexture(this, corner,textureUUID);
4758 }
4759 }
4760 }
4761
4762 break;
4763 case "textureheights":
4764 if (((Scene)m_scene).PermissionsMngr.CanEditEstateTerrain(this.AgentId))
4765 {
4766 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
4767 {
4768 string s = Helpers.FieldToUTF8String(block.Parameter);
4769 string[] splitField = s.Split(' ');
4770 if (splitField.Length == 3)
4771 {
4772 Int16 corner = Convert.ToInt16(splitField[0]);
4773 float lowValue = (float)Convert.ToDecimal(splitField[1]);
4774 float highValue = (float)Convert.ToDecimal(splitField[2]);
4775
4776 OnSetEstateTerrainTextureHeights(this,corner,lowValue,highValue);
4777 }
4778 }
4779 }
4780 break;
4781 case "texturecommit":
4782 OnCommitEstateTerrainTextureRequest(this);
4783 break;
4784 case "setregionterrain":
4785 if (((Scene)m_scene).PermissionsMngr.CanEditEstateTerrain(this.AgentId))
4786 {
4787 if (messagePacket.ParamList.Length != 9)
4788 {
4789 m_log.Error("EstateOwnerMessage: SetRegionTerrain method has a ParamList of invalid length");
4790 }
4791 else
4792 {
4793 try
4794 {
4795 string tmp;
4796 tmp = Helpers.FieldToUTF8String(messagePacket.ParamList[0].Parameter);
4797 if (!tmp.Contains(".")) tmp += ".00";
4798 float WaterHeight = (float)Convert.ToDecimal(tmp);
4799 tmp = Helpers.FieldToUTF8String(messagePacket.ParamList[1].Parameter);
4800 if (!tmp.Contains(".")) tmp += ".00";
4801 float TerrainRaiseLimit = (float)Convert.ToDecimal(tmp);
4802 tmp = Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter);
4803 if (!tmp.Contains(".")) tmp += ".00";
4804 float TerrainLowerLimit = (float)Convert.ToDecimal(tmp);
4805 bool UseFixedSun = convertParamStringToBool(messagePacket.ParamList[4].Parameter);
4806 float SunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(messagePacket.ParamList[5].Parameter));
4807
4808 OnSetRegionTerrainSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseFixedSun, SunHour);
4809
4810 }
4811 catch (Exception ex)
4812 {
4813 m_log.Error("EstateOwnerMessage: Exception while setting terrain settings: \n" + messagePacket.ToString() + "\n" + ex.ToString());
4814 }
4815 }
4816 }
4817
4818 break;
4819 case "restart":
4820 if (((Scene)m_scene).PermissionsMngr.CanRestartSim(this.AgentId))
4821 {
4822 // There's only 1 block in the estateResetSim.. and that's the number of seconds till restart.
4823 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
4824 {
4825 float timeSeconds = 0;
4826 Helpers.TryParse(Helpers.FieldToUTF8String(block.Parameter), out timeSeconds);
4827 timeSeconds = (int)timeSeconds;
4828 OnEstateRestartSimRequest(this, (int)timeSeconds);
4829
4830 }
4831 }
4832 break;
4833 case "estatechangecovenantid":
4834 if (((Scene)m_scene).PermissionsMngr.CanEditEstateTerrain(this.AgentId))
4835 {
4836 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
4837 {
4838 LLUUID newCovenantID = new LLUUID(Helpers.FieldToUTF8String(block.Parameter));
4839 OnEstateChangeCovenantRequest(this, newCovenantID);
4840 }
4841 }
4842 break;
4843 case "estateaccessdelta": // Estate access delta manages the banlist and allow list too.
4844 if (((Scene)m_scene).PermissionsMngr.GenericEstatePermission(this.AgentId))
4845 {
4846 int estateAccessType = Convert.ToInt16(Helpers.FieldToUTF8String(messagePacket.ParamList[1].Parameter));
4847 OnUpdateEstateAccessDeltaRequest(this, messagePacket.MethodData.Invoice,estateAccessType,new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter)));
4848
4849 }
4850 break;
4851 case "simulatormessage":
4852 if (((Scene)m_scene).PermissionsMngr.GenericEstatePermission(this.AgentId))
4853 {
4854 LLUUID invoice = messagePacket.MethodData.Invoice;
4855 LLUUID SenderID = new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter));
4856 string SenderName = Helpers.FieldToUTF8String(messagePacket.ParamList[3].Parameter);
4857 string Message = Helpers.FieldToUTF8String(messagePacket.ParamList[4].Parameter);
4858 LLUUID sessionID = messagePacket.AgentData.SessionID;
4859 OnSimulatorBlueBoxMessageRequest(this,invoice,SenderID, sessionID, SenderName,Message);
4860 }
4861 break;
4862 case "instantmessage":
4863 if (((Scene)m_scene).PermissionsMngr.GenericEstatePermission(this.AgentId))
4864 {
4865 LLUUID invoice = messagePacket.MethodData.Invoice;
4866 LLUUID SenderID = new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter));
4867 string SenderName = Helpers.FieldToUTF8String(messagePacket.ParamList[3].Parameter);
4868 string Message = Helpers.FieldToUTF8String(messagePacket.ParamList[4].Parameter);
4869 LLUUID sessionID = messagePacket.AgentData.SessionID;
4870 OnEstateBlueBoxMessageRequest(this,invoice,SenderID, sessionID, SenderName,Message);
4871 }
4872 break;
4873 case "setregiondebug":
4874 if (((Scene)m_scene).PermissionsMngr.GenericEstatePermission(this.AgentId))
4875 {
4876 LLUUID invoice = messagePacket.MethodData.Invoice;
4877 LLUUID SenderID = messagePacket.AgentData.AgentID;
4878 bool scripted = convertParamStringToBool(messagePacket.ParamList[0].Parameter);
4879 bool collisionEvents = convertParamStringToBool(messagePacket.ParamList[1].Parameter);
4880 bool physics = convertParamStringToBool(messagePacket.ParamList[2].Parameter);
4881
4882 OnEstateDebugRegionRequest(this, invoice,SenderID,scripted,collisionEvents,physics);
4883 }
4884 break;
4885 case "teleporthomeuser":
4886 if (((Scene)m_scene).PermissionsMngr.GenericEstatePermission(this.AgentId))
4887 {
4888 LLUUID invoice = messagePacket.MethodData.Invoice;
4889 LLUUID SenderID = messagePacket.AgentData.AgentID;
4890 LLUUID Prey = LLUUID.Zero;
4891
4892 Helpers.TryParse(Helpers.FieldToUTF8String(messagePacket.ParamList[1].Parameter), out Prey);
4893
4894 OnEstateTeleportOneUserHomeRequest(this,invoice,SenderID,Prey);
4895 }
4896 break;
4897 default:
4898 m_log.Error("EstateOwnerMessage: Unknown method requested\n" + messagePacket.ToString());
4899 break;
4612 } 4900 }
4613 break; 4901 break;
4614 case PacketType.RequestRegionInfo: 4902 case PacketType.RequestRegionInfo:
@@ -4617,7 +4905,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4617 handlerRegionInfoRequest = OnRegionInfoRequest; 4905 handlerRegionInfoRequest = OnRegionInfoRequest;
4618 if (handlerRegionInfoRequest != null) 4906 if (handlerRegionInfoRequest != null)
4619 { 4907 {
4620 handlerRegionInfoRequest(this, mPacket.SessionID); 4908 handlerRegionInfoRequest(this);
4621 } 4909 }
4622 break; 4910 break;
4623 case PacketType.EstateCovenantRequest: 4911 case PacketType.EstateCovenantRequest:
@@ -4628,7 +4916,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4628 handlerEstateCovenantRequest = OnEstateCovenantRequest; 4916 handlerEstateCovenantRequest = OnEstateCovenantRequest;
4629 if (handlerEstateCovenantRequest != null) 4917 if (handlerEstateCovenantRequest != null)
4630 { 4918 {
4631 handlerEstateCovenantRequest(this, epack.SessionID); 4919 handlerEstateCovenantRequest(this);
4632 } 4920 }
4633 break; 4921 break;
4634 4922
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;
30using System.Reflection; 30using System.Reflection;
31 31
32using libsecondlife; 32using libsecondlife;
33using libsecondlife.Packets;
34using OpenSim.Region.Environment.Interfaces; 33using OpenSim.Region.Environment.Interfaces;
35using OpenSim.Region.Environment.Scenes; 34using OpenSim.Region.Environment.Scenes;
36using OpenSim.Framework; 35using OpenSim.Framework;
@@ -45,64 +44,120 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
45 44
46 private Scene m_scene; 45 private Scene m_scene;
47 46
48 public enum EstateAccessCodex : uint 47
48
49
50 #region Packet Data Responders
51 private void sendDetailedEstateData(IClientAPI remote_client, LLUUID invoice)
49 { 52 {
50 AccessOptions = 17,
51 AllowedGroups = 18,
52 EstateBans = 20,
53 EstateManagers = 24
54 }
55 53
54 EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket();
55 packet.MethodData.Invoice = invoice;
56 packet.AgentData.TransactionID = LLUUID.Random();
57 packet.MethodData.Method = Helpers.StringToField("estateupdateinfo");
58 EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[9];
56 59
57 #region Helper Functions 60 for (int i = 0; i < 9; i++)
61 {
62 returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock();
63 }
58 64
59 private bool convertParamStringToBool(byte[] field) 65 //Sending Estate Settings
66 returnblock[0].Parameter = Helpers.StringToField(m_scene.RegionInfo.EstateSettings.estateName);
67 returnblock[1].Parameter = Helpers.StringToField(m_scene.RegionInfo.MasterAvatarAssignedUUID.ToString());
68 returnblock[2].Parameter = Helpers.StringToField(m_scene.RegionInfo.EstateSettings.estateID.ToString());
69
70 // TODO: Resolve Magic numbers here
71 returnblock[3].Parameter = Helpers.StringToField("269516800");
72 returnblock[4].Parameter = Helpers.StringToField("0");
73 returnblock[5].Parameter = Helpers.StringToField("1");
74 returnblock[6].Parameter = Helpers.StringToField(m_scene.RegionInfo.RegionID.ToString());
75 returnblock[7].Parameter = Helpers.StringToField("1160895077");
76 returnblock[8].Parameter = Helpers.StringToField("1");
77
78 packet.ParamList = returnblock;
79 packet.Header.Reliable = false;
80 //System.Console.WriteLine("[ESTATE]: SIM--->" + packet.ToString());
81 remote_client.OutPacket(packet, ThrottleOutPacketType.Task);
82
83 remote_client.sendEstateManagersList(invoice);
84
85 }
86
87 private void estateSetRegionInfoHandler(bool blockTerraform, bool noFly, bool allowDamage, bool blockLandResell, int maxAgents, float objectBonusFactor, int matureLevel, bool restrictPushObject, bool allowParcelChanges)
60 { 88 {
61 string s = Helpers.FieldToUTF8String(field); 89
62 if (s == "1" || s.ToLower() == "y" || s.ToLower() == "yes" || s.ToLower() == "t" || s.ToLower() == "true") 90 m_scene.RegionInfo.EstateSettings.regionFlags = Simulator.RegionFlags.None;
91
92 if (blockTerraform)
93 {
94 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags |
95 Simulator.RegionFlags.BlockTerraform;
96 }
97
98 if (noFly)
63 { 99 {
64 return true; 100 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags |
101 Simulator.RegionFlags.NoFly;
65 } 102 }
66 return false; 103
104 if (allowDamage)
105 {
106 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags |
107 Simulator.RegionFlags.AllowDamage;
108 }
109
110 if (blockLandResell)
111 {
112 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags |
113 Simulator.RegionFlags.BlockLandResell;
114 }
115
116 m_scene.RegionInfo.EstateSettings.maxAgents = (byte)maxAgents;
117
118 m_scene.RegionInfo.EstateSettings.objectBonusFactor = objectBonusFactor;
119
120 m_scene.RegionInfo.EstateSettings.simAccess = (Simulator.SimAccess)matureLevel;
121
122
123 if (restrictPushObject)
124 {
125 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags |
126 Simulator.RegionFlags.RestrictPushObject;
127 }
128
129 if (allowParcelChanges)
130 {
131 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags |
132 Simulator.RegionFlags.AllowParcelChanges;
133 }
134
135 sendRegionInfoPacketToAll();
136
67 } 137 }
68 138
69 /// <summary> 139 public void setEstateTerrainBaseTexture(IClientAPI remoteClient, int corner, LLUUID texture)
70 /// Sets terrain texture heights for each of the four corners of the region - textures are distributed as a linear range between the two heights.
71 /// </summary>
72 /// <param name="corner">Which corner</param>
73 /// <param name="lowValue">Minimum height that texture range should cover</param>
74 /// <param name="highValue">Maximum height that texture range should cover</param>
75 public void setEstateTextureRange(Int16 corner, float lowValue, float highValue)
76 { 140 {
77 switch (corner) 141 switch (corner)
78 { 142 {
79 case 0: 143 case 0:
80 m_scene.RegionInfo.EstateSettings.terrainStartHeight0 = lowValue; 144 m_scene.RegionInfo.EstateSettings.terrainBase0 = texture;
81 m_scene.RegionInfo.EstateSettings.terrainHeightRange0 = highValue;
82 break; 145 break;
83 case 1: 146 case 1:
84 m_scene.RegionInfo.EstateSettings.terrainStartHeight1 = lowValue; 147 m_scene.RegionInfo.EstateSettings.terrainBase1 = texture;
85 m_scene.RegionInfo.EstateSettings.terrainHeightRange1 = highValue;
86 break; 148 break;
87 case 2: 149 case 2:
88 m_scene.RegionInfo.EstateSettings.terrainStartHeight2 = lowValue; 150 m_scene.RegionInfo.EstateSettings.terrainBase2 = texture;
89 m_scene.RegionInfo.EstateSettings.terrainHeightRange2 = highValue;
90 break; 151 break;
91 case 3: 152 case 3:
92 m_scene.RegionInfo.EstateSettings.terrainStartHeight3 = lowValue; 153 m_scene.RegionInfo.EstateSettings.terrainBase3 = texture;
93 m_scene.RegionInfo.EstateSettings.terrainHeightRange3 = highValue;
94 break; 154 break;
95 } 155 }
96 } 156 }
97 157
98 /// <summary> 158 public void setEstateTerrainDetailTexture(IClientAPI client, int corner, LLUUID textureUUID)
99 /// Sets the 'detail' terrain texture on each of the bands.
100 /// </summary>
101 /// <param name="band">Which texture band</param>
102 /// <param name="textureUUID">The UUID of the texture</param>
103 public void setTerrainTexture(Int16 band, LLUUID textureUUID)
104 { 159 {
105 switch (band) 160 switch (corner)
106 { 161 {
107 case 0: 162 case 0:
108 m_scene.RegionInfo.EstateSettings.terrainDetail0 = textureUUID; 163 m_scene.RegionInfo.EstateSettings.terrainDetail0 = textureUUID;
@@ -119,260 +174,67 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
119 } 174 }
120 } 175 }
121 176
122 /// <summary> 177 public void setEstateTerrainTextureHeights(IClientAPI client, int corner, float lowValue, float highValue)
123 /// Sets common region settings
124 /// </summary>
125 /// <param name="WaterHeight">Water height of the waterplane (may not nessecarily be one value)</param>
126 /// <param name="TerrainRaiseLimit">Maximum amount terrain can be raised from previous baking</param>
127 /// <param name="TerrainLowerLimit">Minimum amount terrain can be lowered from previous baking</param>
128 /// <param name="UseFixedSun">Use a fixed time of day on the sun?</param>
129 /// <param name="SunHour">The offset hour of the day</param>
130 public void setRegionSettings(float WaterHeight, float TerrainRaiseLimit, float TerrainLowerLimit,
131 bool UseFixedSun, float SunHour)
132 {
133 // Water Height
134 m_scene.RegionInfo.EstateSettings.waterHeight = WaterHeight;
135
136 // Terraforming limits
137 m_scene.RegionInfo.EstateSettings.terrainRaiseLimit = TerrainRaiseLimit;
138 m_scene.RegionInfo.EstateSettings.terrainLowerLimit = TerrainLowerLimit;
139
140 // Time of day / fixed sun
141 m_scene.RegionInfo.EstateSettings.useFixedSun = UseFixedSun;
142 m_scene.RegionInfo.EstateSettings.sunHour = SunHour;
143 }
144 #endregion
145
146 #region Packet Handlers
147
148 public void handleEstateOwnerMessage(EstateOwnerMessagePacket packet, IClientAPI remote_client)
149 { 178 {
150 switch (Helpers.FieldToUTF8String(packet.MethodData.Method)) 179 switch (corner)
151 { 180 {
152 case "getinfo": 181 case 0:
153 182 m_scene.RegionInfo.EstateSettings.terrainStartHeight0 = lowValue;
154 //System.Console.WriteLine("[ESTATE]: CLIENT--->" + packet.ToString()); 183 m_scene.RegionInfo.EstateSettings.terrainHeightRange0 = highValue;
155 //sendRegionInfoPacketToAll();
156 if (m_scene.PermissionsMngr.GenericEstatePermission(remote_client.AgentId))
157 {
158 sendDetailedEstateData(remote_client, packet);
159 }
160 break;
161 case "setregioninfo":
162 if (m_scene.PermissionsMngr.CanEditEstateTerrain(remote_client.AgentId))
163 estateSetRegionInfoHandler(packet);
164 break;
165 case "texturebase":
166 if (m_scene.PermissionsMngr.CanEditEstateTerrain(remote_client.AgentId))
167 estateTextureBaseHandler(packet);
168 break;
169 case "texturedetail":
170 if (m_scene.PermissionsMngr.CanEditEstateTerrain(remote_client.AgentId))
171 estateTextureDetailHandler(packet);
172 break;
173 case "textureheights":
174 if (m_scene.PermissionsMngr.CanEditEstateTerrain(remote_client.AgentId))
175 estateTextureHeightsHandler(packet);
176 break;
177 case "texturecommit":
178 sendRegionHandshakeToAll();
179 break;
180 case "setregionterrain":
181 if (m_scene.PermissionsMngr.CanEditEstateTerrain(remote_client.AgentId))
182 estateSetRegionTerrainHandler(packet);
183 break;
184 case "restart":
185 if (m_scene.PermissionsMngr.CanRestartSim(remote_client.AgentId))
186 {
187 estateRestartSim(packet);
188 }
189 break;
190 case "estatechangecovenantid":
191 if (m_scene.PermissionsMngr.CanEditEstateTerrain(remote_client.AgentId))
192 {
193 EstateChangeCovenant(packet);
194 }
195 break;
196 case "estateaccessdelta": // Estate access delta manages the banlist and allow list too.
197 if (m_scene.PermissionsMngr.GenericEstatePermission(remote_client.AgentId))
198 {
199 estateAccessDelta(remote_client, packet);
200 }
201 break;
202 case "simulatormessage":
203 if (m_scene.PermissionsMngr.GenericEstatePermission(remote_client.AgentId))
204 {
205 SendSimulatorBlueBoxMessage(remote_client, packet);
206 }
207 break;
208 case "instantmessage":
209 if (m_scene.PermissionsMngr.GenericEstatePermission(remote_client.AgentId))
210 {
211 SendEstateBlueBoxMessage(remote_client, packet);
212 }
213 break; 184 break;
214 case "setregiondebug": 185 case 1:
215 if (m_scene.PermissionsMngr.GenericEstatePermission(remote_client.AgentId)) 186 m_scene.RegionInfo.EstateSettings.terrainStartHeight1 = lowValue;
216 { 187 m_scene.RegionInfo.EstateSettings.terrainHeightRange1 = highValue;
217 SetRegionDebug(remote_client, packet);
218 }
219 break; 188 break;
220 case "teleporthomeuser": 189 case 2:
221 if (m_scene.PermissionsMngr.GenericEstatePermission(remote_client.AgentId)) 190 m_scene.RegionInfo.EstateSettings.terrainStartHeight2 = lowValue;
222 { 191 m_scene.RegionInfo.EstateSettings.terrainHeightRange2 = highValue;
223 TeleportOneUserHome(remote_client, packet);
224 }
225 break; 192 break;
226 default: 193 case 3:
227 m_log.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString()); 194 m_scene.RegionInfo.EstateSettings.terrainStartHeight3 = lowValue;
195 m_scene.RegionInfo.EstateSettings.terrainHeightRange3 = highValue;
228 break; 196 break;
229 } 197 }
230
231
232 } 198 }
233 199
234 private void TeleportOneUserHome(object remove_client, EstateOwnerMessagePacket packet) 200 private void handleCommitEstateTerrainTextureRequest(IClientAPI remoteClient)
235 { 201 {
236 LLUUID invoice = packet.MethodData.Invoice; 202 sendRegionHandshakeToAll();
237 LLUUID SenderID = packet.AgentData.AgentID;
238 LLUUID Prey = LLUUID.Zero;
239
240 Helpers.TryParse(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter), out Prey);
241 if (Prey != LLUUID.Zero)
242 {
243 ScenePresence s = m_scene.GetScenePresence(Prey);
244 if (s != null)
245 {
246 m_scene.TeleportClientHome(Prey, s.ControllingClient);
247 }
248 }
249 } 203 }
250 204
251 private void SetRegionDebug(IClientAPI remote_client, EstateOwnerMessagePacket packet) 205 public void setRegionTerrainSettings(float WaterHeight, float TerrainRaiseLimit, float TerrainLowerLimit,
206 bool UseFixedSun, float SunHour)
252 { 207 {
253 LLUUID invoice = packet.MethodData.Invoice; 208 // Water Height
254 LLUUID SenderID = packet.AgentData.AgentID; 209 m_scene.RegionInfo.EstateSettings.waterHeight = WaterHeight;
255 bool scripted = convertParamStringToBool(packet.ParamList[0].Parameter);
256 bool collisionEvents = convertParamStringToBool(packet.ParamList[1].Parameter);
257 bool physics = convertParamStringToBool(packet.ParamList[2].Parameter);
258
259 if (physics)
260 {
261 m_scene.RegionInfo.EstateSettings.regionFlags |= Simulator.RegionFlags.SkipPhysics;
262 }
263 else
264 {
265 m_scene.RegionInfo.EstateSettings.regionFlags &= ~Simulator.RegionFlags.SkipPhysics;
266 }
267
268 if (scripted)
269 {
270 m_scene.RegionInfo.EstateSettings.regionFlags |= Simulator.RegionFlags.SkipScripts;
271 }
272 else
273 {
274 m_scene.RegionInfo.EstateSettings.regionFlags &= ~Simulator.RegionFlags.SkipScripts;
275 }
276
277 210
278 m_scene.SetSceneCoreDebug(scripted, collisionEvents, physics); 211 // Terraforming limits
279 } 212 m_scene.RegionInfo.EstateSettings.terrainRaiseLimit = TerrainRaiseLimit;
213 m_scene.RegionInfo.EstateSettings.terrainLowerLimit = TerrainLowerLimit;
280 214
281 private void SendSimulatorBlueBoxMessage(IClientAPI remote_client, EstateOwnerMessagePacket packet) 215 // Time of day / fixed sun
282 { 216 m_scene.RegionInfo.EstateSettings.useFixedSun = UseFixedSun;
283 LLUUID invoice = packet.MethodData.Invoice; 217 m_scene.RegionInfo.EstateSettings.sunHour = SunHour;
284 LLUUID SenderID = new LLUUID(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter));
285 string SenderName = Helpers.FieldToUTF8String(packet.ParamList[3].Parameter);
286 string Message = Helpers.FieldToUTF8String(packet.ParamList[4].Parameter);
287 m_scene.SendRegionMessageFromEstateTools(SenderID, packet.AgentData.SessionID, SenderName, Message);
288 218
219 sendRegionInfoPacketToAll();
289 } 220 }
290 private void SendEstateBlueBoxMessage(IClientAPI remote_client, EstateOwnerMessagePacket packet)
291 {
292 LLUUID invoice = packet.MethodData.Invoice;
293 LLUUID SenderID = packet.AgentData.AgentID;
294 string SenderName = Helpers.FieldToUTF8String(packet.ParamList[0].Parameter);
295 string Message = Helpers.FieldToUTF8String(packet.ParamList[1].Parameter);
296 m_scene.SendEstateMessageFromEstateTools(SenderID, packet.AgentData.SessionID, SenderName, Message);
297 221
298 } 222 private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds)
299 private void sendDetailedEstateData(IClientAPI remote_client, EstateOwnerMessagePacket packet)
300 { 223 {
301 224 m_scene.Restart(timeInSeconds);
302 LLUUID invoice = packet.MethodData.Invoice;
303 packet.AgentData.TransactionID = LLUUID.Random();
304 packet.MethodData.Method = Helpers.StringToField("estateupdateinfo");
305 EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[9];
306
307 for (int i = 0; i < 9; i++)
308 {
309 returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock();
310 }
311
312 //Sending Estate Settings
313 returnblock[0].Parameter = Helpers.StringToField(m_scene.RegionInfo.EstateSettings.estateName);
314 returnblock[1].Parameter = Helpers.StringToField(m_scene.RegionInfo.MasterAvatarAssignedUUID.ToString());
315 returnblock[2].Parameter = Helpers.StringToField(m_scene.RegionInfo.EstateSettings.estateID.ToString());
316
317 // TODO: Resolve Magic numbers here
318 returnblock[3].Parameter = Helpers.StringToField("269516800");
319 returnblock[4].Parameter = Helpers.StringToField("0");
320 returnblock[5].Parameter = Helpers.StringToField("1");
321 returnblock[6].Parameter = Helpers.StringToField(m_scene.RegionInfo.RegionID.ToString());
322 returnblock[7].Parameter = Helpers.StringToField("1160895077");
323 returnblock[8].Parameter = Helpers.StringToField("1");
324
325 packet.ParamList = returnblock;
326 packet.Header.Reliable = false;
327 //System.Console.WriteLine("[ESTATE]: SIM--->" + packet.ToString());
328 remote_client.OutPacket(packet, ThrottleOutPacketType.Task);
329
330 sendEstateManagerList(remote_client, packet);
331
332 } 225 }
333 226
334 private void sendEstateManagerList(IClientAPI remote_client, EstateOwnerMessagePacket packet) 227 private void handleChangeEstateCovenantRequest(IClientAPI remoteClient, LLUUID estateCovenantID)
335 { 228 {
336 LLUUID invoice = packet.MethodData.Invoice;
337
338 //Sending Estate Managers
339 packet = new EstateOwnerMessagePacket();
340 packet.AgentData.TransactionID = LLUUID.Random();
341 packet.AgentData.AgentID = remote_client.AgentId;
342 packet.AgentData.SessionID = remote_client.SessionId;
343 packet.MethodData.Invoice = invoice;
344 packet.MethodData.Method = Helpers.StringToField("setaccess");
345 229
346 LLUUID[] EstateManagers = m_scene.RegionInfo.EstateSettings.estateManagers; 230 m_scene.RegionInfo.CovenantID = estateCovenantID;
231 m_scene.RegionInfo.SaveEstatecovenantUUID(estateCovenantID);
347 232
348 EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + EstateManagers.Length];
349
350 for (int i = 0; i < (6 + EstateManagers.Length); i++)
351 {
352 returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock();
353 }
354 int j = 0;
355
356 returnblock[j].Parameter = Helpers.StringToField(m_scene.RegionInfo.EstateSettings.estateID.ToString()); j++;
357 returnblock[j].Parameter = Helpers.StringToField(((int)EstateAccessCodex.EstateManagers).ToString()); j++;
358 returnblock[j].Parameter = Helpers.StringToField("0"); j++;
359 returnblock[j].Parameter = Helpers.StringToField("0"); j++;
360 returnblock[j].Parameter = Helpers.StringToField("0"); j++;
361 returnblock[j].Parameter = Helpers.StringToField(EstateManagers.Length.ToString()); j++;
362 for (int i = 0; i < EstateManagers.Length; i++)
363 {
364 returnblock[j].Parameter = EstateManagers[i].GetBytes(); j++;
365 }
366 packet.ParamList = returnblock;
367 packet.Header.Reliable = false;
368 //System.Console.WriteLine("[ESTATE]: SIM--->" + packet.ToString());
369 remote_client.OutPacket(packet, ThrottleOutPacketType.Task);
370 } 233 }
371 234
372 private void estateAccessDelta(IClientAPI remote_client, EstateOwnerMessagePacket packet) 235 private void handleEstateAccessDeltaRequest(IClientAPI remote_client, LLUUID invoice, int estateAccessType, LLUUID user)
373 { 236 {
374 // EstateAccessDelta handles Estate Managers, Sim Access, Sim Banlist, allowed Groups.. etc. 237 // EstateAccessDelta handles Estate Managers, Sim Access, Sim Banlist, allowed Groups.. etc.
375 int estateAccessType = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter));
376 238
377 switch (estateAccessType) 239 switch (estateAccessType)
378 { 240 {
@@ -380,10 +242,10 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
380 242
381 // This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml 243 // This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml
382 // So make sure you really trust your region owners. because they can add other estate manaagers to your other estates 244 // So make sure you really trust your region owners. because they can add other estate manaagers to your other estates
383 if (packet.AgentData.AgentID == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.PermissionsMngr.BypassPermissions) 245 if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.PermissionsMngr.BypassPermissions)
384 { 246 {
385 m_scene.RegionInfo.EstateSettings.AddEstateManager(new LLUUID(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter))); 247 m_scene.RegionInfo.EstateSettings.AddEstateManager(user);
386 sendEstateManagerList(remote_client, packet); 248 remote_client.sendEstateManagersList(invoice);
387 } 249 }
388 else 250 else
389 { 251 {
@@ -394,10 +256,10 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
394 case 512: 256 case 512:
395 // This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml 257 // This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml
396 // So make sure you really trust your region owners. because they can add other estate manaagers to your other estates 258 // So make sure you really trust your region owners. because they can add other estate manaagers to your other estates
397 if (packet.AgentData.AgentID == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.PermissionsMngr.BypassPermissions) 259 if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.PermissionsMngr.BypassPermissions)
398 { 260 {
399 m_scene.RegionInfo.EstateSettings.RemoveEstateManager(new LLUUID(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter))); 261 m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user);
400 sendEstateManagerList(remote_client, packet); 262 remote_client.sendEstateManagersList(invoice);
401 } 263 }
402 else 264 else
403 { 265 {
@@ -407,236 +269,73 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
407 269
408 default: 270 default:
409 271
410 m_log.Error("EstateOwnerMessage: Unknown EstateAccessType requested in estateAccessDelta\n" + packet.ToString()); 272 m_log.Error("EstateOwnerMessage: Unknown EstateAccessType requested in estateAccessDelta");
411 break; 273 break;
412 } 274 }
413 //m_log.Error("EstateOwnerMessage: estateAccessDelta\n" + packet.ToString()); 275 }
414 276
277 private void SendSimulatorBlueBoxMessage(IClientAPI remote_client, LLUUID invoice, LLUUID senderID, LLUUID sessionID, string senderName, string message)
278 {
279 m_scene.SendRegionMessageFromEstateTools(senderID, sessionID, senderName, message);
415 280
416 } 281 }
417 private void estateSetRegionInfoHandler(EstateOwnerMessagePacket packet) 282 private void SendEstateBlueBoxMessage(IClientAPI remote_client, LLUUID invoice, LLUUID senderID, LLUUID sessionID, string senderName, string message)
418 { 283 {
419 if (packet.ParamList.Length != 9) 284 m_scene.SendEstateMessageFromEstateTools(senderID, sessionID, senderName, message);
420 {
421 m_log.Error("EstateOwnerMessage: SetRegionInfo method has a ParamList of invalid length");
422 }
423 else
424 {
425 m_scene.RegionInfo.EstateSettings.regionFlags = Simulator.RegionFlags.None;
426
427 if (convertParamStringToBool(packet.ParamList[0].Parameter))
428 {
429 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags |
430 Simulator.RegionFlags.BlockTerraform;
431 }
432
433 if (convertParamStringToBool(packet.ParamList[1].Parameter))
434 {
435 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags |
436 Simulator.RegionFlags.NoFly;
437 }
438
439 if (convertParamStringToBool(packet.ParamList[2].Parameter))
440 {
441 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags |
442 Simulator.RegionFlags.AllowDamage;
443 }
444
445 if (convertParamStringToBool(packet.ParamList[3].Parameter) == false)
446 {
447 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags |
448 Simulator.RegionFlags.BlockLandResell;
449 }
450
451
452 int tempMaxAgents =
453 Convert.ToInt16(Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[4].Parameter)));
454 m_scene.RegionInfo.EstateSettings.maxAgents = (byte)tempMaxAgents;
455
456 float tempObjectBonusFactor =
457 (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
458 m_scene.RegionInfo.EstateSettings.objectBonusFactor = tempObjectBonusFactor;
459
460 int tempMatureLevel = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[6].Parameter));
461 m_scene.RegionInfo.EstateSettings.simAccess = (Simulator.SimAccess)tempMatureLevel;
462
463
464 if (convertParamStringToBool(packet.ParamList[7].Parameter))
465 {
466 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags |
467 Simulator.RegionFlags.RestrictPushObject;
468 }
469
470 if (convertParamStringToBool(packet.ParamList[8].Parameter))
471 {
472 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags |
473 Simulator.RegionFlags.AllowParcelChanges;
474 }
475
476 sendRegionInfoPacketToAll();
477 }
478 } 285 }
479 286
480 private void estateSetRegionTerrainHandler(EstateOwnerMessagePacket packet) 287 private void handleEstateDebugRegionRequest(IClientAPI remote_client, LLUUID invoice, LLUUID senderID, bool scripted, bool collisionEvents, bool physics)
481 { 288 {
482 if (packet.ParamList.Length != 9) 289
290
291 if (physics)
483 { 292 {
484 m_log.Error("EstateOwnerMessage: SetRegionTerrain method has a ParamList of invalid length"); 293 m_scene.RegionInfo.EstateSettings.regionFlags |= Simulator.RegionFlags.SkipPhysics;
485 } 294 }
486 else 295 else
487 { 296 {
488 try 297 m_scene.RegionInfo.EstateSettings.regionFlags &= ~Simulator.RegionFlags.SkipPhysics;
489 {
490 string tmp;
491 tmp = Helpers.FieldToUTF8String(packet.ParamList[0].Parameter);
492 if (!tmp.Contains(".")) tmp += ".00";
493 float WaterHeight = (float)Convert.ToDecimal(tmp);
494 tmp = Helpers.FieldToUTF8String(packet.ParamList[1].Parameter);
495 if (!tmp.Contains(".")) tmp += ".00";
496 float TerrainRaiseLimit = (float)Convert.ToDecimal(tmp);
497 tmp = Helpers.FieldToUTF8String(packet.ParamList[2].Parameter);
498 if (!tmp.Contains(".")) tmp += ".00";
499 float TerrainLowerLimit = (float)Convert.ToDecimal(tmp);
500 bool UseFixedSun = convertParamStringToBool(packet.ParamList[4].Parameter);
501 float SunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
502
503 setRegionSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseFixedSun, SunHour);
504
505 sendRegionInfoPacketToAll();
506 }
507 catch (Exception ex)
508 {
509 m_log.Error("EstateManager: Exception while setting terrain settings: \n" + packet.ToString() + "\n" + ex.ToString());
510 }
511 } 298 }
512 }
513 299
514 private void estateTextureHeightsHandler(EstateOwnerMessagePacket packet) 300 if (scripted)
515 {
516 foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList)
517 { 301 {
518 string s = Helpers.FieldToUTF8String(block.Parameter); 302 m_scene.RegionInfo.EstateSettings.regionFlags |= Simulator.RegionFlags.SkipScripts;
519 string[] splitField = s.Split(' ');
520 if (splitField.Length == 3)
521 {
522 Int16 corner = Convert.ToInt16(splitField[0]);
523 float lowValue = (float)Convert.ToDecimal(splitField[1]);
524 float highValue = (float)Convert.ToDecimal(splitField[2]);
525
526 setEstateTextureRange(corner, lowValue, highValue);
527 }
528 } 303 }
529 } 304 else
530
531 private void estateTextureDetailHandler(EstateOwnerMessagePacket packet)
532 {
533 foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList)
534 { 305 {
535 string s = Helpers.FieldToUTF8String(block.Parameter); 306 m_scene.RegionInfo.EstateSettings.regionFlags &= ~Simulator.RegionFlags.SkipScripts;
536 string[] splitField = s.Split(' ');
537 if (splitField.Length == 2)
538 {
539 Int16 corner = Convert.ToInt16(splitField[0]);
540 LLUUID textureUUID = new LLUUID(splitField[1]);
541
542 setTerrainTexture(corner, textureUUID);
543 }
544 } 307 }
308
309
310 m_scene.SetSceneCoreDebug(scripted, collisionEvents, physics);
545 } 311 }
546 312
547 private void estateTextureBaseHandler(EstateOwnerMessagePacket packet) 313 private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, LLUUID invoice, LLUUID senderID, LLUUID prey)
548 { 314 {
549 foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) 315
316 if (prey != LLUUID.Zero)
550 { 317 {
551 string s = Helpers.FieldToUTF8String(block.Parameter); 318 ScenePresence s = m_scene.GetScenePresence(prey);
552 string[] splitField = s.Split(' '); 319 if (s != null)
553 if (splitField.Length == 2)
554 { 320 {
555 LLUUID tempUUID = new LLUUID(splitField[1]); 321 m_scene.TeleportClientHome(prey, s.ControllingClient);
556 switch (Convert.ToInt16(splitField[0]))
557 {
558 case 0:
559 m_scene.RegionInfo.EstateSettings.terrainBase0 = tempUUID;
560 break;
561 case 1:
562 m_scene.RegionInfo.EstateSettings.terrainBase1 = tempUUID;
563 break;
564 case 2:
565 m_scene.RegionInfo.EstateSettings.terrainBase2 = tempUUID;
566 break;
567 case 3:
568 m_scene.RegionInfo.EstateSettings.terrainBase3 = tempUUID;
569 break;
570 }
571 } 322 }
572 } 323 }
573 } 324 }
574 325
575 private void estateRestartSim(EstateOwnerMessagePacket packet) 326 private void HandleRegionInfoRequest(IClientAPI remote_client)
576 { 327 {
577 // There's only 1 block in the estateResetSim.. and that's the number of seconds till restart. 328 remote_client.sendRegionInfoToEstateMenu();
578 foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList)
579 {
580 float timeSeconds = 0;
581 Helpers.TryParse(Helpers.FieldToUTF8String(block.Parameter), out timeSeconds);
582 timeSeconds = (int)timeSeconds;
583 m_scene.Restart(timeSeconds);
584
585 }
586 } 329 }
587 330
588 private void EstateChangeCovenant(EstateOwnerMessagePacket packet) 331 private void HandleEstateCovenantRequest(IClientAPI remote_client)
589 { 332 {
590 foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) 333 remote_client.sendEstateCovenantInformation();
591 {
592 LLUUID newCovenantID = new LLUUID(Helpers.FieldToUTF8String(block.Parameter));
593 m_scene.RegionInfo.CovenantID = newCovenantID;
594 m_scene.RegionInfo.SaveEstatecovenantUUID(newCovenantID);
595 }
596 } 334 }
597 335
598 public void HandleRegionInfoRequest(IClientAPI client, LLUUID sessionID)
599 {
600 RegionInfoPacket rinfopack = new RegionInfoPacket();
601 RegionInfoPacket.RegionInfoBlock rinfoblk = new RegionInfoPacket.RegionInfoBlock();
602 rinfopack.AgentData.AgentID = client.AgentId;
603 rinfopack.AgentData.SessionID = client.SessionId;
604 rinfoblk.BillableFactor = m_scene.RegionInfo.EstateSettings.billableFactor;
605 rinfoblk.EstateID = m_scene.RegionInfo.EstateSettings.estateID;
606 rinfoblk.MaxAgents = m_scene.RegionInfo.EstateSettings.maxAgents;
607 rinfoblk.ObjectBonusFactor = m_scene.RegionInfo.EstateSettings.objectBonusFactor;
608 rinfoblk.ParentEstateID = m_scene.RegionInfo.EstateSettings.parentEstateID;
609 rinfoblk.PricePerMeter = m_scene.RegionInfo.EstateSettings.pricePerMeter;
610 rinfoblk.RedirectGridX = m_scene.RegionInfo.EstateSettings.redirectGridX;
611 rinfoblk.RedirectGridY = m_scene.RegionInfo.EstateSettings.redirectGridY;
612 rinfoblk.RegionFlags = (uint)(m_scene.RegionInfo.EstateSettings.regionFlags);
613 rinfoblk.SimAccess = (byte)m_scene.RegionInfo.EstateSettings.simAccess;
614 rinfoblk.SunHour = m_scene.RegionInfo.EstateSettings.sunHour;
615 rinfoblk.TerrainLowerLimit = m_scene.RegionInfo.EstateSettings.terrainLowerLimit;
616 rinfoblk.TerrainRaiseLimit = m_scene.RegionInfo.EstateSettings.terrainRaiseLimit;
617 rinfoblk.UseEstateSun = !m_scene.RegionInfo.EstateSettings.useFixedSun;
618 rinfoblk.WaterHeight = m_scene.RegionInfo.EstateSettings.waterHeight;
619 rinfoblk.SimName = Helpers.StringToField(m_scene.RegionInfo.RegionName);
620
621 rinfopack.RegionInfo = rinfoblk;
622
623 client.OutPacket(rinfopack, ThrottleOutPacketType.Task);
624 }
625 336
626 public void HandleEstateCovenantRequest(IClientAPI client, LLUUID sessionID) 337#endregion
627 {
628 EstateCovenantReplyPacket einfopack = new EstateCovenantReplyPacket();
629 EstateCovenantReplyPacket.DataBlock edata = new EstateCovenantReplyPacket.DataBlock();
630 edata.CovenantID = m_scene.RegionInfo.CovenantID;
631 edata.CovenantTimestamp = 0;
632 edata.EstateOwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID;
633 edata.EstateName =
634 Helpers.StringToField(m_scene.RegionInfo.MasterAvatarFirstName + " " + m_scene.RegionInfo.MasterAvatarLastName);
635 einfopack.Data = edata;
636 client.OutPacket(einfopack, ThrottleOutPacketType.Task);
637 }
638 338
639 #endregion
640 339
641 #region Outgoing Packets 340 #region Outgoing Packets
642 341
@@ -646,9 +345,13 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
646 345
647 for (int i = 0; i < avatars.Count; i++) 346 for (int i = 0; i < avatars.Count; i++)
648 { 347 {
649 sendRegionInfoPacket(avatars[i].ControllingClient); 348 avatars[i].ControllingClient.sendRegionInfoToEstateMenu();
650 } 349 }
651 } 350 }
351 public void sendRegionHandshake(IClientAPI remoteClient)
352 {
353 remoteClient.SendRegionHandshake(m_scene.RegionInfo);
354 }
652 355
653 public void sendRegionHandshakeToAll() 356 public void sendRegionHandshakeToAll()
654 { 357 {
@@ -657,39 +360,6 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
657 ); 360 );
658 } 361 }
659 362
660 public void sendRegionInfoPacket(IClientAPI remote_client)
661 {
662 AgentCircuitData circuitData = remote_client.RequestClientInfo();
663
664 RegionInfoPacket regionInfoPacket = new RegionInfoPacket();
665 regionInfoPacket.AgentData.AgentID = circuitData.AgentID;
666 regionInfoPacket.AgentData.SessionID = circuitData.SessionID;
667 regionInfoPacket.RegionInfo.BillableFactor = m_scene.RegionInfo.EstateSettings.billableFactor;
668 regionInfoPacket.RegionInfo.EstateID = m_scene.RegionInfo.EstateSettings.estateID;
669 regionInfoPacket.RegionInfo.MaxAgents = m_scene.RegionInfo.EstateSettings.maxAgents;
670 regionInfoPacket.RegionInfo.ObjectBonusFactor = m_scene.RegionInfo.EstateSettings.objectBonusFactor;
671 regionInfoPacket.RegionInfo.ParentEstateID = m_scene.RegionInfo.EstateSettings.parentEstateID;
672 regionInfoPacket.RegionInfo.PricePerMeter = m_scene.RegionInfo.EstateSettings.pricePerMeter;
673 regionInfoPacket.RegionInfo.RedirectGridX = m_scene.RegionInfo.EstateSettings.redirectGridX;
674 regionInfoPacket.RegionInfo.RedirectGridY = m_scene.RegionInfo.EstateSettings.redirectGridY;
675 regionInfoPacket.RegionInfo.RegionFlags = (uint)(m_scene.RegionInfo.EstateSettings.regionFlags);
676 regionInfoPacket.RegionInfo.SimAccess = (byte)m_scene.RegionInfo.EstateSettings.simAccess;
677 regionInfoPacket.RegionInfo.SimName = Helpers.StringToField(m_scene.RegionInfo.RegionName);
678 regionInfoPacket.RegionInfo.SunHour = m_scene.RegionInfo.EstateSettings.sunHour;
679 regionInfoPacket.RegionInfo.TerrainLowerLimit = m_scene.RegionInfo.EstateSettings.terrainLowerLimit;
680 regionInfoPacket.RegionInfo.TerrainRaiseLimit = m_scene.RegionInfo.EstateSettings.terrainRaiseLimit;
681 regionInfoPacket.RegionInfo.UseEstateSun = !m_scene.RegionInfo.EstateSettings.useFixedSun;
682 regionInfoPacket.RegionInfo.WaterHeight = m_scene.RegionInfo.EstateSettings.waterHeight;
683
684
685 remote_client.OutPacket(regionInfoPacket, ThrottleOutPacketType.Task);
686 }
687
688 public void sendRegionHandshake(IClientAPI remoteClient)
689 {
690 remoteClient.SendRegionHandshake(m_scene.RegionInfo);
691 }
692
693 #endregion 363 #endregion
694 364
695 #region IRegionModule Members 365 #region IRegionModule Members
@@ -704,7 +374,21 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
704 374
705 void EventManager_OnNewClient(IClientAPI client) 375 void EventManager_OnNewClient(IClientAPI client)
706 { 376 {
707 client.OnEstateOwnerMessage += handleEstateOwnerMessage; 377 client.OnDetailedEstateDataRequest += sendDetailedEstateData;
378 client.OnSetEstateFlagsRequest += estateSetRegionInfoHandler;
379 client.OnSetEstateTerrainBaseTexture += setEstateTerrainBaseTexture;
380 client.OnSetEstateTerrainDetailTexture += setEstateTerrainDetailTexture;
381 client.OnSetEstateTerrainTextureHeights += setEstateTerrainTextureHeights;
382 client.OnCommitEstateTerrainTextureRequest += handleCommitEstateTerrainTextureRequest;
383 client.OnSetRegionTerrainSettings += setRegionTerrainSettings;
384 client.OnEstateRestartSimRequest += handleEstateRestartSimRequest;
385 client.OnEstateChangeCovenantRequest += handleChangeEstateCovenantRequest;
386 client.OnUpdateEstateAccessDeltaRequest += handleEstateAccessDeltaRequest;
387 client.OnSimulatorBlueBoxMessageRequest += SendSimulatorBlueBoxMessage;
388 client.OnEstateBlueBoxMessageRequest += SendEstateBlueBoxMessage;
389 client.OnEstateDebugRegionRequest += handleEstateDebugRegionRequest;
390 client.OnEstateTeleportOneUserHomeRequest += handleEstateTeleportOneUserHomeRequest;
391
708 client.OnRegionInfoRequest += HandleRegionInfoRequest; 392 client.OnRegionInfoRequest += HandleRegionInfoRequest;
709 client.OnEstateCovenantRequest += HandleEstateCovenantRequest; 393 client.OnEstateCovenantRequest += HandleEstateCovenantRequest;
710 sendRegionHandshake(client); 394 sendRegionHandshake(client);
@@ -735,7 +419,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
735 419
736 public void changeWaterHeight(float height) 420 public void changeWaterHeight(float height)
737 { 421 {
738 setRegionSettings(height, m_scene.RegionInfo.EstateSettings.terrainRaiseLimit, m_scene.RegionInfo.EstateSettings.terrainLowerLimit, m_scene.RegionInfo.EstateSettings.useFixedSun, m_scene.RegionInfo.EstateSettings.sunHour); 422 setRegionTerrainSettings(height, m_scene.RegionInfo.EstateSettings.terrainRaiseLimit, m_scene.RegionInfo.EstateSettings.terrainLowerLimit, m_scene.RegionInfo.EstateSettings.useFixedSun, m_scene.RegionInfo.EstateSettings.sunHour);
739 sendRegionInfoPacketToAll(); 423 sendRegionInfoPacketToAll();
740 } 424 }
741 #endregion 425 #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 @@
28using Nini.Config; 28using Nini.Config;
29using OpenSim.Region.Environment.Interfaces; 29using OpenSim.Region.Environment.Interfaces;
30using OpenSim.Region.Environment.Scenes; 30using OpenSim.Region.Environment.Scenes;
31using OpenSim.Framework;
31 32
32namespace OpenSim.Region.Environment.Modules.World.Land 33namespace OpenSim.Region.Environment.Modules.World.Land
33{ 34{
@@ -49,6 +50,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
49 m_scene.EventManager.OnClientMovement += new EventManager.ClientMovement(landChannel.handleAnyClientMovement); 50 m_scene.EventManager.OnClientMovement += new EventManager.ClientMovement(landChannel.handleAnyClientMovement);
50 m_scene.EventManager.OnValidateLandBuy += landChannel.handleLandValidationRequest; 51 m_scene.EventManager.OnValidateLandBuy += landChannel.handleLandValidationRequest;
51 m_scene.EventManager.OnLandBuy += landChannel.handleLandBuyRequest; 52 m_scene.EventManager.OnLandBuy += landChannel.handleLandBuyRequest;
53 m_scene.EventManager.OnNewClient += new EventManager.OnNewClientDelegate(EventManager_OnNewClient);
52 54
53 lock (m_scene) 55 lock (m_scene)
54 { 56 {
@@ -56,6 +58,19 @@ namespace OpenSim.Region.Environment.Modules.World.Land
56 } 58 }
57 } 59 }
58 60
61 void EventManager_OnNewClient(IClientAPI client)
62 {
63 //Register some client events
64 client.OnParcelPropertiesRequest += new ParcelPropertiesRequest(landChannel.handleParcelPropertiesRequest);
65 client.OnParcelDivideRequest += new ParcelDivideRequest(landChannel.handleParcelDivideRequest);
66 client.OnParcelJoinRequest += new ParcelJoinRequest(landChannel.handleParcelJoinRequest);
67 client.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(landChannel.handleParcelPropertiesUpdateRequest);
68 client.OnParcelSelectObjects += new ParcelSelectObjects(landChannel.handleParcelSelectObjectsRequest);
69 client.OnParcelObjectOwnerRequest += new ParcelObjectOwnerRequest(landChannel.handleParcelObjectOwnersRequest);
70 client.OnParcelAccessListRequest += new ParcelAccessListRequest(landChannel.handleParcelAccessRequest);
71 client.OnParcelAccessListUpdateRequest += new ParcelAccessListUpdateRequest(landChannel.handleParcelAccessUpdateRequest);
72 }
73
59 public void PostInitialise() 74 public void PostInitialise()
60 { 75 {
61 } 76 }
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
1550 client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay; 1550 client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay;
1551 client.OnUpdatePrimFlags += m_innerScene.UpdatePrimFlags; 1551 client.OnUpdatePrimFlags += m_innerScene.UpdatePrimFlags;
1552 client.OnRequestObjectPropertiesFamily += m_innerScene.RequestObjectPropertiesFamily; 1552 client.OnRequestObjectPropertiesFamily += m_innerScene.RequestObjectPropertiesFamily;
1553 client.OnParcelPropertiesRequest += new ParcelPropertiesRequest(LandChannel.handleParcelPropertiesRequest);
1554 client.OnParcelDivideRequest += new ParcelDivideRequest(LandChannel.handleParcelDivideRequest);
1555 client.OnParcelJoinRequest += new ParcelJoinRequest(LandChannel.handleParcelJoinRequest);
1556 client.OnParcelPropertiesUpdateRequest +=
1557 new ParcelPropertiesUpdateRequest(LandChannel.handleParcelPropertiesUpdateRequest);
1558 client.OnParcelSelectObjects += new ParcelSelectObjects(LandChannel.handleParcelSelectObjectsRequest);
1559 client.OnParcelObjectOwnerRequest +=
1560 new ParcelObjectOwnerRequest(LandChannel.handleParcelObjectOwnersRequest);
1561 client.OnParcelAccessListRequest += new ParcelAccessListRequest(LandChannel.handleParcelAccessRequest);
1562 client.OnParcelAccessListUpdateRequest +=
1563 new ParcelAccessListUpdateRequest(LandChannel.handleParcelAccessUpdateRequest);
1564
1565 1553
1566 client.OnRequestGodlikePowers += handleRequestGodlikePowers; 1554 client.OnRequestGodlikePowers += handleRequestGodlikePowers;
1567 client.OnGodKickUser += HandleGodlikeKickUser; 1555 client.OnGodKickUser += HandleGodlikeKickUser;
@@ -1599,7 +1587,7 @@ namespace OpenSim.Region.Environment.Scenes
1599 1587
1600 client.OnSetStartLocationRequest += SetHomeRezPoint; 1588 client.OnSetStartLocationRequest += SetHomeRezPoint;
1601 client.OnUndo += m_innerScene.HandleUndo; 1589 client.OnUndo += m_innerScene.HandleUndo;
1602 1590
1603 EventManager.TriggerOnNewClient(client); 1591 EventManager.TriggerOnNewClient(client);
1604 } 1592 }
1605 public virtual void TeleportClientHome(LLUUID AgentId, IClientAPI client) 1593 public virtual void TeleportClientHome(LLUUID AgentId, IClientAPI client)
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index 25c9093..672e34b 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -151,7 +151,6 @@ namespace OpenSim.Region.Examples.SimpleModule
151 public event ParcelSelectObjects OnParcelSelectObjects; 151 public event ParcelSelectObjects OnParcelSelectObjects;
152 public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest; 152 public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
153 public event ObjectDeselect OnObjectDeselect; 153 public event ObjectDeselect OnObjectDeselect;
154 public event EstateOwnerMessageRequest OnEstateOwnerMessage;
155 public event RegionInfoRequest OnRegionInfoRequest; 154 public event RegionInfoRequest OnRegionInfoRequest;
156 public event EstateCovenantRequest OnEstateCovenantRequest; 155 public event EstateCovenantRequest OnEstateCovenantRequest;
157 156
@@ -173,6 +172,21 @@ namespace OpenSim.Region.Examples.SimpleModule
173 public event RequestPayPrice OnRequestPayPrice; 172 public event RequestPayPrice OnRequestPayPrice;
174 public event AgentSit OnUndo; 173 public event AgentSit OnUndo;
175 174
175 public event DetailedEstateDataRequest OnDetailedEstateDataRequest;
176 public event SetEstateFlagsRequest OnSetEstateFlagsRequest;
177 public event SetEstateTerrainBaseTexture OnSetEstateTerrainBaseTexture;
178 public event SetEstateTerrainDetailTexture OnSetEstateTerrainDetailTexture;
179 public event SetEstateTerrainTextureHeights OnSetEstateTerrainTextureHeights;
180 public event CommitEstateTerrainTextureRequest OnCommitEstateTerrainTextureRequest;
181 public event SetRegionTerrainSettings OnSetRegionTerrainSettings;
182 public event EstateRestartSimRequest OnEstateRestartSimRequest;
183 public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest;
184 public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest;
185 public event SimulatorBlueBoxMessageRequest OnSimulatorBlueBoxMessageRequest;
186 public event EstateBlueBoxMessageRequest OnEstateBlueBoxMessageRequest;
187 public event EstateDebugRegionRequest OnEstateDebugRegionRequest;
188 public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
189
176 190
177#pragma warning restore 67 191#pragma warning restore 67
178 192
@@ -618,5 +632,15 @@ namespace OpenSim.Region.Examples.SimpleModule
618 public void SendHealth(float health) 632 public void SendHealth(float health)
619 { 633 {
620 } 634 }
635
636 public void sendEstateManagersList(LLUUID invoice)
637 {
638 }
639 public void sendRegionInfoToEstateMenu()
640 {
641 }
642 public void sendEstateCovenantInformation()
643 {
644 }
621 } 645 }
622} 646}