diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 54a7302..a032bc7 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -313,6 +313,69 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
313 | return response; | 313 | return response; |
314 | } | 314 | } |
315 | 315 | ||
316 | public string SetRegionEstate(RegionInfo regionInfo, int estateID) | ||
317 | { | ||
318 | string response; | ||
319 | |||
320 | if (regionInfo.EstateSettings.EstateID == estateID) | ||
321 | { | ||
322 | response = String.Format("\"{0}\" is already part of estate {1}", regionInfo.RegionName, estateID); | ||
323 | } | ||
324 | else | ||
325 | { | ||
326 | // get the current settings from DB | ||
327 | EstateSettings dbSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | ||
328 | if (dbSettings.EstateID == 0) | ||
329 | { | ||
330 | response = String.Format("No estate found with ID {0}", estateID); | ||
331 | } | ||
332 | else if (Scene.EstateDataService.LinkRegion(regionInfo.RegionID, estateID)) | ||
333 | { | ||
334 | // make sure there's a log entry to document the change | ||
335 | m_log.InfoFormat("[ESTATE]: Region {0} ({1}) moved to Estate {2} ({3}).", regionInfo.RegionID, regionInfo.RegionName, estateID, dbSettings.EstateName); | ||
336 | |||
337 | // propagate the change | ||
338 | ChangeDelegate change = OnEstateInfoChange; | ||
339 | |||
340 | if (change != null) | ||
341 | change(regionInfo.RegionID); | ||
342 | |||
343 | response = String.Empty; | ||
344 | } | ||
345 | else | ||
346 | { | ||
347 | response = String.Format("Could not move \"{0}\" to estate {1}", regionInfo.RegionName, estateID); | ||
348 | } | ||
349 | } | ||
350 | return response; | ||
351 | } | ||
352 | |||
353 | public string CreateEstate(string estateName, UUID ownerID) | ||
354 | { | ||
355 | string response; | ||
356 | if (string.IsNullOrEmpty(estateName)) | ||
357 | { | ||
358 | response = "No estate name specified."; | ||
359 | } | ||
360 | else | ||
361 | { | ||
362 | List<int> estates = Scene.EstateDataService.GetEstates(estateName); | ||
363 | if (estates.Count() > 0) | ||
364 | { | ||
365 | response = String.Format("An estate named \"{0}\" already exists.", estateName); | ||
366 | } | ||
367 | else | ||
368 | { | ||
369 | EstateSettings settings = Scene.EstateDataService.CreateNewEstate(); | ||
370 | settings.EstateOwner = ownerID; | ||
371 | settings.EstateName = estateName; | ||
372 | settings.Save(); | ||
373 | response = String.Empty; | ||
374 | } | ||
375 | } | ||
376 | return response; | ||
377 | } | ||
378 | |||
316 | #endregion | 379 | #endregion |
317 | 380 | ||
318 | #region Packet Data Responders | 381 | #region Packet Data Responders |