29 using System.Collections.Generic;
31 using System.Reflection;
34 namespace OpenSim.Framework
46 private uint m_EstateID = 0;
50 get {
return m_EstateID; }
51 set { m_EstateID = value; }
54 private string m_EstateName =
"My Estate";
56 public string EstateName
58 get {
return m_EstateName; }
59 set { m_EstateName = value; }
62 private bool m_AllowLandmark =
true;
64 public bool AllowLandmark
66 get {
return m_AllowLandmark; }
67 set { m_AllowLandmark = value; }
70 private bool m_AllowParcelChanges =
true;
72 public bool AllowParcelChanges
74 get {
return m_AllowParcelChanges; }
75 set { m_AllowParcelChanges = value; }
78 private bool m_AllowSetHome =
true;
80 public bool AllowSetHome
82 get {
return m_AllowSetHome; }
83 set { m_AllowSetHome = value; }
86 private uint m_ParentEstateID = 1;
88 public uint ParentEstateID
90 get {
return m_ParentEstateID; }
91 set { m_ParentEstateID = value; }
94 private float m_BillableFactor = 0.0f;
96 public float BillableFactor
98 get {
return m_BillableFactor; }
99 set { m_BillableFactor = value; }
102 private int m_PricePerMeter = 1;
104 public int PricePerMeter
106 get {
return m_PricePerMeter; }
107 set { m_PricePerMeter = value; }
110 private int m_RedirectGridX = 0;
112 public int RedirectGridX
114 get {
return m_RedirectGridX; }
115 set { m_RedirectGridX = value; }
118 private int m_RedirectGridY = 0;
120 public int RedirectGridY
122 get {
return m_RedirectGridY; }
123 set { m_RedirectGridY = value; }
128 private bool m_UseGlobalTime =
true;
130 public bool UseGlobalTime
132 get {
return m_UseGlobalTime; }
133 set { m_UseGlobalTime = value; }
136 private bool m_FixedSun =
false;
140 get {
return m_FixedSun; }
141 set { m_FixedSun = value; }
144 private double m_SunPosition = 0.0;
146 public double SunPosition
148 get {
return m_SunPosition; }
149 set { m_SunPosition = value; }
152 private bool m_AllowVoice =
true;
154 public bool AllowVoice
156 get {
return m_AllowVoice; }
157 set { m_AllowVoice = value; }
160 private bool m_AllowDirectTeleport =
true;
162 public bool AllowDirectTeleport
164 get {
return m_AllowDirectTeleport; }
165 set { m_AllowDirectTeleport = value; }
168 private bool m_DenyAnonymous =
false;
170 public bool DenyAnonymous
172 get {
return m_DenyAnonymous; }
173 set { m_DenyAnonymous = value; }
176 private bool m_DenyIdentified =
false;
178 public bool DenyIdentified
180 get {
return m_DenyIdentified; }
181 set { m_DenyIdentified = value; }
184 private bool m_DenyTransacted =
false;
186 public bool DenyTransacted
188 get {
return m_DenyTransacted; }
189 set { m_DenyTransacted = value; }
192 private bool m_AbuseEmailToEstateOwner =
false;
194 public bool AbuseEmailToEstateOwner
196 get {
return m_AbuseEmailToEstateOwner; }
197 set { m_AbuseEmailToEstateOwner = value; }
200 private bool m_BlockDwell =
false;
202 public bool BlockDwell
204 get {
return m_BlockDwell; }
205 set { m_BlockDwell = value; }
208 private bool m_EstateSkipScripts =
false;
210 public bool EstateSkipScripts
212 get {
return m_EstateSkipScripts; }
213 set { m_EstateSkipScripts = value; }
216 private bool m_ResetHomeOnTeleport =
false;
218 public bool ResetHomeOnTeleport
220 get {
return m_ResetHomeOnTeleport; }
221 set { m_ResetHomeOnTeleport = value; }
224 private bool m_TaxFree =
false;
228 get {
return m_TaxFree; }
229 set { m_TaxFree = value; }
232 private bool m_PublicAccess =
true;
234 public bool PublicAccess
236 get {
return m_PublicAccess; }
237 set { m_PublicAccess = value; }
240 private string m_AbuseEmail = String.Empty;
242 public string AbuseEmail
244 get {
return m_AbuseEmail; }
245 set { m_AbuseEmail= value; }
248 private UUID m_EstateOwner = UUID.Zero;
250 public UUID EstateOwner
252 get {
return m_EstateOwner; }
253 set { m_EstateOwner = value; }
256 private bool m_DenyMinors =
false;
258 public bool DenyMinors
260 get {
return m_DenyMinors; }
261 set { m_DenyMinors = value; }
266 private List<UUID> l_EstateManagers =
new List<UUID>();
268 public UUID[] EstateManagers
270 get {
return l_EstateManagers.ToArray(); }
271 set { l_EstateManagers =
new List<UUID>(value); }
274 private List<EstateBan> l_EstateBans =
new List<EstateBan>();
278 get {
return l_EstateBans.ToArray(); }
279 set { l_EstateBans =
new List<EstateBan>(value); }
282 private List<UUID> l_EstateAccess =
new List<UUID>();
284 public UUID[] EstateAccess
286 get {
return l_EstateAccess.ToArray(); }
287 set { l_EstateAccess =
new List<UUID>(value); }
290 private List<UUID> l_EstateGroups =
new List<UUID>();
292 public UUID[] EstateGroups
294 get {
return l_EstateGroups.ToArray(); }
295 set { l_EstateGroups =
new List<UUID>(value); }
310 if (avatarID == UUID.Zero)
312 if (!l_EstateAccess.Contains(avatarID))
313 l_EstateAccess.Add(avatarID);
318 if (l_EstateAccess.Contains(avatarID))
319 l_EstateAccess.Remove(avatarID);
324 if (avatarID == UUID.Zero)
326 if (!l_EstateGroups.Contains(avatarID))
327 l_EstateGroups.Add(avatarID);
332 if (l_EstateGroups.Contains(avatarID))
333 l_EstateGroups.Remove(avatarID);
338 if (avatarID == UUID.Zero)
340 if (!l_EstateManagers.Contains(avatarID))
341 l_EstateManagers.Add(avatarID);
346 if (l_EstateManagers.Contains(avatarID))
347 l_EstateManagers.Remove(avatarID);
352 if (IsEstateOwner(avatarID))
355 return l_EstateManagers.Contains(avatarID);
360 if (avatarID == m_EstateOwner)
368 if (!IsEstateManagerOrOwner(avatarID))
379 if (!IsEstateManagerOrOwner(avatarID))
385 if (!HasAccess(avatarID))
389 if ((userFlags & 32) == 0)
396 if ((userFlags & 4) == 0)
411 l_EstateBans.Add(ban);
416 l_EstateBans.Clear();
421 foreach (
EstateBan ban
in new List<EstateBan>(l_EstateBans))
423 l_EstateBans.Remove(ban);
428 if (IsEstateManagerOrOwner(user))
431 return l_EstateAccess.Contains(user);
436 ResetHomeOnTeleport = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.ResetHomeOnTeleport) == (ulong)OpenMetaverse.RegionFlags.ResetHomeOnTeleport);
437 BlockDwell = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.BlockDwell) == (ulong)OpenMetaverse.RegionFlags.BlockDwell);
438 AllowLandmark = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowLandmark) == (ulong)OpenMetaverse.RegionFlags.AllowLandmark);
439 AllowParcelChanges = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowParcelChanges) == (ulong)OpenMetaverse.RegionFlags.AllowParcelChanges);
440 AllowSetHome = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowSetHome) == (ulong)OpenMetaverse.RegionFlags.AllowSetHome);
445 return l_EstateGroups.Contains(groupID);
448 public Dictionary<string, object>
ToMap()
450 Dictionary<string, object> map =
new Dictionary<string, object>();
451 PropertyInfo[] properties = this.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);
452 foreach (PropertyInfo p
in properties)
455 if (p.Name ==
"EstateBans")
458 object value = p.GetValue(
this, null);
461 if (p.PropertyType.IsArray)
463 if (((Array)value).Length > 0)
465 string[] args =
new string[((Array)value).Length];
467 foreach (
object o
in (Array)value)
468 args[index++] = o.ToString();
469 map[p.Name] = String.Join(
",", args);
478 if (EstateBans.Length > 0)
480 Dictionary<string, object> bans =
new Dictionary<string, object>();
483 bans[
"ban" + i++] = ban.ToMap();
484 map[
"EstateBans"] = bans;
496 Dictionary<string, object> map = ToMap();
497 String result = String.Empty;
499 foreach (KeyValuePair<string, object> kvp
in map)
501 if (kvp.Key ==
"EstateBans")
503 result +=
"EstateBans:" + Environment.NewLine;
504 foreach (KeyValuePair<string, object> ban
in (Dictionary<string, object>)kvp.Value)
505 result += ban.Value.ToString();
508 result += string.Format(
"{0}: {1} {2}", kvp.Key, kvp.Value.ToString(), Environment.NewLine);
516 foreach (KeyValuePair<string, object> kvp
in map)
518 PropertyInfo p = this.GetType().GetProperty(kvp.Key, BindingFlags.Public | BindingFlags.Instance);
523 if (p.Name ==
"EstateBans")
526 if (p.PropertyType.IsArray)
528 string[] elements = ((string)map[p.Name]).Split(
new char[] {
',' });
529 UUID[] uuids =
new UUID[elements.Length];
531 foreach (
string e
in elements)
532 uuids[i++] =
new UUID(e);
533 p.SetValue(
this, uuids, null);
537 object value = p.GetValue(
this, null);
539 p.SetValue(
this, map[p.Name], null);
540 else if (value is UInt32)
541 p.SetValue(
this, UInt32.Parse((string)map[p.Name]), null);
542 else if (value is Boolean)
543 p.SetValue(
this, Boolean.Parse((string)map[p.Name]), null);
544 else if (value is UUID)
545 p.SetValue(
this, UUID.Parse((string)map[p.Name]), null);
550 if (map.ContainsKey(
"EstateBans"))
552 var banData = ((Dictionary<string, object>)map[
"EstateBans"]).Values;
555 foreach (Dictionary<string, object> ban
in banData)
557 PropertyInfo bansProperty = this.GetType().GetProperty(
"EstateBans", BindingFlags.Public | BindingFlags.Instance);
558 bansProperty.SetValue(
this, bans, null);
void AddEstateUser(UUID avatarID)
void RemoveBan(UUID avatarID)
EstateSettings(Dictionary< string, object > map)
Dictionary< string, object > ToMap()
bool IsBanned(UUID avatarID, int userFlags)
UUID BannedUserID
ID of the banned user.
void AddBan(EstateBan ban)
bool IsBanned(UUID avatarID)
void AddEstateManager(UUID avatarID)
void RemoveEstateGroup(UUID avatarID)
bool IsEstateManagerOrOwner(UUID avatarID)
void AddEstateGroup(UUID avatarID)
bool IsEstateOwner(UUID avatarID)
void SetFromFlags(ulong regionFlags)
bool HasAccess(UUID user)
bool GroupAccess(UUID groupID)
void RemoveEstateManager(UUID avatarID)
override string ToString()
For debugging
void RemoveEstateUser(UUID avatarID)