public void ModifyFlags(ParcelFlags affected, ParcelFlags value) { lock (m_Lock) { ParcelFlags flags = Flags; flags &= (~affected); Flags = flags | (value & affected); } }
public static void ParcelSetFlag(ParcelFlags F, Parcel p, bool set) { if (p.Flags.HasFlag(F)) { p.Flags -= F; } if (set == true) { p.Flags |= F; } }
private void Dosetflag(ParcelFlags F, Parcel p, bool set) { ConsoleLog.Warn("Setting flag: " + F.ToString() + " To " + set.ToString() + " at " + p.Name + ""); if (p.Flags.HasFlag(F)) { p.Flags -= F; } if (set == true) { p.Flags |= F; } }
/// <summary> /// Copy constructor /// </summary> public SceneParcel(SceneParcel parcel) { if (parcel.AccessBlackList != null) { AccessBlackList = new List <ParcelAccessEntry>(parcel.AccessBlackList); } if (parcel.AccessWhiteList != null) { AccessWhiteList = new List <ParcelAccessEntry>(parcel.AccessWhiteList); } AuthBuyerID = parcel.AuthBuyerID; AutoReturnTime = parcel.AutoReturnTime; Bitmap = new byte[512]; Buffer.BlockCopy(parcel.Bitmap, 0, Bitmap, 0, 512); Category = parcel.Category; ClaimDate = parcel.ClaimDate; Desc = parcel.Desc; Dwell = parcel.Dwell; Flags = parcel.Flags; GroupID = parcel.GroupID; IsGroupOwned = parcel.IsGroupOwned; Landing = parcel.Landing; LocalID = parcel.LocalID; MaxPrims = parcel.MaxPrims; ParcelMedia oldMedia = parcel.Media; Media = new ParcelMedia { MediaAutoScale = oldMedia.MediaAutoScale, MediaDesc = oldMedia.MediaDesc, MediaHeight = oldMedia.MediaHeight, MediaID = oldMedia.MediaID, MediaLoop = oldMedia.MediaLoop, MediaType = oldMedia.MediaType, MediaURL = oldMedia.MediaURL, MediaWidth = oldMedia.MediaWidth }; MusicURL = parcel.MusicURL; Name = parcel.Name; ObscureMedia = parcel.ObscureMedia; ObscureMusic = parcel.ObscureMusic; OwnerID = parcel.OwnerID; PassHours = parcel.PassHours; PassPrice = parcel.PassPrice; DenyAgeUnverified = parcel.DenyAgeUnverified; DenyAnonymous = parcel.DenyAnonymous; PushOverride = parcel.PushOverride; SalePrice = parcel.SalePrice; SnapshotID = parcel.SnapshotID; Status = parcel.Status; LandingLocation = parcel.LandingLocation; LandingLookAt = parcel.LandingLookAt; }
public static Dictionary <string, ParcelFlags> get_flags_list() { Dictionary <string, ParcelFlags> flags = new Dictionary <string, ParcelFlags>(); Type enumType = typeof(ParcelFlags); Array enumValues = Enum.GetValues(enumType); Array enumNames = Enum.GetNames(enumType); for (int i = 0; i < enumValues.Length; i++) { object value = enumValues.GetValue(i); ParcelFlags realValue = (ParcelFlags)value; if (realValue != 0) { string name = (string)enumNames.GetValue(i); flags.Add(name, realValue); } } return(flags); }
OSDMap GetParcelsByRegion(OSDMap map) { var resp = new OSDMap(); resp ["Parcels"] = new OSDArray(); resp ["Total"] = OSD.FromInteger(0); var directory = DataPlugins.RequestPlugin <IDirectoryServiceConnector> (); if (directory != null && map.ContainsKey("Region") == true) { UUID regionID = UUID.Parse(map ["Region"]); // not used? // UUID scopeID = map.ContainsKey ("ScopeID") ? UUID.Parse (map ["ScopeID"].ToString ()) : UUID.Zero; UUID owner = map.ContainsKey("Owner") ? UUID.Parse(map ["Owner"].ToString()) : UUID.Zero; uint start = map.ContainsKey("Start") ? uint.Parse(map ["Start"].ToString()) : 0; uint count = map.ContainsKey("Count") ? uint.Parse(map ["Count"].ToString()) : 10; ParcelFlags flags = map.ContainsKey("Flags") ? (ParcelFlags)int.Parse(map ["Flags"].ToString()) : ParcelFlags.None; ParcelCategory category = map.ContainsKey("Category") ? (ParcelCategory)uint.Parse(map ["Flags"].ToString()) : ParcelCategory.Any; uint total = directory.GetNumberOfParcelsByRegion(regionID, owner, flags, category); if (total > 0) { resp ["Total"] = OSD.FromInteger((int)total); if (count == 0) { return(resp); } List <LandData> regionParcels = directory.GetParcelsByRegion(start, count, regionID, owner, flags, category); OSDArray parcels = new OSDArray(regionParcels.Count); regionParcels.ForEach(delegate(LandData parcel) { parcels.Add(LandData2WebOSD(parcel)); }); resp ["Parcels"] = parcels; } } return(resp); }
private static QueryFilter GetParcelsByRegionWhereClause(UUID RegionID, UUID owner, ParcelFlags flags, ParcelCategory category) { QueryFilter filter = new QueryFilter(); filter.andFilters["RegionID"] = RegionID; if (owner != UUID.Zero) { filter.andFilters["OwnerID"] = owner; } if (flags != ParcelFlags.None) { filter.andBitfieldAndFilters["Flags"] = (uint)flags; } if (category != ParcelCategory.Any) { filter.andFilters["Category"] = (int)category; } return filter; }
public uint GetNumberOfParcelsByRegion(UUID RegionID, UUID scopeID, UUID owner, ParcelFlags flags, ParcelCategory category) { IRegionData regiondata = DataManager.DataManager.RequestPlugin<IRegionData>(); if (regiondata != null) { GridRegion region = regiondata.Get(RegionID, scopeID); if (region != null) { return uint.Parse(GD.Query(GetParcelsByRegionWhereClause(RegionID, scopeID, owner, flags, category), "searchparcel", "COUNT(ParcelID)")[0]); } } return 0; }
public List<LandData> GetParcelsByRegion(uint start, uint count, UUID RegionID, UUID scopeID, UUID owner, ParcelFlags flags, ParcelCategory category) { List<LandData> resp = new List<LandData>(0); if (count == 0) { return resp; } IRegionData regiondata = DataManager.DataManager.RequestPlugin<IRegionData>(); if (regiondata != null) { GridRegion region = regiondata.Get(RegionID, scopeID); if (region != null) { string whereClause = GetParcelsByRegionWhereClause(RegionID, scopeID, owner, flags, category); whereClause += " ORDER BY OwnerID DESC, Name DESC"; whereClause += string.Format(" LIMIT {0}, {1}", start, count); return Query2LandData(GD.Query(whereClause, "searchparcel", "*")); } } return resp; }
private static string GetParcelsByRegionWhereClause(UUID RegionID, UUID scopeID, UUID owner, ParcelFlags flags, ParcelCategory category) { string whereClause = string.Format("RegionID = '{0}'", RegionID); if (owner != UUID.Zero) { whereClause += string.Format(" AND OwnerID = '{0}'", owner); } if (flags != ParcelFlags.None) { whereClause += string.Format(" AND Flags & {0}", flags); } if (category != ParcelCategory.Any) { whereClause += string.Format(" AND Category = {0,D}", category); } return whereClause; }
private bool OnAllowedIncomingTeleport(UUID userID, IScene scene, Vector3 Position, out Vector3 newPosition, out string reason) { newPosition = Position; UserAccount account = scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, userID); IScenePresence Sp = scene.GetScenePresence(userID); if (account == null) { reason = "Failed authentication."; return(false); //NO! } //Make sure that this user is inside the region as well if (Position.X < -2f || Position.Y < -2f || Position.X > scene.RegionInfo.RegionSizeX + 2 || Position.Y > scene.RegionInfo.RegionSizeY + 2) { m_log.DebugFormat( "[EstateService]: AllowedIncomingTeleport was given an illegal position of {0} for avatar {1}, {2}. Clamping", Position, Name, userID); bool changedX = false; bool changedY = false; while (Position.X < 0) { Position.X += scene.RegionInfo.RegionSizeX; changedX = true; } while (Position.X > scene.RegionInfo.RegionSizeX) { Position.X -= scene.RegionInfo.RegionSizeX; changedX = true; } while (Position.Y < 0) { Position.Y += scene.RegionInfo.RegionSizeY; changedY = true; } while (Position.Y > scene.RegionInfo.RegionSizeY) { Position.Y -= scene.RegionInfo.RegionSizeY; changedY = true; } if (changedX) { Position.X = scene.RegionInfo.RegionSizeX - Position.X; } if (changedY) { Position.Y = scene.RegionInfo.RegionSizeY - Position.Y; } } //Check that we are not underground as well float posZLimit = scene.RequestModuleInterface <ITerrainChannel>()[(int)Position.X, (int)Position.Y] + (float)1.25; if (posZLimit >= (Position.Z) && !(Single.IsInfinity(posZLimit) || Single.IsNaN(posZLimit))) { Position.Z = posZLimit; } IAgentConnector AgentConnector = DataManager.DataManager.RequestPlugin <IAgentConnector>(); IAgentInfo agentInfo = null; if (AgentConnector != null) { agentInfo = AgentConnector.GetAgent(userID); } ILandObject ILO = null; IParcelManagementModule parcelManagement = scene.RequestModuleInterface <IParcelManagementModule>(); if (parcelManagement != null) { ILO = parcelManagement.GetLandObject(Position.X, Position.Y); } if (ILO == null) { //Can't find land, give them the first parcel in the region and find a good position for them ILO = parcelManagement.AllParcels()[0]; Position = parcelManagement.GetParcelCenterAtGround(ILO); } //parcel permissions if (ILO.IsBannedFromLand(userID)) //Note: restricted is dealt with in the next block { if (Sp == null) { reason = "Banned from this parcel."; return(true); } if (!FindUnBannedParcel(Position, Sp, userID, out ILO, out newPosition, out reason)) { //We found a place for them, but we don't need to check any further return(true); } } //Move them out of banned parcels ParcelFlags parcelflags = (ParcelFlags)ILO.LandData.Flags; if ((parcelflags & ParcelFlags.UseAccessGroup) == ParcelFlags.UseAccessGroup && (parcelflags & ParcelFlags.UseAccessList) == ParcelFlags.UseAccessList && (parcelflags & ParcelFlags.UsePassList) == ParcelFlags.UsePassList) { //One of these is in play then if ((parcelflags & ParcelFlags.UseAccessGroup) == ParcelFlags.UseAccessGroup) { if (Sp == null) { reason = "Banned from this parcel."; return(true); } if (Sp.ControllingClient.ActiveGroupId != ILO.LandData.GroupID) { if (!FindUnBannedParcel(Position, Sp, userID, out ILO, out newPosition, out reason)) { //We found a place for them, but we don't need to check any further return(true); } } } else if ((parcelflags & ParcelFlags.UseAccessList) == ParcelFlags.UseAccessList) { if (Sp == null) { reason = "Banned from this parcel."; return(true); } //All but the people on the access list are banned if (ILO.IsRestrictedFromLand(userID)) { if (!FindUnBannedParcel(Position, Sp, userID, out ILO, out newPosition, out reason)) { //We found a place for them, but we don't need to check any further return(true); } } } else if ((parcelflags & ParcelFlags.UsePassList) == ParcelFlags.UsePassList) { if (Sp == null) { reason = "Banned from this parcel."; return(true); } //All but the people on the pass/access list are banned if (ILO.IsRestrictedFromLand(Sp.UUID)) { if (!FindUnBannedParcel(Position, Sp, userID, out ILO, out newPosition, out reason)) { //We found a place for them, but we don't need to check any further return(true); } } } } EstateSettings ES = scene.RegionInfo.EstateSettings; //Move them to the nearest landing point if (!ES.AllowDirectTeleport) { if (!scene.Permissions.IsGod(userID)) { Telehub telehub = RegionConnector.FindTelehub(scene.RegionInfo.RegionID, scene.RegionInfo.RegionHandle); if (telehub != null) { if (telehub.SpawnPos.Count == 0) { Position = new Vector3(telehub.TelehubLocX, telehub.TelehubLocY, telehub.TelehubLocZ); } else { int LastTelehubNum = 0; if (!LastTelehub.TryGetValue(scene.RegionInfo.RegionID, out LastTelehubNum)) { LastTelehubNum = 0; } Position = telehub.SpawnPos[LastTelehubNum] + new Vector3(telehub.TelehubLocX, telehub.TelehubLocY, telehub.TelehubLocZ); LastTelehubNum++; if (LastTelehubNum == telehub.SpawnPos.Count) { LastTelehubNum = 0; } LastTelehub[scene.RegionInfo.RegionID] = LastTelehubNum; } } } } if (!scene.Permissions.GenericParcelPermission(userID, ILO, (ulong)GroupPowers.None)) { if (ILO.LandData.LandingType == 2) //Blocked, force this person off this land { //Find a new parcel for them List <ILandObject> Parcels = parcelManagement.ParcelsNearPoint(Position); if (Parcels.Count == 0) { IScenePresence SP; scene.TryGetScenePresence(userID, out SP); newPosition = parcelManagement.GetNearestRegionEdgePosition(SP); } else { bool found = false; //We need to check here as well for bans, can't toss someone into a parcel they are banned from foreach (ILandObject Parcel in Parcels) { if (!Parcel.IsBannedFromLand(userID)) { //Now we have to check their userloc if (ILO.LandData.LandingType == 2) { continue; //Blocked, check next one } else if (ILO.LandData.LandingType == 1) //Use their landing spot { newPosition = Parcel.LandData.UserLocation; } else //They allow for anywhere, so dump them in the center at the ground { newPosition = parcelManagement.GetParcelCenterAtGround(Parcel); } found = true; } } if (!found) //Dump them at the edge { if (Sp != null) { newPosition = parcelManagement.GetNearestRegionEdgePosition(Sp); } else { reason = "Banned from this parcel."; return(true); } } } } else if (ILO.LandData.LandingType == 1) //Move to tp spot { if (ILO.LandData.UserLocation != Vector3.Zero) { newPosition = ILO.LandData.UserLocation; } else // Dump them at the nearest region corner since they havn't set a landing point { newPosition = parcelManagement.GetNearestRegionEdgePosition(Sp); } } } //We assume that our own region isn't null.... if (agentInfo != null) { //Can only enter prelude regions once! int flags = scene.GridService.GetRegionFlags(scene.RegionInfo.ScopeID, scene.RegionInfo.RegionID); if (flags != -1 && ((flags & (int)Aurora.Framework.RegionFlags.Prelude) == (int)Aurora.Framework.RegionFlags.Prelude) && agentInfo != null) { if (agentInfo.OtherAgentInformation.ContainsKey("Prelude" + scene.RegionInfo.RegionID)) { reason = "You may not enter this region as you have already been to this prelude region."; return(false); } else { agentInfo.OtherAgentInformation.Add("Prelude" + scene.RegionInfo.RegionID, OSD.FromInteger((int)IAgentFlags.PastPrelude)); AgentConnector.UpdateAgent(agentInfo); //This only works for standalones... and thats ok } } } if ((ILO.LandData.Flags & (int)ParcelFlags.DenyAnonymous) != 0) { if ((account.UserFlags & (int)IUserProfileInfo.ProfileFlags.NoPaymentInfoOnFile) == (int)IUserProfileInfo.ProfileFlags.NoPaymentInfoOnFile) { reason = "You may not enter this region."; return(false); } } if ((ILO.LandData.Flags & (uint)ParcelFlags.DenyAgeUnverified) != 0 && agentInfo != null) { if ((agentInfo.Flags & IAgentFlags.Minor) == IAgentFlags.Minor) { reason = "You may not enter this region."; return(false); } } newPosition = Position; reason = ""; return(true); }
public uint GetNumberOfParcelsByRegion(UUID RegionID, UUID scopeID, UUID owner, ParcelFlags flags, ParcelCategory category) { Dictionary <string, object> mess = new Dictionary <string, object>(); mess["Method"] = "GetNumberOfParcelsByRegion"; mess["RegionID"] = RegionID; mess["scopeID"] = scopeID; mess["owner"] = owner; mess["flags"] = (uint)flags; mess["category"] = (int)category; string reqString = WebUtils.BuildXmlResponse(mess); List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("RemoteServerURI"); foreach (string m_ServerURI in m_ServerURIs) { string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, reqString); if (reply != string.Empty) { Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); if (replyData != null) { Dictionary <string, object> .ValueCollection replyvalues = replyData.Values; uint numParcels = 0; foreach (object f in replyvalues.Where(f => uint.TryParse(f.ToString(), out numParcels))) { break; } // Success return(numParcels); } } } return(0); }
public List <LandData> GetParcelsByRegion(uint start, uint count, UUID RegionID, UUID scopeID, UUID owner, ParcelFlags flags, ParcelCategory category) { List <LandData> resp = new List <LandData>(0); if (count == 0) { return(resp); } IRegionData regiondata = DataManager.DataManager.RequestPlugin <IRegionData>(); if (regiondata != null) { GridRegion region = regiondata.Get(RegionID, scopeID); if (region != null) { QueryFilter filter = GetParcelsByRegionWhereClause(RegionID, scopeID, owner, flags, category); Dictionary <string, bool> sort = new Dictionary <string, bool>(1); sort["OwnerID"] = false; return(Query2LandData(GD.Query(new string[1] { "*" }, "searchparcel", filter, sort, start, count))); } } return(resp); }
/// <summary> /// Deserialize the message /// </summary> /// <param name="map">An <see cref="OSDMap"/> containing the data</param> public void Deserialize(OSDMap map) { AuthBuyerID = map["auth_buyer_id"].AsUUID(); MediaAutoScale = map["auto_scale"].AsBoolean(); Category = (ParcelCategory)map["category"].AsInteger(); Desc = map["description"].AsString(); GroupID = map["group_id"].AsUUID(); Landing = (LandingType)map["landing_type"].AsUInteger(); LocalID = map["local_id"].AsInteger(); MediaDesc = map["media_desc"].AsString(); MediaHeight = map["media_height"].AsInteger(); MediaLoop = map["media_loop"].AsBoolean(); MediaID = map["media_id"].AsUUID(); MediaType = map["media_type"].AsString(); MediaURL = map["media_url"].AsString(); MediaWidth = map["media_width"].AsInteger(); MusicURL = map["music_url"].AsString(); Name = map["name"].AsString(); ObscureMedia = map["obscure_media"].AsBoolean(); ObscureMusic = map["obscure_music"].AsBoolean(); ParcelFlags = (ParcelFlags)map["parcel_flags"].AsUInteger(); PassHours = (float)map["pass_hours"].AsReal(); PassPrice = map["pass_price"].AsUInteger(); Privacy = map["privacy"].AsBoolean(); SalePrice = map["sale_price"].AsUInteger(); SnapshotID = map["snapshot_id"].AsUUID(); UserLocation = map["user_location"].AsVector3(); UserLookAt = map["user_look_at"].AsVector3(); }
/// <summary> /// Construct a new instance of the ParcelMediaCommandEventArgs class /// </summary> /// <param name="simulator">The simulator the parcel media command was issued in</param> /// <param name="sequence"></param> /// <param name="flags"></param> /// <param name="command">The media command that was sent</param> /// <param name="time"></param> public ParcelMediaCommandEventArgs(Simulator simulator, uint sequence, ParcelFlags flags, ParcelMediaCommand command, float time) { this.m_Simulator = simulator; this.m_Sequence = sequence; this.m_ParcelFlags = flags; this.m_MediaCommand = command; this.m_Time = time; }
public List<LandData> GetParcelsByRegion(uint start, uint count, UUID RegionID, UUID owner, ParcelFlags flags, ParcelCategory category) { object remoteValue = DoRemote(start, count, RegionID, owner, flags, category); if (remoteValue != null || m_doRemoteOnly) return (List<LandData>)remoteValue; List<LandData> resp = new List<LandData>(0); if (count == 0) { return resp; } IRegionData regiondata = DataManager.DataManager.RequestPlugin<IRegionData>(); if (regiondata != null) { GridRegion region = regiondata.Get(RegionID, null); if (region != null) { QueryFilter filter = GetParcelsByRegionWhereClause(RegionID, owner, flags, category); Dictionary<string, bool> sort = new Dictionary<string, bool>(1); sort["OwnerID"] = false; return Query2LandData(GD.Query(new[] { "*" }, "searchparcel", filter, sort, start, count)); } } return resp; }
public uint GetNumberOfParcelsByRegion(UUID RegionID, UUID scopeID, UUID owner, ParcelFlags flags, ParcelCategory category) { Dictionary<string, object> mess = new Dictionary<string, object>(); mess["Method"] = "GetNumberOfParcelsByRegion"; mess["RegionID"] = RegionID; mess["scopeID"] = scopeID; mess["owner"] = owner; mess["flags"] = (uint)flags; mess["category"] = (int)category; string reqString = WebUtils.BuildXmlResponse(mess); List<string> m_ServerURIs = m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("RemoteServerURI"); foreach (string m_ServerURI in m_ServerURIs) { string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, reqString); if (reply != string.Empty) { Dictionary<string, object> replyData = WebUtils.ParseXmlResponse(reply); if (replyData != null) { Dictionary<string, object>.ValueCollection replyvalues = replyData.Values; uint numParcels = 0; foreach (object f in replyvalues.Where(f => uint.TryParse(f.ToString(), out numParcels))) { break; } // Success return numParcels; } } } return 0; }
public List<LandData> GetParcelsByRegion(uint start, uint count, UUID RegionID, UUID scopeID, UUID owner, ParcelFlags flags, ParcelCategory category) { List<LandData> resp = new List<LandData>(0); if (count == 0) { return resp; } OSDMap mess = new OSDMap(); mess["Method"] = "GetParcelsByRegion"; mess["start"] = OSD.FromUInteger(start); mess["count"] = OSD.FromUInteger(count); mess["RegionID"] = OSD.FromUUID(RegionID); mess["scopeID"] = OSD.FromUUID(scopeID); mess["owner"] = OSD.FromUUID(owner); mess["flags"] = OSD.FromUInteger((uint)flags); mess["category"] = OSD.FromInteger((int)category); List<string> m_ServerURIs = m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("RemoteServerURI"); resp = new List<LandData>(); foreach (string m_ServerURI in m_ServerURIs) { OSDMap results = WebUtils.PostToService(m_ServerURI + "osd", mess, true, false); OSDMap innerResults = (OSDMap)OSDParser.DeserializeJson(results["_RawResult"]); OSDArray parcels = (OSDArray)innerResults["Parcels"]; foreach (OSD o in parcels) { resp.Add(new LandData((OSDMap)o)); } break; } return resp; }
private bool OnAllowedIncomingTeleport(UUID userID, IScene scene, Vector3 Position, uint TeleportFlags, out Vector3 newPosition, out string reason) { newPosition = Position; UserAccount account = scene.UserAccountService.GetUserAccount(scene.RegionInfo.AllScopeIDs, userID); IScenePresence Sp = scene.GetScenePresence(userID); if (account == null) { reason = "Failed authentication."; return(false); //NO! } //Make sure that this user is inside the region as well if (Position.X < -2f || Position.Y < -2f || Position.X > scene.RegionInfo.RegionSizeX + 2 || Position.Y > scene.RegionInfo.RegionSizeY + 2) { MainConsole.Instance.DebugFormat( "[EstateService]: AllowedIncomingTeleport was given an illegal position of {0} for avatar {1}, {2}. Clamping", Position, Name, userID); bool changedX = false; bool changedY = false; while (Position.X < 0) { Position.X += scene.RegionInfo.RegionSizeX; changedX = true; } while (Position.X > scene.RegionInfo.RegionSizeX) { Position.X -= scene.RegionInfo.RegionSizeX; changedX = true; } while (Position.Y < 0) { Position.Y += scene.RegionInfo.RegionSizeY; changedY = true; } while (Position.Y > scene.RegionInfo.RegionSizeY) { Position.Y -= scene.RegionInfo.RegionSizeY; changedY = true; } if (changedX) { Position.X = scene.RegionInfo.RegionSizeX - Position.X; } if (changedY) { Position.Y = scene.RegionInfo.RegionSizeY - Position.Y; } } IAgentConnector AgentConnector = Framework.Utilities.DataManager.RequestPlugin <IAgentConnector>(); IAgentInfo agentInfo = null; if (AgentConnector != null) { agentInfo = AgentConnector.GetAgent(userID); } ILandObject ILO = null; IParcelManagementModule parcelManagement = scene.RequestModuleInterface <IParcelManagementModule>(); if (parcelManagement != null) { ILO = parcelManagement.GetLandObject(Position.X, Position.Y); } if (ILO == null) { if (Sp != null) { Sp.ClearSavedVelocity(); //If we are moving the agent, clear their velocity } //Can't find land, give them the first parcel in the region and find a good position for them ILO = parcelManagement.AllParcels()[0]; Position = parcelManagement.GetParcelCenterAtGround(ILO); } //parcel permissions if (ILO.IsBannedFromLand(userID)) //Note: restricted is dealt with in the next block { if (Sp != null) { Sp.ClearSavedVelocity(); //If we are moving the agent, clear their velocity } if (Sp == null) { reason = "Banned from this parcel."; return(false); } if (!FindUnBannedParcel(Position, Sp, userID, out ILO, out newPosition, out reason)) { } } //Move them out of banned parcels ParcelFlags parcelflags = (ParcelFlags)ILO.LandData.Flags; if ((parcelflags & ParcelFlags.UseAccessGroup) == ParcelFlags.UseAccessGroup && (parcelflags & ParcelFlags.UseAccessList) == ParcelFlags.UseAccessList && (parcelflags & ParcelFlags.UsePassList) == ParcelFlags.UsePassList) { if (Sp != null) { Sp.ClearSavedVelocity(); //If we are moving the agent, clear their velocity } //One of these is in play then if ((parcelflags & ParcelFlags.UseAccessGroup) == ParcelFlags.UseAccessGroup) { if (Sp == null) { reason = "Banned from this parcel."; return(false); } if (Sp.ControllingClient.ActiveGroupId != ILO.LandData.GroupID) { if (!FindUnBannedParcel(Position, Sp, userID, out ILO, out newPosition, out reason)) { } } } else if ((parcelflags & ParcelFlags.UseAccessList) == ParcelFlags.UseAccessList) { if (Sp == null) { reason = "Banned from this parcel."; return(false); } //All but the people on the access list are banned if (ILO.IsRestrictedFromLand(userID)) { if (!FindUnBannedParcel(Position, Sp, userID, out ILO, out newPosition, out reason)) { } } } else if ((parcelflags & ParcelFlags.UsePassList) == ParcelFlags.UsePassList) { if (Sp == null) { reason = "Banned from this parcel."; return(false); } //All but the people on the pass/access list are banned if (ILO.IsRestrictedFromLand(Sp.UUID)) { if (!FindUnBannedParcel(Position, Sp, userID, out ILO, out newPosition, out reason)) { } } } } EstateSettings ES = scene.RegionInfo.EstateSettings; TeleportFlags tpflags = (TeleportFlags)TeleportFlags; const TeleportFlags allowableFlags = OpenMetaverse.TeleportFlags.ViaLandmark | OpenMetaverse.TeleportFlags.ViaHome | OpenMetaverse.TeleportFlags.ViaLure | OpenMetaverse.TeleportFlags.ForceRedirect | OpenMetaverse.TeleportFlags.Godlike | OpenMetaverse.TeleportFlags.NineOneOne; //If the user wants to force landing points on crossing, we act like they are not crossing, otherwise, check the child property and that the ViaRegionID is set bool isCrossing = !ForceLandingPointsOnCrossing && (Sp != null && Sp.IsChildAgent && ((tpflags & OpenMetaverse.TeleportFlags.ViaRegionID) == OpenMetaverse.TeleportFlags.ViaRegionID)); //Move them to the nearest landing point if (!((tpflags & allowableFlags) != 0) && !isCrossing && !ES.AllowDirectTeleport) { if (Sp != null) { Sp.ClearSavedVelocity(); //If we are moving the agent, clear their velocity } if (!scene.Permissions.IsGod(userID)) { Telehub telehub = RegionConnector.FindTelehub(scene.RegionInfo.RegionID, scene.RegionInfo.RegionHandle); if (telehub != null) { if (telehub.SpawnPos.Count == 0) { Position = new Vector3(telehub.TelehubLocX, telehub.TelehubLocY, telehub.TelehubLocZ); } else { int LastTelehubNum = 0; if (!LastTelehub.TryGetValue(scene.RegionInfo.RegionID, out LastTelehubNum)) { LastTelehubNum = 0; } Position = telehub.SpawnPos[LastTelehubNum] + new Vector3(telehub.TelehubLocX, telehub.TelehubLocY, telehub.TelehubLocZ); LastTelehubNum++; if (LastTelehubNum == telehub.SpawnPos.Count) { LastTelehubNum = 0; } LastTelehub[scene.RegionInfo.RegionID] = LastTelehubNum; } } } } else if (!((tpflags & allowableFlags) != 0) && !isCrossing && !scene.Permissions.GenericParcelPermission(userID, ILO, (ulong)GroupPowers.None)) //Telehubs override parcels { if (Sp != null) { Sp.ClearSavedVelocity(); //If we are moving the agent, clear their velocity } if (ILO.LandData.LandingType == (int)LandingType.None) //Blocked, force this person off this land { //Find a new parcel for them List <ILandObject> Parcels = parcelManagement.ParcelsNearPoint(Position); if (Parcels.Count > 1) { newPosition = parcelManagement.GetNearestRegionEdgePosition(Sp); } else { bool found = false; //We need to check here as well for bans, can't toss someone into a parcel they are banned from foreach (ILandObject Parcel in Parcels.Where(Parcel => !Parcel.IsBannedFromLand(userID))) { //Now we have to check their userloc if (ILO.LandData.LandingType == (int)LandingType.None) { continue; //Blocked, check next one } else if (ILO.LandData.LandingType == (int)LandingType.LandingPoint) { //Use their landing spot newPosition = Parcel.LandData.UserLocation; } else //They allow for anywhere, so dump them in the center at the ground { newPosition = parcelManagement.GetParcelCenterAtGround(Parcel); } found = true; } if (!found) //Dump them at the edge { if (Sp != null) { newPosition = parcelManagement.GetNearestRegionEdgePosition(Sp); } else { reason = "Banned from this parcel."; return(false); } } } } else if (ILO.LandData.LandingType == (int)LandingType.LandingPoint) //Move to tp spot { newPosition = ILO.LandData.UserLocation != Vector3.Zero ? ILO.LandData.UserLocation : parcelManagement.GetNearestRegionEdgePosition(Sp); } } //We assume that our own region isn't null.... if (agentInfo != null) { //Can only enter prelude regions once! if (scene.RegionInfo.RegionFlags != -1 && ((scene.RegionInfo.RegionFlags & (int)RegionFlags.Prelude) == (int)RegionFlags.Prelude) && agentInfo != null) { if (agentInfo.OtherAgentInformation.ContainsKey("Prelude" + scene.RegionInfo.RegionID)) { reason = "You may not enter this region as you have already been to this prelude region."; return(false); } else { agentInfo.OtherAgentInformation.Add("Prelude" + scene.RegionInfo.RegionID, OSD.FromInteger((int)IAgentFlags.PastPrelude)); AgentConnector.UpdateAgent(agentInfo); } } if (agentInfo.OtherAgentInformation.ContainsKey("LimitedToEstate")) { int LimitedToEstate = agentInfo.OtherAgentInformation["LimitedToEstate"]; if (scene.RegionInfo.EstateSettings.EstateID != LimitedToEstate) { reason = "You may not enter this reason, as it is outside of the estate you are limited to."; return(false); } } } if ((ILO.LandData.Flags & (int)ParcelFlags.DenyAnonymous) != 0) { if (account != null && (account.UserFlags & (int)IUserProfileInfo.ProfileFlags.NoPaymentInfoOnFile) == (int)IUserProfileInfo.ProfileFlags.NoPaymentInfoOnFile) { reason = "You may not enter this region."; return(false); } } if ((ILO.LandData.Flags & (uint)ParcelFlags.DenyAgeUnverified) != 0 && agentInfo != null) { if ((agentInfo.Flags & IAgentFlags.Minor) == IAgentFlags.Minor) { reason = "You may not enter this region."; return(false); } } //Check that we are not underground as well ITerrainChannel chan = scene.RequestModuleInterface <ITerrainChannel>(); if (chan != null) { float posZLimit = chan[(int)newPosition.X, (int)newPosition.Y] + (float)1.25; if (posZLimit >= (newPosition.Z) && !(Single.IsInfinity(posZLimit) || Single.IsNaN(posZLimit))) { newPosition.Z = posZLimit; } } reason = ""; return(true); }
public uint GetNumberOfParcelsByRegion(UUID RegionID, UUID owner, ParcelFlags flags, ParcelCategory category) { object remoteValue = DoRemote(RegionID, owner, flags, category); if (remoteValue != null || m_doRemoteOnly) return (uint)remoteValue; IRegionData regiondata = DataManager.DataManager.RequestPlugin<IRegionData>(); if (regiondata != null) { GridRegion region = regiondata.Get(RegionID, null); if (region != null) { QueryFilter filter = GetParcelsByRegionWhereClause(RegionID, owner, flags, category); return uint.Parse(GD.Query(new[] { "COUNT(ParcelID)" }, "searchparcel", filter, null, null, null)[0]); } } return 0; }
/// <summary> /// Defalt constructor /// </summary> /// <param name="localID">Local ID of this parcel</param> public Parcel(int localID) { LocalID = localID; SelfCount = 0; OtherCount = 0; PublicCount = 0; OwnerID = Guid.Empty; IsGroupOwned = false; AuctionID = 0; ClaimDate = Utils.Epoch; ClaimPrice = 0; RentPrice = 0; AABBMin = Vector3f.Zero; AABBMax = Vector3f.Zero; Bitmap = new byte[0]; Area = 0; Status = ParcelStatus.None; SimWideMaxPrims = 0; SimWideTotalPrims = 0; MaxPrims = 0; TotalPrims = 0; OwnerPrims = 0; GroupPrims = 0; OtherPrims = 0; ParcelPrimBonus = 0; OtherCleanTime = 0; Flags = ParcelFlags.None; SalePrice = 0; Name = String.Empty; Desc = String.Empty; MusicURL = String.Empty; GroupID = Guid.Empty; PassPrice = 0; PassHours = 0; Category = ParcelCategory.None; AuthBuyerID = Guid.Empty; SnapshotID = Guid.Empty; UserLocation = Vector3f.Zero; UserLookAt = Vector3f.Zero; Landing = LandingType.None; Dwell = 0; RegionDenyAnonymous = false; RegionPushOverride = false; AccessWhiteList = new List<ParcelManager.ParcelAccessEntry>(); AccessBlackList = new List<ParcelManager.ParcelAccessEntry>(0); RegionDenyAgeUnverified = false; Media = new ParcelMedia(); ObscureMedia = false; ObscureMusic = false; }
/// <summary> /// Deserialize the message /// </summary> /// <param name="map">An <see cref="OSDMap"/> containing the data</param> public void Deserialize(OSDMap map) { OSDMap parcelDataMap = (OSDMap)((OSDArray)map["ParcelData"])[0]; LocalID = parcelDataMap["LocalID"].AsInteger(); AABBMax = parcelDataMap["AABBMax"].AsVector3(); AABBMin = parcelDataMap["AABBMin"].AsVector3(); Area = parcelDataMap["Area"].AsInteger(); AuctionID = (uint)parcelDataMap["AuctionID"].AsInteger(); AuthBuyerID = parcelDataMap["AuthBuyerID"].AsUUID(); Bitmap = parcelDataMap["Bitmap"].AsBinary(); Category = (ParcelCategory)parcelDataMap["Category"].AsInteger(); ClaimDate = Utils.UnixTimeToDateTime((uint)parcelDataMap["ClaimDate"].AsInteger()); ClaimPrice = parcelDataMap["ClaimPrice"].AsInteger(); Desc = parcelDataMap["Desc"].AsString(); // LL sends this as binary, we'll convert it here if (parcelDataMap["ParcelFlags"].Type == OSDType.Binary) { byte[] bytes = parcelDataMap["ParcelFlags"].AsBinary(); if (BitConverter.IsLittleEndian) Array.Reverse(bytes); ParcelFlags = (ParcelFlags)BitConverter.ToUInt32(bytes, 0); } else { ParcelFlags = (ParcelFlags)parcelDataMap["ParcelFlags"].AsUInteger(); } GroupID = parcelDataMap["GroupID"].AsUUID(); GroupPrims = parcelDataMap["GroupPrims"].AsInteger(); IsGroupOwned = parcelDataMap["IsGroupOwned"].AsBoolean(); LandingType = (LandingType)parcelDataMap["LandingType"].AsInteger(); MaxPrims = parcelDataMap["MaxPrims"].AsInteger(); MediaID = parcelDataMap["MediaID"].AsUUID(); MediaURL = parcelDataMap["MediaURL"].AsString(); MediaAutoScale = parcelDataMap["MediaAutoScale"].AsBoolean(); // 0x1 = yes MusicURL = parcelDataMap["MusicURL"].AsString(); Name = parcelDataMap["Name"].AsString(); OtherCleanTime = parcelDataMap["OtherCleanTime"].AsInteger(); OtherCount = parcelDataMap["OtherCount"].AsInteger(); OtherPrims = parcelDataMap["OtherPrims"].AsInteger(); OwnerID = parcelDataMap["OwnerID"].AsUUID(); OwnerPrims = parcelDataMap["OwnerPrims"].AsInteger(); ParcelPrimBonus = (float)parcelDataMap["ParcelPrimBonus"].AsReal(); PassHours = (float)parcelDataMap["PassHours"].AsReal(); PassPrice = parcelDataMap["PassPrice"].AsInteger(); PublicCount = parcelDataMap["PublicCount"].AsInteger(); Privacy = parcelDataMap["Privacy"].AsBoolean(); RegionDenyAnonymous = parcelDataMap["RegionDenyAnonymous"].AsBoolean(); RegionDenyIdentified = parcelDataMap["RegionDenyIdentified"].AsBoolean(); RegionDenyTransacted = parcelDataMap["RegionDenyTransacted"].AsBoolean(); RegionPushOverride = parcelDataMap["RegionPushOverride"].AsBoolean(); RentPrice = parcelDataMap["RentPrice"].AsInteger(); RequestResult = (ParcelResult)parcelDataMap["RequestResult"].AsInteger(); SalePrice = parcelDataMap["SalePrice"].AsInteger(); SelectedPrims = parcelDataMap["SelectedPrims"].AsInteger(); SelfCount = parcelDataMap["SelfCount"].AsInteger(); SequenceID = parcelDataMap["SequenceID"].AsInteger(); SimWideMaxPrims = parcelDataMap["SimWideMaxPrims"].AsInteger(); SimWideTotalPrims = parcelDataMap["SimWideTotalPrims"].AsInteger(); SnapSelection = parcelDataMap["SnapSelection"].AsBoolean(); SnapshotID = parcelDataMap["SnapshotID"].AsUUID(); Status = (ParcelStatus)parcelDataMap["Status"].AsInteger(); TotalPrims = parcelDataMap["TotalPrims"].AsInteger(); UserLocation = parcelDataMap["UserLocation"].AsVector3(); UserLookAt = parcelDataMap["UserLookAt"].AsVector3(); if (map.ContainsKey("MediaData")) // temporary, OpenSim doesn't send this block { OSDMap mediaDataMap = (OSDMap)((OSDArray)map["MediaData"])[0]; MediaDesc = mediaDataMap["MediaDesc"].AsString(); MediaHeight = mediaDataMap["MediaHeight"].AsInteger(); MediaWidth = mediaDataMap["MediaWidth"].AsInteger(); MediaLoop = mediaDataMap["MediaLoop"].AsBoolean(); MediaType = mediaDataMap["MediaType"].AsString(); ObscureMedia = mediaDataMap["ObscureMedia"].AsBoolean(); ObscureMusic = mediaDataMap["ObscureMusic"].AsBoolean(); } OSDMap ageVerificationBlockMap = (OSDMap)((OSDArray)map["AgeVerificationBlock"])[0]; RegionDenyAgeUnverified = ageVerificationBlockMap["RegionDenyAgeUnverified"].AsBoolean(); }
/// <summary> /// Copy constructor /// </summary> public SceneParcel(SceneParcel parcel) { if (parcel.AccessBlackList != null) AccessBlackList = new List<ParcelAccessEntry>(parcel.AccessBlackList); if (parcel.AccessWhiteList != null) AccessWhiteList = new List<ParcelAccessEntry>(parcel.AccessWhiteList); AuthBuyerID = parcel.AuthBuyerID; AutoReturnTime = parcel.AutoReturnTime; Bitmap = new byte[512]; Buffer.BlockCopy(parcel.Bitmap, 0, Bitmap, 0, 512); Category = parcel.Category; ClaimDate = parcel.ClaimDate; Desc = parcel.Desc; Dwell = parcel.Dwell; Flags = parcel.Flags; GroupID = parcel.GroupID; IsGroupOwned = parcel.IsGroupOwned; Landing = parcel.Landing; LocalID = parcel.LocalID; MaxPrims = parcel.MaxPrims; ParcelMedia oldMedia = parcel.Media; Media = new ParcelMedia { MediaAutoScale = oldMedia.MediaAutoScale, MediaDesc = oldMedia.MediaDesc, MediaHeight = oldMedia.MediaHeight, MediaID = oldMedia.MediaID, MediaLoop = oldMedia.MediaLoop, MediaType = oldMedia.MediaType, MediaURL = oldMedia.MediaURL, MediaWidth = oldMedia.MediaWidth }; MusicURL = parcel.MusicURL; Name = parcel.Name; ObscureMedia = parcel.ObscureMedia; ObscureMusic = parcel.ObscureMusic; OwnerID = parcel.OwnerID; PassHours = parcel.PassHours; PassPrice = parcel.PassPrice; DenyAgeUnverified = parcel.DenyAgeUnverified; DenyAnonymous = parcel.DenyAnonymous; PushOverride = parcel.PushOverride; SalePrice = parcel.SalePrice; SnapshotID = parcel.SnapshotID; Status = parcel.Status; LandingLocation = parcel.LandingLocation; LandingLookAt = parcel.LandingLookAt; }
private static QueryFilter GetParcelsByRegionWhereClause(UUID RegionID, UUID scopeID, UUID owner, ParcelFlags flags, ParcelCategory category) { QueryFilter filter = new QueryFilter(); filter.andFilters["RegionID"] = RegionID; if (owner != UUID.Zero) { filter.andFilters["OwnerID"] = owner; } if (flags != ParcelFlags.None) { filter.andBitfieldAndFilters["Flags"] = (uint)flags; } if (category != ParcelCategory.Any) { filter.andFilters["Category"] = (int)category; } return(filter); }
/// <summary> /// Defalt constructor /// </summary> /// <param name="simulator">Simulator this parcel resides in</param> /// <param name="localID">Local ID of this parcel</param> public Parcel(Simulator simulator, int localID) { Simulator = simulator; LocalID = localID; RequestResult = 0; SequenceID = 0; SnapSelection = false; SelfCount = 0; OtherCount = 0; PublicCount = 0; OwnerID = UUID.Zero; IsGroupOwned = false; AuctionID = 0; ClaimDate = Helpers.Epoch; ClaimPrice = 0; RentPrice = 0; AABBMin = Vector3.Zero; AABBMax = Vector3.Zero; Bitmap = new byte[0]; Area = 0; Status = ParcelStatus.None; SimWideMaxPrims = 0; SimWideTotalPrims = 0; MaxPrims = 0; TotalPrims = 0; OwnerPrims = 0; GroupPrims = 0; OtherPrims = 0; SelectedPrims = 0; ParcelPrimBonus = 0; OtherCleanTime = 0; Flags = ParcelFlags.None; SalePrice = 0; Name = String.Empty; Desc = String.Empty; MusicURL = String.Empty; GroupID = UUID.Zero; PassPrice = 0; PassHours = 0; Category = ParcelCategory.None; AuthBuyerID = UUID.Zero; SnapshotID = UUID.Zero; UserLocation = Vector3.Zero; UserLookAt = Vector3.Zero; LandingType = 0x0; Dwell = 0; RegionDenyAnonymous = false; RegionPushOverride = false; AccessList = new List<ParcelManager.ParcelAccessEntry>(0); RegionDenyAgeUnverified = false; Media = new ParcelMedia(); ObscureMedia = false; ObscureMusic = false; }
public uint GetNumberOfParcelsByRegion(UUID RegionID, UUID scopeID, UUID owner, ParcelFlags flags, ParcelCategory category) { IRegionData regiondata = DataManager.DataManager.RequestPlugin <IRegionData>(); if (regiondata != null) { GridRegion region = regiondata.Get(RegionID, scopeID); if (region != null) { QueryFilter filter = GetParcelsByRegionWhereClause(RegionID, scopeID, owner, flags, category); return(uint.Parse(GD.Query(new string[1] { "COUNT(ParcelID)" }, "searchparcel", filter, null, null, null)[0])); } } return(0); }
public List <LandData> GetParcelsByRegion(uint start, uint count, UUID RegionID, UUID scopeID, UUID owner, ParcelFlags flags, ParcelCategory category) { List <LandData> resp = new List <LandData>(0); if (count == 0) { return(resp); } OSDMap mess = new OSDMap(); mess["Method"] = "GetParcelsByRegion"; mess["start"] = OSD.FromUInteger(start); mess["count"] = OSD.FromUInteger(count); mess["RegionID"] = OSD.FromUUID(RegionID); mess["scopeID"] = OSD.FromUUID(scopeID); mess["owner"] = OSD.FromUUID(owner); mess["flags"] = OSD.FromUInteger((uint)flags); mess["category"] = OSD.FromInteger((int)category); List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("RemoteServerURI"); resp = new List <LandData>(); foreach (string m_ServerURI in m_ServerURIs) { OSDMap results = WebUtils.PostToService(m_ServerURI + "osd", mess, true, false); OSDMap innerResults = (OSDMap)OSDParser.DeserializeJson(results["_RawResult"]); OSDArray parcels = (OSDArray)innerResults["Parcels"]; foreach (OSD o in parcels) { resp.Add(new LandData((OSDMap)o)); } break; } return(resp); }