aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/World/Estate
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/Estate')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs678
1 files changed, 181 insertions, 497 deletions
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