diff options
author | Dr Scofield | 2009-02-10 13:10:57 +0000 |
---|---|---|
committer | Dr Scofield | 2009-02-10 13:10:57 +0000 |
commit | 180be7de07014aa33bc6066f12a0819b731c1c9d (patch) | |
tree | 3aa13af3cda4b808fa9453655875327699b61311 /OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |
parent | Stopgap measure: To use gridlaunch, or GUI, start opensim with (diff) | |
download | opensim-SC_OLD-180be7de07014aa33bc6066f12a0819b731c1c9d.zip opensim-SC_OLD-180be7de07014aa33bc6066f12a0819b731c1c9d.tar.gz opensim-SC_OLD-180be7de07014aa33bc6066f12a0819b731c1c9d.tar.bz2 opensim-SC_OLD-180be7de07014aa33bc6066f12a0819b731c1c9d.tar.xz |
this is step 2 of 2 of the OpenSim.Region.Environment refactor.
NOTHING has been deleted or moved off to forge at this point. what
has happened is that OpenSim.Region.Environment.Modules has been split
in two:
- OpenSim.Region.CoreModules: all those modules that are either
directly or indirectly referenced from other OpenSim packages, or
that provide functionality that the OpenSim developer community
considers core functionality:
CoreModules/Agent/AssetTransaction
CoreModules/Agent/Capabilities
CoreModules/Agent/TextureDownload
CoreModules/Agent/TextureSender
CoreModules/Agent/TextureSender/Tests
CoreModules/Agent/Xfer
CoreModules/Avatar/AvatarFactory
CoreModules/Avatar/Chat/ChatModule
CoreModules/Avatar/Combat
CoreModules/Avatar/Currency/SampleMoney
CoreModules/Avatar/Dialog
CoreModules/Avatar/Friends
CoreModules/Avatar/Gestures
CoreModules/Avatar/Groups
CoreModules/Avatar/InstantMessage
CoreModules/Avatar/Inventory
CoreModules/Avatar/Inventory/Archiver
CoreModules/Avatar/Inventory/Transfer
CoreModules/Avatar/Lure
CoreModules/Avatar/ObjectCaps
CoreModules/Avatar/Profiles
CoreModules/Communications/Local
CoreModules/Communications/REST
CoreModules/Framework/EventQueue
CoreModules/Framework/InterfaceCommander
CoreModules/Hypergrid
CoreModules/InterGrid
CoreModules/Scripting/DynamicTexture
CoreModules/Scripting/EMailModules
CoreModules/Scripting/HttpRequest
CoreModules/Scripting/LoadImageURL
CoreModules/Scripting/VectorRender
CoreModules/Scripting/WorldComm
CoreModules/Scripting/XMLRPC
CoreModules/World/Archiver
CoreModules/World/Archiver/Tests
CoreModules/World/Estate
CoreModules/World/Land
CoreModules/World/Permissions
CoreModules/World/Serialiser
CoreModules/World/Sound
CoreModules/World/Sun
CoreModules/World/Terrain
CoreModules/World/Terrain/DefaultEffects
CoreModules/World/Terrain/DefaultEffects/bin
CoreModules/World/Terrain/DefaultEffects/bin/Debug
CoreModules/World/Terrain/Effects
CoreModules/World/Terrain/FileLoaders
CoreModules/World/Terrain/FloodBrushes
CoreModules/World/Terrain/PaintBrushes
CoreModules/World/Terrain/Tests
CoreModules/World/Vegetation
CoreModules/World/Wind
CoreModules/World/WorldMap
- OpenSim.Region.OptionalModules: all those modules that are not core
modules:
OptionalModules/Avatar/Chat/IRC-stuff
OptionalModules/Avatar/Concierge
OptionalModules/Avatar/Voice/AsterixVoice
OptionalModules/Avatar/Voice/SIPVoice
OptionalModules/ContentManagementSystem
OptionalModules/Grid/Interregion
OptionalModules/Python
OptionalModules/SvnSerialiser
OptionalModules/World/NPC
OptionalModules/World/TreePopulator
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | 1012 |
1 files changed, 1012 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs new file mode 100644 index 0000000..8b15308 --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -0,0 +1,1012 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | using System; | ||
28 | using System.Threading; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using OpenMetaverse; | ||
32 | using log4net; | ||
33 | using Nini.Config; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Region.Framework.Interfaces; | ||
36 | using OpenSim.Region.Framework.Scenes; | ||
37 | |||
38 | namespace OpenSim.Region.CoreModules.World.Estate | ||
39 | { | ||
40 | public class EstateManagementModule : IEstateModule | ||
41 | { | ||
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
43 | |||
44 | private delegate void LookupUUIDS(List<UUID> uuidLst); | ||
45 | |||
46 | private Scene m_scene; | ||
47 | |||
48 | private EstateTerrainXferHandler TerrainUploader = null; | ||
49 | |||
50 | #region Packet Data Responders | ||
51 | |||
52 | private void sendDetailedEstateData(IClientAPI remote_client, UUID invoice) | ||
53 | { | ||
54 | uint sun = 0; | ||
55 | |||
56 | if (!m_scene.RegionInfo.EstateSettings.UseGlobalTime) | ||
57 | sun=(uint)(m_scene.RegionInfo.EstateSettings.SunPosition*1024.0) + 0x1800; | ||
58 | UUID estateOwner; | ||
59 | if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero) | ||
60 | estateOwner = m_scene.RegionInfo.EstateSettings.EstateOwner; | ||
61 | else | ||
62 | estateOwner = m_scene.RegionInfo.MasterAvatarAssignedUUID; | ||
63 | |||
64 | if (m_scene.Permissions.IsGod(remote_client.AgentId)) | ||
65 | estateOwner = remote_client.AgentId; | ||
66 | |||
67 | remote_client.SendDetailedEstateData(invoice, | ||
68 | m_scene.RegionInfo.EstateSettings.EstateName, | ||
69 | m_scene.RegionInfo.EstateSettings.EstateID, | ||
70 | m_scene.RegionInfo.EstateSettings.ParentEstateID, | ||
71 | GetEstateFlags(), | ||
72 | sun, | ||
73 | m_scene.RegionInfo.RegionSettings.Covenant, | ||
74 | m_scene.RegionInfo.EstateSettings.AbuseEmail, | ||
75 | estateOwner); | ||
76 | |||
77 | remote_client.SendEstateManagersList(invoice, | ||
78 | m_scene.RegionInfo.EstateSettings.EstateManagers, | ||
79 | m_scene.RegionInfo.EstateSettings.EstateID); | ||
80 | |||
81 | remote_client.SendBannedUserList(invoice, | ||
82 | m_scene.RegionInfo.EstateSettings.EstateBans, | ||
83 | m_scene.RegionInfo.EstateSettings.EstateID); | ||
84 | } | ||
85 | |||
86 | private void estateSetRegionInfoHandler(bool blockTerraform, bool noFly, bool allowDamage, bool blockLandResell, int maxAgents, float objectBonusFactor, | ||
87 | int matureLevel, bool restrictPushObject, bool allowParcelChanges) | ||
88 | { | ||
89 | if (blockTerraform) | ||
90 | m_scene.RegionInfo.RegionSettings.BlockTerraform = true; | ||
91 | else | ||
92 | m_scene.RegionInfo.RegionSettings.BlockTerraform = false; | ||
93 | |||
94 | if (noFly) | ||
95 | m_scene.RegionInfo.RegionSettings.BlockFly = true; | ||
96 | else | ||
97 | m_scene.RegionInfo.RegionSettings.BlockFly = false; | ||
98 | |||
99 | if (allowDamage) | ||
100 | m_scene.RegionInfo.RegionSettings.AllowDamage = true; | ||
101 | else | ||
102 | m_scene.RegionInfo.RegionSettings.AllowDamage = false; | ||
103 | |||
104 | if (blockLandResell) | ||
105 | m_scene.RegionInfo.RegionSettings.AllowLandResell = false; | ||
106 | else | ||
107 | m_scene.RegionInfo.RegionSettings.AllowLandResell = true; | ||
108 | |||
109 | m_scene.RegionInfo.RegionSettings.AgentLimit = (byte) maxAgents; | ||
110 | |||
111 | m_scene.RegionInfo.RegionSettings.ObjectBonus = objectBonusFactor; | ||
112 | |||
113 | if (matureLevel <= 13) | ||
114 | m_scene.RegionInfo.RegionSettings.Maturity = 0; | ||
115 | else | ||
116 | m_scene.RegionInfo.RegionSettings.Maturity = 1; | ||
117 | |||
118 | if (restrictPushObject) | ||
119 | m_scene.RegionInfo.RegionSettings.RestrictPushing = true; | ||
120 | else | ||
121 | m_scene.RegionInfo.RegionSettings.RestrictPushing = false; | ||
122 | |||
123 | if (allowParcelChanges) | ||
124 | m_scene.RegionInfo.RegionSettings.AllowLandJoinDivide = true; | ||
125 | else | ||
126 | m_scene.RegionInfo.RegionSettings.AllowLandJoinDivide = false; | ||
127 | |||
128 | m_scene.RegionInfo.RegionSettings.Save(); | ||
129 | |||
130 | sendRegionInfoPacketToAll(); | ||
131 | } | ||
132 | |||
133 | public void setEstateTerrainBaseTexture(IClientAPI remoteClient, int corner, UUID texture) | ||
134 | { | ||
135 | if (texture == UUID.Zero) | ||
136 | return; | ||
137 | |||
138 | switch (corner) | ||
139 | { | ||
140 | case 0: | ||
141 | m_scene.RegionInfo.RegionSettings.TerrainTexture1 = texture; | ||
142 | break; | ||
143 | case 1: | ||
144 | m_scene.RegionInfo.RegionSettings.TerrainTexture2 = texture; | ||
145 | break; | ||
146 | case 2: | ||
147 | m_scene.RegionInfo.RegionSettings.TerrainTexture3 = texture; | ||
148 | break; | ||
149 | case 3: | ||
150 | m_scene.RegionInfo.RegionSettings.TerrainTexture4 = texture; | ||
151 | break; | ||
152 | } | ||
153 | m_scene.RegionInfo.RegionSettings.Save(); | ||
154 | } | ||
155 | |||
156 | public void setEstateTerrainTextureHeights(IClientAPI client, int corner, float lowValue, float highValue) | ||
157 | { | ||
158 | switch (corner) | ||
159 | { | ||
160 | case 0: | ||
161 | m_scene.RegionInfo.RegionSettings.Elevation1SW = lowValue; | ||
162 | m_scene.RegionInfo.RegionSettings.Elevation2SW = highValue; | ||
163 | break; | ||
164 | case 1: | ||
165 | m_scene.RegionInfo.RegionSettings.Elevation1NW = lowValue; | ||
166 | m_scene.RegionInfo.RegionSettings.Elevation2NW = highValue; | ||
167 | break; | ||
168 | case 2: | ||
169 | m_scene.RegionInfo.RegionSettings.Elevation1SE = lowValue; | ||
170 | m_scene.RegionInfo.RegionSettings.Elevation2SE = highValue; | ||
171 | break; | ||
172 | case 3: | ||
173 | m_scene.RegionInfo.RegionSettings.Elevation1NE = lowValue; | ||
174 | m_scene.RegionInfo.RegionSettings.Elevation2NE = highValue; | ||
175 | break; | ||
176 | } | ||
177 | m_scene.RegionInfo.RegionSettings.Save(); | ||
178 | } | ||
179 | |||
180 | private void handleCommitEstateTerrainTextureRequest(IClientAPI remoteClient) | ||
181 | { | ||
182 | sendRegionHandshakeToAll(); | ||
183 | } | ||
184 | |||
185 | public void setRegionTerrainSettings(float WaterHeight, | ||
186 | float TerrainRaiseLimit, float TerrainLowerLimit, | ||
187 | bool UseEstateSun, bool UseFixedSun, float SunHour, | ||
188 | bool UseGlobal, bool EstateFixedSun, float EstateSunHour) | ||
189 | { | ||
190 | // Water Height | ||
191 | m_scene.RegionInfo.RegionSettings.WaterHeight = WaterHeight; | ||
192 | |||
193 | // Terraforming limits | ||
194 | m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit = TerrainRaiseLimit; | ||
195 | m_scene.RegionInfo.RegionSettings.TerrainLowerLimit = TerrainLowerLimit; | ||
196 | |||
197 | // Time of day / fixed sun | ||
198 | m_scene.RegionInfo.RegionSettings.UseEstateSun = UseEstateSun; | ||
199 | m_scene.RegionInfo.RegionSettings.FixedSun = UseFixedSun; | ||
200 | m_scene.RegionInfo.RegionSettings.SunPosition = SunHour; | ||
201 | |||
202 | m_scene.EventManager.TriggerEstateToolsTimeUpdate(m_scene.RegionInfo.RegionHandle, UseFixedSun, UseEstateSun, SunHour); | ||
203 | |||
204 | //m_log.Debug("[ESTATE]: UFS: " + UseFixedSun.ToString()); | ||
205 | //m_log.Debug("[ESTATE]: SunHour: " + SunHour.ToString()); | ||
206 | |||
207 | sendRegionInfoPacketToAll(); | ||
208 | m_scene.RegionInfo.RegionSettings.Save(); | ||
209 | } | ||
210 | |||
211 | private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds) | ||
212 | { | ||
213 | m_scene.Restart(timeInSeconds); | ||
214 | } | ||
215 | |||
216 | private void handleChangeEstateCovenantRequest(IClientAPI remoteClient, UUID estateCovenantID) | ||
217 | { | ||
218 | m_scene.RegionInfo.RegionSettings.Covenant = estateCovenantID; | ||
219 | m_scene.RegionInfo.RegionSettings.Save(); | ||
220 | } | ||
221 | |||
222 | private void handleEstateAccessDeltaRequest(IClientAPI remote_client, UUID invoice, int estateAccessType, UUID user) | ||
223 | { | ||
224 | // EstateAccessDelta handles Estate Managers, Sim Access, Sim Banlist, allowed Groups.. etc. | ||
225 | |||
226 | if (user == m_scene.RegionInfo.EstateSettings.EstateOwner) | ||
227 | return; // never process EO | ||
228 | if (user == m_scene.RegionInfo.MasterAvatarAssignedUUID) | ||
229 | return; // never process owner | ||
230 | |||
231 | switch (estateAccessType) | ||
232 | { | ||
233 | case 64: | ||
234 | if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) | ||
235 | { | ||
236 | EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; | ||
237 | |||
238 | bool alreadyInList = false; | ||
239 | |||
240 | for (int i = 0; i < banlistcheck.Length; i++) | ||
241 | { | ||
242 | if (user == banlistcheck[i].bannedUUID) | ||
243 | { | ||
244 | alreadyInList = true; | ||
245 | break; | ||
246 | } | ||
247 | |||
248 | } | ||
249 | if (!alreadyInList) | ||
250 | { | ||
251 | |||
252 | EstateBan item = new EstateBan(); | ||
253 | |||
254 | item.bannedUUID = user; | ||
255 | item.estateID = m_scene.RegionInfo.EstateSettings.EstateID; | ||
256 | item.bannedIP = "0.0.0.0"; | ||
257 | item.bannedIPHostMask = "0.0.0.0"; | ||
258 | |||
259 | m_scene.RegionInfo.EstateSettings.AddBan(item); | ||
260 | m_scene.RegionInfo.EstateSettings.Save(); | ||
261 | |||
262 | ScenePresence s = m_scene.GetScenePresence(user); | ||
263 | if (s != null) | ||
264 | { | ||
265 | if (!s.IsChildAgent) | ||
266 | { | ||
267 | s.ControllingClient.SendTeleportLocationStart(); | ||
268 | m_scene.TeleportClientHome(user, s.ControllingClient); | ||
269 | } | ||
270 | } | ||
271 | |||
272 | } | ||
273 | else | ||
274 | { | ||
275 | remote_client.SendAlertMessage("User is already on the region ban list"); | ||
276 | } | ||
277 | //m_scene.RegionInfo.regionBanlist.Add(Manager(user); | ||
278 | remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID); | ||
279 | } | ||
280 | else | ||
281 | { | ||
282 | remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); | ||
283 | } | ||
284 | break; | ||
285 | case 128: | ||
286 | if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) | ||
287 | { | ||
288 | EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; | ||
289 | |||
290 | bool alreadyInList = false; | ||
291 | EstateBan listitem = null; | ||
292 | |||
293 | for (int i = 0; i < banlistcheck.Length; i++) | ||
294 | { | ||
295 | if (user == banlistcheck[i].bannedUUID) | ||
296 | { | ||
297 | alreadyInList = true; | ||
298 | listitem = banlistcheck[i]; | ||
299 | break; | ||
300 | } | ||
301 | |||
302 | } | ||
303 | if (alreadyInList && listitem != null) | ||
304 | { | ||
305 | m_scene.RegionInfo.EstateSettings.RemoveBan(listitem.bannedUUID); | ||
306 | m_scene.RegionInfo.EstateSettings.Save(); | ||
307 | } | ||
308 | else | ||
309 | { | ||
310 | remote_client.SendAlertMessage("User is not on the region ban list"); | ||
311 | } | ||
312 | //m_scene.RegionInfo.regionBanlist.Add(Manager(user); | ||
313 | remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID); | ||
314 | } | ||
315 | else | ||
316 | { | ||
317 | remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); | ||
318 | } | ||
319 | break; | ||
320 | case 256: | ||
321 | |||
322 | if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) | ||
323 | { | ||
324 | m_scene.RegionInfo.EstateSettings.AddEstateManager(user); | ||
325 | m_scene.RegionInfo.EstateSettings.Save(); | ||
326 | remote_client.SendEstateManagersList(invoice, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID); | ||
327 | } | ||
328 | else | ||
329 | { | ||
330 | remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); | ||
331 | } | ||
332 | |||
333 | break; | ||
334 | case 512: | ||
335 | if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) | ||
336 | { | ||
337 | m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user); | ||
338 | m_scene.RegionInfo.EstateSettings.Save(); | ||
339 | |||
340 | remote_client.SendEstateManagersList(invoice, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID); | ||
341 | } | ||
342 | else | ||
343 | { | ||
344 | remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); | ||
345 | } | ||
346 | break; | ||
347 | |||
348 | default: | ||
349 | |||
350 | m_log.ErrorFormat("EstateOwnerMessage: Unknown EstateAccessType requested in estateAccessDelta: {0}", estateAccessType.ToString()); | ||
351 | break; | ||
352 | } | ||
353 | } | ||
354 | |||
355 | private void SendSimulatorBlueBoxMessage( | ||
356 | IClientAPI remote_client, UUID invoice, UUID senderID, UUID sessionID, string senderName, string message) | ||
357 | { | ||
358 | IDialogModule dm = m_scene.RequestModuleInterface<IDialogModule>(); | ||
359 | |||
360 | if (dm != null) | ||
361 | dm.SendNotificationToUsersInRegion(senderID, senderName, message); | ||
362 | } | ||
363 | |||
364 | private void SendEstateBlueBoxMessage( | ||
365 | IClientAPI remote_client, UUID invoice, UUID senderID, UUID sessionID, string senderName, string message) | ||
366 | { | ||
367 | IDialogModule dm = m_scene.RequestModuleInterface<IDialogModule>(); | ||
368 | |||
369 | if (dm != null) | ||
370 | dm.SendNotificationToUsersInEstate(senderID, senderName, message); | ||
371 | } | ||
372 | |||
373 | private void handleEstateDebugRegionRequest(IClientAPI remote_client, UUID invoice, UUID senderID, bool scripted, bool collisionEvents, bool physics) | ||
374 | { | ||
375 | if (physics) | ||
376 | m_scene.RegionInfo.RegionSettings.DisablePhysics = true; | ||
377 | else | ||
378 | m_scene.RegionInfo.RegionSettings.DisablePhysics = false; | ||
379 | |||
380 | if (scripted) | ||
381 | m_scene.RegionInfo.RegionSettings.DisableScripts = true; | ||
382 | else | ||
383 | m_scene.RegionInfo.RegionSettings.DisableScripts = false; | ||
384 | |||
385 | if (collisionEvents) | ||
386 | m_scene.RegionInfo.RegionSettings.DisableCollisions = true; | ||
387 | else | ||
388 | m_scene.RegionInfo.RegionSettings.DisableCollisions = false; | ||
389 | |||
390 | |||
391 | m_scene.RegionInfo.RegionSettings.Save(); | ||
392 | |||
393 | m_scene.SetSceneCoreDebug(scripted, collisionEvents, physics); | ||
394 | } | ||
395 | |||
396 | private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID, UUID prey) | ||
397 | { | ||
398 | if (prey != UUID.Zero) | ||
399 | { | ||
400 | ScenePresence s = m_scene.GetScenePresence(prey); | ||
401 | if (s != null) | ||
402 | { | ||
403 | s.ControllingClient.SendTeleportLocationStart(); | ||
404 | m_scene.TeleportClientHome(prey, s.ControllingClient); | ||
405 | } | ||
406 | } | ||
407 | } | ||
408 | |||
409 | private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID) | ||
410 | { | ||
411 | // Get a fresh list that will not change as people get teleported away | ||
412 | List<ScenePresence> prescences = m_scene.GetScenePresences(); | ||
413 | foreach (ScenePresence p in prescences) | ||
414 | { | ||
415 | if (p.UUID != senderID) | ||
416 | { | ||
417 | // make sure they are still there, we could be working down a long list | ||
418 | ScenePresence s = m_scene.GetScenePresence(p.UUID); | ||
419 | if (s != null) | ||
420 | { | ||
421 | // Also make sure they are actually in the region | ||
422 | if (!s.IsChildAgent) | ||
423 | { | ||
424 | s.ControllingClient.SendTeleportLocationStart(); | ||
425 | m_scene.TeleportClientHome(s.UUID, s.ControllingClient); | ||
426 | } | ||
427 | } | ||
428 | } | ||
429 | } | ||
430 | } | ||
431 | private void AbortTerrainXferHandler(IClientAPI remoteClient, ulong XferID) | ||
432 | { | ||
433 | if (TerrainUploader != null) | ||
434 | { | ||
435 | lock (TerrainUploader) | ||
436 | { | ||
437 | if (XferID == TerrainUploader.XferID) | ||
438 | { | ||
439 | remoteClient.OnXferReceive -= TerrainUploader.XferReceive; | ||
440 | remoteClient.OnAbortXfer -= AbortTerrainXferHandler; | ||
441 | TerrainUploader.TerrainUploadDone -= HandleTerrainApplication; | ||
442 | |||
443 | TerrainUploader = null; | ||
444 | remoteClient.SendAlertMessage("Terrain Upload aborted by the client"); | ||
445 | } | ||
446 | } | ||
447 | } | ||
448 | |||
449 | } | ||
450 | private void HandleTerrainApplication(string filename, byte[] terrainData, IClientAPI remoteClient) | ||
451 | { | ||
452 | lock (TerrainUploader) | ||
453 | { | ||
454 | remoteClient.OnXferReceive -= TerrainUploader.XferReceive; | ||
455 | remoteClient.OnAbortXfer -= AbortTerrainXferHandler; | ||
456 | TerrainUploader.TerrainUploadDone -= HandleTerrainApplication; | ||
457 | |||
458 | TerrainUploader = null; | ||
459 | } | ||
460 | remoteClient.SendAlertMessage("Terrain Upload Complete. Loading...."); | ||
461 | OpenSim.Region.CoreModules.World.Terrain.ITerrainModule terr = m_scene.RequestModuleInterface<OpenSim.Region.CoreModules.World.Terrain.ITerrainModule>(); | ||
462 | |||
463 | if (terr != null) | ||
464 | { | ||
465 | m_log.Warn("[CLIENT]: Got Request to Send Terrain in region " + m_scene.RegionInfo.RegionName); | ||
466 | if (System.IO.File.Exists(Util.dataDir() + "/terrain.raw")) | ||
467 | { | ||
468 | System.IO.File.Delete(Util.dataDir() + "/terrain.raw"); | ||
469 | } | ||
470 | try | ||
471 | { | ||
472 | System.IO.FileStream input = new System.IO.FileStream(Util.dataDir() + "/terrain.raw", System.IO.FileMode.CreateNew); | ||
473 | input.Write(terrainData, 0, terrainData.Length); | ||
474 | input.Close(); | ||
475 | } | ||
476 | catch (System.IO.IOException e) | ||
477 | { | ||
478 | m_log.ErrorFormat("[TERRAIN]: Error Saving a terrain file uploaded via the estate tools. It gave us the following error: {0}", e.ToString()); | ||
479 | remoteClient.SendAlertMessage("There was an IO Exception loading your terrain. Please check free space"); | ||
480 | |||
481 | return; | ||
482 | } | ||
483 | catch (System.Security.SecurityException e) | ||
484 | { | ||
485 | m_log.ErrorFormat("[TERRAIN]: Error Saving a terrain file uploaded via the estate tools. It gave us the following error: {0}", e.ToString()); | ||
486 | remoteClient.SendAlertMessage("There was a security Exception loading your terrain. Please check the security on the simulator drive"); | ||
487 | |||
488 | return; | ||
489 | } | ||
490 | catch (System.UnauthorizedAccessException e) | ||
491 | { | ||
492 | m_log.ErrorFormat("[TERRAIN]: Error Saving a terrain file uploaded via the estate tools. It gave us the following error: {0}", e.ToString()); | ||
493 | remoteClient.SendAlertMessage("There was a security Exception loading your terrain. Please check the security on the simulator drive"); | ||
494 | |||
495 | return; | ||
496 | } | ||
497 | |||
498 | |||
499 | |||
500 | |||
501 | try | ||
502 | { | ||
503 | terr.LoadFromFile(Util.dataDir() + "/terrain.raw"); | ||
504 | remoteClient.SendAlertMessage("Your terrain was loaded. Give it a minute or two to apply"); | ||
505 | } | ||
506 | catch (Exception e) | ||
507 | { | ||
508 | m_log.ErrorFormat("[TERRAIN]: Error loading a terrain file uploaded via the estate tools. It gave us the following error: {0}", e.ToString()); | ||
509 | remoteClient.SendAlertMessage("There was a general error loading your terrain. Please fix the terrain file and try again"); | ||
510 | } | ||
511 | |||
512 | } | ||
513 | else | ||
514 | { | ||
515 | remoteClient.SendAlertMessage("Unable to apply terrain. Cannot get an instance of the terrain module"); | ||
516 | } | ||
517 | |||
518 | |||
519 | |||
520 | } | ||
521 | |||
522 | private void handleUploadTerrain(IClientAPI remote_client, string clientFileName) | ||
523 | { | ||
524 | |||
525 | if (TerrainUploader == null) | ||
526 | { | ||
527 | |||
528 | TerrainUploader = new EstateTerrainXferHandler(remote_client, clientFileName); | ||
529 | lock (TerrainUploader) | ||
530 | { | ||
531 | remote_client.OnXferReceive += TerrainUploader.XferReceive; | ||
532 | remote_client.OnAbortXfer += AbortTerrainXferHandler; | ||
533 | TerrainUploader.TerrainUploadDone += HandleTerrainApplication; | ||
534 | } | ||
535 | TerrainUploader.RequestStartXfer(remote_client); | ||
536 | |||
537 | } | ||
538 | else | ||
539 | { | ||
540 | remote_client.SendAlertMessage("Another Terrain Upload is in progress. Please wait your turn!"); | ||
541 | } | ||
542 | |||
543 | } | ||
544 | private void handleTerrainRequest(IClientAPI remote_client, string clientFileName) | ||
545 | { | ||
546 | // Save terrain here | ||
547 | OpenSim.Region.CoreModules.World.Terrain.ITerrainModule terr = m_scene.RequestModuleInterface<OpenSim.Region.CoreModules.World.Terrain.ITerrainModule>(); | ||
548 | |||
549 | if (terr != null) | ||
550 | { | ||
551 | m_log.Warn("[CLIENT]: Got Request to Send Terrain in region " + m_scene.RegionInfo.RegionName); | ||
552 | if (System.IO.File.Exists(Util.dataDir() + "/terrain.raw")) | ||
553 | { | ||
554 | System.IO.File.Delete(Util.dataDir() + "/terrain.raw"); | ||
555 | } | ||
556 | terr.SaveToFile(Util.dataDir() + "/terrain.raw"); | ||
557 | |||
558 | System.IO.FileStream input = new System.IO.FileStream(Util.dataDir() + "/terrain.raw", System.IO.FileMode.Open); | ||
559 | byte[] bdata = new byte[input.Length]; | ||
560 | input.Read(bdata, 0, (int)input.Length); | ||
561 | remote_client.SendAlertMessage("Terrain file written, starting download..."); | ||
562 | m_scene.XferManager.AddNewFile("terrain.raw", bdata); | ||
563 | // Tell client about it | ||
564 | m_log.Warn("[CLIENT]: Sending Terrain to " + remote_client.Name); | ||
565 | remote_client.SendInitiateDownload("terrain.raw", clientFileName); | ||
566 | } | ||
567 | } | ||
568 | |||
569 | private void HandleRegionInfoRequest(IClientAPI remote_client) | ||
570 | { | ||
571 | RegionInfoForEstateMenuArgs args = new RegionInfoForEstateMenuArgs(); | ||
572 | args.billableFactor = m_scene.RegionInfo.EstateSettings.BillableFactor; | ||
573 | args.estateID = m_scene.RegionInfo.EstateSettings.EstateID; | ||
574 | args.maxAgents = (byte)m_scene.RegionInfo.RegionSettings.AgentLimit; | ||
575 | args.objectBonusFactor = (float)m_scene.RegionInfo.RegionSettings.ObjectBonus; | ||
576 | args.parentEstateID = m_scene.RegionInfo.EstateSettings.ParentEstateID; | ||
577 | args.pricePerMeter = m_scene.RegionInfo.EstateSettings.PricePerMeter; | ||
578 | args.redirectGridX = m_scene.RegionInfo.EstateSettings.RedirectGridX; | ||
579 | args.redirectGridY = m_scene.RegionInfo.EstateSettings.RedirectGridY; | ||
580 | args.regionFlags = GetRegionFlags(); | ||
581 | byte mature = 13; | ||
582 | if (m_scene.RegionInfo.RegionSettings.Maturity == 1) | ||
583 | mature = 21; | ||
584 | args.simAccess = mature; | ||
585 | |||
586 | args.sunHour = (float)m_scene.RegionInfo.RegionSettings.SunPosition; | ||
587 | args.terrainLowerLimit = (float)m_scene.RegionInfo.RegionSettings.TerrainLowerLimit; | ||
588 | args.terrainRaiseLimit = (float)m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit; | ||
589 | args.useEstateSun = m_scene.RegionInfo.RegionSettings.UseEstateSun; | ||
590 | args.waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; | ||
591 | args.simName = m_scene.RegionInfo.RegionName; | ||
592 | |||
593 | remote_client.SendRegionInfoToEstateMenu(args); | ||
594 | } | ||
595 | |||
596 | private void HandleEstateCovenantRequest(IClientAPI remote_client) | ||
597 | { | ||
598 | remote_client.SendEstateCovenantInformation(m_scene.RegionInfo.RegionSettings.Covenant); | ||
599 | } | ||
600 | |||
601 | private void HandleLandStatRequest(int parcelID, uint reportType, uint requestFlags, string filter, IClientAPI remoteClient) | ||
602 | { | ||
603 | Dictionary<uint, float> SceneData = new Dictionary<uint,float>(); | ||
604 | List<UUID> uuidNameLookupList = new List<UUID>(); | ||
605 | |||
606 | if (reportType == 1) | ||
607 | { | ||
608 | SceneData = m_scene.PhysicsScene.GetTopColliders(); | ||
609 | } | ||
610 | else if (reportType == 0) | ||
611 | { | ||
612 | SceneData = m_scene.m_sceneGraph.GetTopScripts(); | ||
613 | } | ||
614 | |||
615 | List<LandStatReportItem> SceneReport = new List<LandStatReportItem>(); | ||
616 | lock (SceneData) | ||
617 | { | ||
618 | foreach (uint obj in SceneData.Keys) | ||
619 | { | ||
620 | SceneObjectPart prt = m_scene.GetSceneObjectPart(obj); | ||
621 | if (prt != null) | ||
622 | { | ||
623 | if (prt.ParentGroup != null) | ||
624 | { | ||
625 | SceneObjectGroup sog = prt.ParentGroup; | ||
626 | if (sog != null) | ||
627 | { | ||
628 | LandStatReportItem lsri = new LandStatReportItem(); | ||
629 | lsri.LocationX = sog.AbsolutePosition.X; | ||
630 | lsri.LocationY = sog.AbsolutePosition.Y; | ||
631 | lsri.LocationZ = sog.AbsolutePosition.Z; | ||
632 | lsri.Score = SceneData[obj]; | ||
633 | lsri.TaskID = sog.UUID; | ||
634 | lsri.TaskLocalID = sog.LocalId; | ||
635 | lsri.TaskName = sog.GetPartName(obj); | ||
636 | if (m_scene.CommsManager.UUIDNameCachedTest(sog.OwnerID)) | ||
637 | { | ||
638 | lsri.OwnerName = m_scene.CommsManager.UUIDNameRequestString(sog.OwnerID); | ||
639 | } | ||
640 | else | ||
641 | { | ||
642 | lsri.OwnerName = "waiting"; | ||
643 | lock (uuidNameLookupList) | ||
644 | uuidNameLookupList.Add(sog.OwnerID); | ||
645 | } | ||
646 | |||
647 | if (filter.Length != 0) | ||
648 | { | ||
649 | if ((lsri.OwnerName.Contains(filter) || lsri.TaskName.Contains(filter))) | ||
650 | { | ||
651 | } | ||
652 | else | ||
653 | { | ||
654 | continue; | ||
655 | } | ||
656 | } | ||
657 | |||
658 | SceneReport.Add(lsri); | ||
659 | } | ||
660 | } | ||
661 | } | ||
662 | |||
663 | } | ||
664 | } | ||
665 | remoteClient.SendLandStatReply(reportType, requestFlags, (uint)SceneReport.Count,SceneReport.ToArray()); | ||
666 | |||
667 | if (uuidNameLookupList.Count > 0) | ||
668 | LookupUUID(uuidNameLookupList); | ||
669 | } | ||
670 | |||
671 | private void LookupUUIDSCompleted(IAsyncResult iar) | ||
672 | { | ||
673 | LookupUUIDS icon = (LookupUUIDS)iar.AsyncState; | ||
674 | icon.EndInvoke(iar); | ||
675 | } | ||
676 | private void LookupUUID(List<UUID> uuidLst) | ||
677 | { | ||
678 | LookupUUIDS d = LookupUUIDsAsync; | ||
679 | |||
680 | d.BeginInvoke(uuidLst, | ||
681 | LookupUUIDSCompleted, | ||
682 | d); | ||
683 | } | ||
684 | private void LookupUUIDsAsync(List<UUID> uuidLst) | ||
685 | { | ||
686 | UUID[] uuidarr = new UUID[0]; | ||
687 | |||
688 | lock (uuidLst) | ||
689 | { | ||
690 | uuidarr = uuidLst.ToArray(); | ||
691 | } | ||
692 | |||
693 | for (int i = 0; i < uuidarr.Length; i++) | ||
694 | { | ||
695 | // string lookupname = m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]); | ||
696 | m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]); | ||
697 | // we drop it. It gets cached though... so we're ready for the next request. | ||
698 | } | ||
699 | } | ||
700 | #endregion | ||
701 | |||
702 | #region Outgoing Packets | ||
703 | |||
704 | public void sendRegionInfoPacketToAll() | ||
705 | { | ||
706 | List<ScenePresence> avatars = m_scene.GetAvatars(); | ||
707 | |||
708 | for (int i = 0; i < avatars.Count; i++) | ||
709 | { | ||
710 | HandleRegionInfoRequest(avatars[i].ControllingClient); ; | ||
711 | } | ||
712 | } | ||
713 | |||
714 | public void sendRegionHandshake(IClientAPI remoteClient) | ||
715 | { | ||
716 | RegionHandshakeArgs args = new RegionHandshakeArgs(); | ||
717 | |||
718 | args.isEstateManager = m_scene.RegionInfo.EstateSettings.IsEstateManager(remoteClient.AgentId); | ||
719 | if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero && m_scene.RegionInfo.EstateSettings.EstateOwner == remoteClient.AgentId) | ||
720 | args.isEstateManager = true; | ||
721 | |||
722 | args.billableFactor = m_scene.RegionInfo.EstateSettings.BillableFactor; | ||
723 | args.terrainStartHeight0 = (float)m_scene.RegionInfo.RegionSettings.Elevation1SW; | ||
724 | args.terrainHeightRange0 = (float)m_scene.RegionInfo.RegionSettings.Elevation2SW; | ||
725 | args.terrainStartHeight1 = (float)m_scene.RegionInfo.RegionSettings.Elevation1NW; | ||
726 | args.terrainHeightRange1 = (float)m_scene.RegionInfo.RegionSettings.Elevation2NW; | ||
727 | args.terrainStartHeight2 = (float)m_scene.RegionInfo.RegionSettings.Elevation1SE; | ||
728 | args.terrainHeightRange2 = (float)m_scene.RegionInfo.RegionSettings.Elevation2SE; | ||
729 | args.terrainStartHeight3 = (float)m_scene.RegionInfo.RegionSettings.Elevation1NE; | ||
730 | args.terrainHeightRange3 = (float)m_scene.RegionInfo.RegionSettings.Elevation2NE; | ||
731 | byte mature = 13; | ||
732 | if (m_scene.RegionInfo.RegionSettings.Maturity == 1) | ||
733 | mature = 21; | ||
734 | args.simAccess = mature; | ||
735 | args.waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; | ||
736 | |||
737 | args.regionFlags = GetRegionFlags(); | ||
738 | args.regionName = m_scene.RegionInfo.RegionName; | ||
739 | if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero) | ||
740 | args.SimOwner = m_scene.RegionInfo.EstateSettings.EstateOwner; | ||
741 | else | ||
742 | args.SimOwner = m_scene.RegionInfo.MasterAvatarAssignedUUID; | ||
743 | |||
744 | // Fudge estate owner | ||
745 | //if (m_scene.Permissions.IsGod(remoteClient.AgentId)) | ||
746 | // args.SimOwner = remoteClient.AgentId; | ||
747 | |||
748 | args.terrainBase0 = UUID.Zero; | ||
749 | args.terrainBase1 = UUID.Zero; | ||
750 | args.terrainBase2 = UUID.Zero; | ||
751 | args.terrainBase3 = UUID.Zero; | ||
752 | args.terrainDetail0 = m_scene.RegionInfo.RegionSettings.TerrainTexture1; | ||
753 | args.terrainDetail1 = m_scene.RegionInfo.RegionSettings.TerrainTexture2; | ||
754 | args.terrainDetail2 = m_scene.RegionInfo.RegionSettings.TerrainTexture3; | ||
755 | args.terrainDetail3 = m_scene.RegionInfo.RegionSettings.TerrainTexture4; | ||
756 | |||
757 | remoteClient.SendRegionHandshake(m_scene.RegionInfo,args); | ||
758 | } | ||
759 | |||
760 | public void sendRegionHandshakeToAll() | ||
761 | { | ||
762 | m_scene.Broadcast(sendRegionHandshake); | ||
763 | } | ||
764 | |||
765 | public void handleEstateChangeInfo(IClientAPI remoteClient, UUID invoice, UUID senderID, UInt32 parms1, UInt32 parms2) | ||
766 | { | ||
767 | if (parms2 == 0) | ||
768 | { | ||
769 | m_scene.RegionInfo.EstateSettings.UseGlobalTime = true; | ||
770 | m_scene.RegionInfo.EstateSettings.SunPosition = 0.0; | ||
771 | } | ||
772 | else | ||
773 | { | ||
774 | m_scene.RegionInfo.EstateSettings.UseGlobalTime = false; | ||
775 | m_scene.RegionInfo.EstateSettings.SunPosition = (double)(parms2 - 0x1800)/1024.0; | ||
776 | } | ||
777 | |||
778 | if ((parms1 & 0x00000010) != 0) | ||
779 | m_scene.RegionInfo.EstateSettings.FixedSun = true; | ||
780 | else | ||
781 | m_scene.RegionInfo.EstateSettings.FixedSun = false; | ||
782 | |||
783 | if ((parms1 & 0x00008000) != 0) | ||
784 | m_scene.RegionInfo.EstateSettings.PublicAccess = true; | ||
785 | else | ||
786 | m_scene.RegionInfo.EstateSettings.PublicAccess = false; | ||
787 | |||
788 | if ((parms1 & 0x10000000) != 0) | ||
789 | m_scene.RegionInfo.EstateSettings.AllowVoice = true; | ||
790 | else | ||
791 | m_scene.RegionInfo.EstateSettings.AllowVoice = false; | ||
792 | |||
793 | if ((parms1 & 0x00100000) != 0) | ||
794 | m_scene.RegionInfo.EstateSettings.AllowDirectTeleport = true; | ||
795 | else | ||
796 | m_scene.RegionInfo.EstateSettings.AllowDirectTeleport = false; | ||
797 | |||
798 | if ((parms1 & 0x00800000) != 0) | ||
799 | m_scene.RegionInfo.EstateSettings.DenyAnonymous = true; | ||
800 | else | ||
801 | m_scene.RegionInfo.EstateSettings.DenyAnonymous = false; | ||
802 | |||
803 | if ((parms1 & 0x01000000) != 0) | ||
804 | m_scene.RegionInfo.EstateSettings.DenyIdentified = true; | ||
805 | else | ||
806 | m_scene.RegionInfo.EstateSettings.DenyIdentified = false; | ||
807 | |||
808 | if ((parms1 & 0x02000000) != 0) | ||
809 | m_scene.RegionInfo.EstateSettings.DenyTransacted = true; | ||
810 | else | ||
811 | m_scene.RegionInfo.EstateSettings.DenyTransacted = false; | ||
812 | |||
813 | if ((parms1 & 0x40000000) != 0) | ||
814 | m_scene.RegionInfo.EstateSettings.DenyMinors = true; | ||
815 | else | ||
816 | m_scene.RegionInfo.EstateSettings.DenyMinors = false; | ||
817 | |||
818 | m_scene.RegionInfo.EstateSettings.Save(); | ||
819 | |||
820 | float sun = (float)m_scene.RegionInfo.RegionSettings.SunPosition; | ||
821 | if (m_scene.RegionInfo.RegionSettings.UseEstateSun) | ||
822 | { | ||
823 | sun = (float)m_scene.RegionInfo.EstateSettings.SunPosition; | ||
824 | if (m_scene.RegionInfo.EstateSettings.UseGlobalTime) | ||
825 | sun = m_scene.EventManager.GetSunLindenHour(); | ||
826 | } | ||
827 | |||
828 | m_scene.EventManager.TriggerEstateToolsTimeUpdate( | ||
829 | m_scene.RegionInfo.RegionHandle, | ||
830 | m_scene.RegionInfo.EstateSettings.FixedSun || | ||
831 | m_scene.RegionInfo.RegionSettings.FixedSun, | ||
832 | m_scene.RegionInfo.RegionSettings.UseEstateSun, sun); | ||
833 | |||
834 | sendDetailedEstateData(remoteClient, invoice); | ||
835 | } | ||
836 | |||
837 | #endregion | ||
838 | |||
839 | #region IRegionModule Members | ||
840 | |||
841 | public void Initialise(Scene scene, IConfigSource source) | ||
842 | { | ||
843 | m_scene = scene; | ||
844 | m_scene.RegisterModuleInterface<IEstateModule>(this); | ||
845 | m_scene.EventManager.OnNewClient += EventManager_OnNewClient; | ||
846 | m_scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; | ||
847 | } | ||
848 | |||
849 | |||
850 | public void PostInitialise() | ||
851 | { | ||
852 | } | ||
853 | |||
854 | public void Close() | ||
855 | { | ||
856 | } | ||
857 | |||
858 | public string Name | ||
859 | { | ||
860 | get { return "EstateManagementModule"; } | ||
861 | } | ||
862 | |||
863 | public bool IsSharedModule | ||
864 | { | ||
865 | get { return false; } | ||
866 | } | ||
867 | |||
868 | #endregion | ||
869 | |||
870 | #region Other Functions | ||
871 | |||
872 | public void changeWaterHeight(float height) | ||
873 | { | ||
874 | setRegionTerrainSettings(height, | ||
875 | (float)m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit, | ||
876 | (float)m_scene.RegionInfo.RegionSettings.TerrainLowerLimit, | ||
877 | m_scene.RegionInfo.RegionSettings.UseEstateSun, | ||
878 | m_scene.RegionInfo.RegionSettings.FixedSun, | ||
879 | (float)m_scene.RegionInfo.RegionSettings.SunPosition, | ||
880 | m_scene.RegionInfo.EstateSettings.UseGlobalTime, | ||
881 | m_scene.RegionInfo.EstateSettings.FixedSun, | ||
882 | (float)m_scene.RegionInfo.EstateSettings.SunPosition); | ||
883 | |||
884 | sendRegionInfoPacketToAll(); | ||
885 | } | ||
886 | |||
887 | #endregion | ||
888 | |||
889 | private void EventManager_OnNewClient(IClientAPI client) | ||
890 | { | ||
891 | client.OnDetailedEstateDataRequest += sendDetailedEstateData; | ||
892 | client.OnSetEstateFlagsRequest += estateSetRegionInfoHandler; | ||
893 | // client.OnSetEstateTerrainBaseTexture += setEstateTerrainBaseTexture; | ||
894 | client.OnSetEstateTerrainDetailTexture += setEstateTerrainBaseTexture; | ||
895 | client.OnSetEstateTerrainTextureHeights += setEstateTerrainTextureHeights; | ||
896 | client.OnCommitEstateTerrainTextureRequest += handleCommitEstateTerrainTextureRequest; | ||
897 | client.OnSetRegionTerrainSettings += setRegionTerrainSettings; | ||
898 | client.OnEstateRestartSimRequest += handleEstateRestartSimRequest; | ||
899 | client.OnEstateChangeCovenantRequest += handleChangeEstateCovenantRequest; | ||
900 | client.OnEstateChangeInfo += handleEstateChangeInfo; | ||
901 | client.OnUpdateEstateAccessDeltaRequest += handleEstateAccessDeltaRequest; | ||
902 | client.OnSimulatorBlueBoxMessageRequest += SendSimulatorBlueBoxMessage; | ||
903 | client.OnEstateBlueBoxMessageRequest += SendEstateBlueBoxMessage; | ||
904 | client.OnEstateDebugRegionRequest += handleEstateDebugRegionRequest; | ||
905 | client.OnEstateTeleportOneUserHomeRequest += handleEstateTeleportOneUserHomeRequest; | ||
906 | client.OnEstateTeleportAllUsersHomeRequest += handleEstateTeleportAllUsersHomeRequest; | ||
907 | client.OnRequestTerrain += handleTerrainRequest; | ||
908 | client.OnUploadTerrain += handleUploadTerrain; | ||
909 | |||
910 | client.OnRegionInfoRequest += HandleRegionInfoRequest; | ||
911 | client.OnEstateCovenantRequest += HandleEstateCovenantRequest; | ||
912 | client.OnLandStatRequest += HandleLandStatRequest; | ||
913 | sendRegionHandshake(client); | ||
914 | } | ||
915 | |||
916 | public uint GetRegionFlags() | ||
917 | { | ||
918 | RegionFlags flags = RegionFlags.None; | ||
919 | |||
920 | // Fully implemented | ||
921 | // | ||
922 | if (m_scene.RegionInfo.RegionSettings.AllowDamage) | ||
923 | flags |= RegionFlags.AllowDamage; | ||
924 | if (m_scene.RegionInfo.RegionSettings.BlockTerraform) | ||
925 | flags |= RegionFlags.BlockTerraform; | ||
926 | if (!m_scene.RegionInfo.RegionSettings.AllowLandResell) | ||
927 | flags |= RegionFlags.BlockLandResell; | ||
928 | if (m_scene.RegionInfo.RegionSettings.DisableCollisions) | ||
929 | flags |= RegionFlags.SkipCollisions; | ||
930 | if (m_scene.RegionInfo.RegionSettings.DisableScripts) | ||
931 | flags |= RegionFlags.SkipScripts; | ||
932 | if (m_scene.RegionInfo.RegionSettings.DisablePhysics) | ||
933 | flags |= RegionFlags.SkipPhysics; | ||
934 | if (m_scene.RegionInfo.RegionSettings.BlockFly) | ||
935 | flags |= RegionFlags.NoFly; | ||
936 | if (m_scene.RegionInfo.RegionSettings.RestrictPushing) | ||
937 | flags |= RegionFlags.RestrictPushObject; | ||
938 | if (m_scene.RegionInfo.RegionSettings.AllowLandJoinDivide) | ||
939 | flags |= RegionFlags.AllowParcelChanges; | ||
940 | if (m_scene.RegionInfo.RegionSettings.BlockShowInSearch) | ||
941 | flags |= (RegionFlags)(1 << 29); | ||
942 | |||
943 | if (m_scene.RegionInfo.RegionSettings.FixedSun) | ||
944 | flags |= RegionFlags.SunFixed; | ||
945 | if (m_scene.RegionInfo.RegionSettings.Sandbox) | ||
946 | flags |= RegionFlags.Sandbox; | ||
947 | |||
948 | // Fudge these to always on, so the menu options activate | ||
949 | // | ||
950 | flags |= RegionFlags.AllowLandmark; | ||
951 | flags |= RegionFlags.AllowSetHome; | ||
952 | |||
953 | // TODO: SkipUpdateInterestList | ||
954 | |||
955 | // Omitted | ||
956 | // | ||
957 | // Omitted: NullLayer (what is that?) | ||
958 | // Omitted: SkipAgentAction (what does it do?) | ||
959 | |||
960 | return (uint)flags; | ||
961 | } | ||
962 | |||
963 | public uint GetEstateFlags() | ||
964 | { | ||
965 | RegionFlags flags = RegionFlags.None; | ||
966 | |||
967 | if (m_scene.RegionInfo.EstateSettings.FixedSun) | ||
968 | flags |= RegionFlags.SunFixed; | ||
969 | if (m_scene.RegionInfo.EstateSettings.PublicAccess) | ||
970 | flags |= (RegionFlags.PublicAllowed | | ||
971 | RegionFlags.ExternallyVisible); | ||
972 | if (m_scene.RegionInfo.EstateSettings.AllowVoice) | ||
973 | flags |= RegionFlags.AllowVoice; | ||
974 | if (m_scene.RegionInfo.EstateSettings.AllowDirectTeleport) | ||
975 | flags |= RegionFlags.AllowDirectTeleport; | ||
976 | if (m_scene.RegionInfo.EstateSettings.DenyAnonymous) | ||
977 | flags |= RegionFlags.DenyAnonymous; | ||
978 | if (m_scene.RegionInfo.EstateSettings.DenyIdentified) | ||
979 | flags |= RegionFlags.DenyIdentified; | ||
980 | if (m_scene.RegionInfo.EstateSettings.DenyTransacted) | ||
981 | flags |= RegionFlags.DenyTransacted; | ||
982 | if (m_scene.RegionInfo.EstateSettings.AbuseEmailToEstateOwner) | ||
983 | flags |= RegionFlags.AbuseEmailToEstateOwner; | ||
984 | if (m_scene.RegionInfo.EstateSettings.BlockDwell) | ||
985 | flags |= RegionFlags.BlockDwell; | ||
986 | if (m_scene.RegionInfo.EstateSettings.EstateSkipScripts) | ||
987 | flags |= RegionFlags.EstateSkipScripts; | ||
988 | if (m_scene.RegionInfo.EstateSettings.ResetHomeOnTeleport) | ||
989 | flags |= RegionFlags.ResetHomeOnTeleport; | ||
990 | if (m_scene.RegionInfo.EstateSettings.TaxFree) | ||
991 | flags |= RegionFlags.TaxFree; | ||
992 | if (m_scene.RegionInfo.EstateSettings.DenyMinors) | ||
993 | flags |= (RegionFlags)(1 << 30); | ||
994 | |||
995 | return (uint)flags; | ||
996 | } | ||
997 | |||
998 | public bool IsManager(UUID avatarID) | ||
999 | { | ||
1000 | if (avatarID == m_scene.RegionInfo.MasterAvatarAssignedUUID) | ||
1001 | return true; | ||
1002 | if (avatarID == m_scene.RegionInfo.EstateSettings.EstateOwner) | ||
1003 | return true; | ||
1004 | |||
1005 | List<UUID> ems = new List<UUID>(m_scene.RegionInfo.EstateSettings.EstateManagers); | ||
1006 | if (ems.Contains(avatarID)) | ||
1007 | return true; | ||
1008 | |||
1009 | return false; | ||
1010 | } | ||
1011 | } | ||
1012 | } | ||