aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
diff options
context:
space:
mode:
authormingchen2008-05-04 18:59:18 +0000
committermingchen2008-05-04 18:59:18 +0000
commit63c104efde89ce5b05aa448e12bfc8730271ddb5 (patch)
tree2ed7e360fbe6db49de42d51acb4df4b3dda9d0db /OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
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
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs302
1 files changed, 295 insertions, 7 deletions
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