/// <summary> /// Changes the flags for all parcels on a region /// <summary> public object RegionChangeParcelFlagsHandler(IList args, IPEndPoint remoteClient) { m_admin.CheckSessionValid(new UUID((string)args[0])); Scene scene; if (!m_app.SceneManager.TryGetScene((string)args[1], out scene)) { throw new Exception("region not found"); } bool enable = args[2].ToString().ToLower() == "enable"; uint mask = Convert.ToUInt32(args[3]); m_log.Info("[RADMIN]: Received Region Change Parcel Flags Request"); lock (rslock) { try { ILandChannel channel = scene.LandChannel; List <ILandObject> parcels = channel.AllParcels(); foreach (var parcel in parcels) { LandData data = parcel.landData.Copy(); if (enable) { data.Flags = data.Flags | mask; } else { data.Flags = data.Flags & ~mask; } scene.LandChannel.UpdateLandObject(parcel.landData.LocalID, data); } m_log.Info("[RADMIN]: Change Parcel Flags Request complete"); return(true); } catch (Exception e) { m_log.InfoFormat("[RADMIN] ChangeParcelFlags: {0}", e.Message); m_log.DebugFormat("[RADMIN] ChangeParcelFlags: {0}", e.ToString()); } return(false); } }
public XmlNode RequestSnapshotData(XmlDocument nodeFactory) { XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "parceldata", ""); ILandChannel landChannel = m_scene.LandChannel; if (landChannel == null) { return(parent); } List <ILandObject> parcels = landChannel.AllParcels(); IDwellModule dwellModule = m_scene.RequestModuleInterface <IDwellModule>(); if (parcels != null) { //foreach (KeyValuePair<int, Land> curParcel in m_landIndexed) foreach (ILandObject parcel_interface in parcels) { // Play it safe if (!(parcel_interface is LandObject)) { continue; } LandObject land = (LandObject)parcel_interface; LandData parcel = land.LandData; if (m_parent.ExposureLevel.Equals("all") || (m_parent.ExposureLevel.Equals("minimum") && (parcel.Flags & (uint)ParcelFlags.ShowDirectory) == (uint)ParcelFlags.ShowDirectory)) { //TODO: make better method of marshalling data from LandData to XmlNode XmlNode xmlparcel = nodeFactory.CreateNode(XmlNodeType.Element, "parcel", ""); // Attributes of the parcel node XmlAttribute scripts_attr = nodeFactory.CreateAttribute("scripts"); scripts_attr.Value = GetScriptsPermissions(parcel); XmlAttribute build_attr = nodeFactory.CreateAttribute("build"); build_attr.Value = GetBuildPermissions(parcel); XmlAttribute public_attr = nodeFactory.CreateAttribute("public"); public_attr.Value = GetPublicPermissions(parcel); // Check the category of the Parcel XmlAttribute category_attr = nodeFactory.CreateAttribute("category"); category_attr.Value = ((int)parcel.Category).ToString(); // Check if the parcel is for sale XmlAttribute forsale_attr = nodeFactory.CreateAttribute("forsale"); forsale_attr.Value = CheckForSale(parcel); XmlAttribute sales_attr = nodeFactory.CreateAttribute("salesprice"); sales_attr.Value = parcel.SalePrice.ToString(); XmlAttribute directory_attr = nodeFactory.CreateAttribute("showinsearch"); directory_attr.Value = GetShowInSearch(parcel); //XmlAttribute entities_attr = nodeFactory.CreateAttribute("entities"); //entities_attr.Value = land.primsOverMe.Count.ToString(); xmlparcel.Attributes.Append(directory_attr); xmlparcel.Attributes.Append(scripts_attr); xmlparcel.Attributes.Append(build_attr); xmlparcel.Attributes.Append(public_attr); xmlparcel.Attributes.Append(category_attr); xmlparcel.Attributes.Append(forsale_attr); xmlparcel.Attributes.Append(sales_attr); //xmlparcel.Attributes.Append(entities_attr); //name, description, area, and UUID XmlNode name = nodeFactory.CreateNode(XmlNodeType.Element, "name", ""); name.InnerText = parcel.Name; xmlparcel.AppendChild(name); XmlNode desc = nodeFactory.CreateNode(XmlNodeType.Element, "description", ""); desc.InnerText = parcel.Description; xmlparcel.AppendChild(desc); XmlNode uuid = nodeFactory.CreateNode(XmlNodeType.Element, "uuid", ""); uuid.InnerText = parcel.GlobalID.ToString(); xmlparcel.AppendChild(uuid); XmlNode area = nodeFactory.CreateNode(XmlNodeType.Element, "area", ""); area.InnerText = parcel.Area.ToString(); xmlparcel.AppendChild(area); //default location XmlNode tpLocation = nodeFactory.CreateNode(XmlNodeType.Element, "location", ""); Vector3 loc = parcel.UserLocation; if (loc.Equals(Vector3.Zero)) // This test is moot at this point: the location is wrong by default { loc = new Vector3((parcel.AABBMax.X + parcel.AABBMin.X) / 2, (parcel.AABBMax.Y + parcel.AABBMin.Y) / 2, (parcel.AABBMax.Z + parcel.AABBMin.Z) / 2); } tpLocation.InnerText = loc.X.ToString() + "/" + loc.Y.ToString() + "/" + loc.Z.ToString(); xmlparcel.AppendChild(tpLocation); XmlNode infouuid = nodeFactory.CreateNode(XmlNodeType.Element, "infouuid", ""); uint x = (uint)loc.X, y = (uint)loc.Y; findPointInParcel(land, ref x, ref y); // find a suitable spot infouuid.InnerText = Util.BuildFakeParcelID( m_scene.RegionInfo.RegionHandle, x, y).ToString(); xmlparcel.AppendChild(infouuid); XmlNode dwell = nodeFactory.CreateNode(XmlNodeType.Element, "dwell", ""); if (dwellModule != null) { dwell.InnerText = dwellModule.GetDwell(parcel.GlobalID).ToString(); } else { dwell.InnerText = "0"; } xmlparcel.AppendChild(dwell); //TODO: figure how to figure out teleport system landData.landingType //land texture snapshot uuid if (parcel.SnapshotID != UUID.Zero) { XmlNode textureuuid = nodeFactory.CreateNode(XmlNodeType.Element, "image", ""); textureuuid.InnerText = parcel.SnapshotID.ToString(); xmlparcel.AppendChild(textureuuid); } string groupName = String.Empty; //attached user and group if (parcel.GroupID != UUID.Zero) { XmlNode groupblock = nodeFactory.CreateNode(XmlNodeType.Element, "group", ""); XmlNode groupuuid = nodeFactory.CreateNode(XmlNodeType.Element, "groupuuid", ""); groupuuid.InnerText = parcel.GroupID.ToString(); groupblock.AppendChild(groupuuid); IGroupsModule gm = m_scene.RequestModuleInterface <IGroupsModule>(); if (gm != null) { GroupRecord g = gm.GetGroupRecord(parcel.GroupID); if (g != null) { groupName = g.GroupName; } } XmlNode groupname = nodeFactory.CreateNode(XmlNodeType.Element, "groupname", ""); groupname.InnerText = groupName; groupblock.AppendChild(groupname); xmlparcel.AppendChild(groupblock); } XmlNode userblock = nodeFactory.CreateNode(XmlNodeType.Element, "owner", ""); UUID userOwnerUUID = parcel.OwnerID; XmlNode useruuid = nodeFactory.CreateNode(XmlNodeType.Element, "uuid", ""); useruuid.InnerText = userOwnerUUID.ToString(); userblock.AppendChild(useruuid); if (!parcel.IsGroupOwned) { try { XmlNode username = nodeFactory.CreateNode(XmlNodeType.Element, "name", ""); UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, userOwnerUUID); if (account != null) { username.InnerText = account.FirstName + " " + account.LastName; } else { username.InnerText = "UnKnown"; } userblock.AppendChild(username); } catch (Exception) { //m_log.Info("[DATASNAPSHOT]: Cannot find owner name; ignoring this parcel"); } } else { XmlNode username = nodeFactory.CreateNode(XmlNodeType.Element, "name", ""); username.InnerText = groupName; userblock.AppendChild(username); } xmlparcel.AppendChild(userblock); parent.AppendChild(xmlparcel); } } //snap.AppendChild(parent); } this.Stale = false; return(parent); }
public List <ILandObject> AllParcels() { return(RootRegionLandChannel.AllParcels()); }