Example #1
0
        public List <RouteResult> GetResult(int fromId, int toId, int weightId, int sizeId, int categoryId)
        {
            City           city1    = _cityService.GetCity(fromId);
            City           city2    = _cityService.GetCity(toId);
            ParcelCategory category = parcelCategoryService.findById(categoryId);
            var            price    = priceService.GetPrice(weightId, sizeId);

            return(_routeService.SearchRoute(city1, city2, price, category));
        }
Example #2
0
        /// <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;
        }
Example #3
0
        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;
 }
Example #6
0
        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 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);
        }
        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>
        /// Queries the dataserver for parcels of land which are flagged to be shown in search
        /// 
        /// The <see cref="OnDirPlacesReply"/> event is raised when a response is received from the simulator
        /// </summary>
        /// <param name="searchText">A string containing a list of keywords to search for separated by a space character</param>
        /// <param name="queryFlags">A set of flags which can be ORed to modify query options 
        /// such as classified maturity rating.</param>
        /// <param name="category">The category to search</param>        
        /// <param name="queryStart">Each request is limited to 100 places
        /// being returned. To get the first 100 result entries of a request use 0,
        /// from 100-199 use 1, 200-299 use 2, etc.</param>        
        /// <returns>A UUID to correlate the results when the <see cref="OnDirPlacesReply"/> event is raised</returns>
        /// <example>
        /// Search places containing the key words "foo" and "bar" in the "Any" category that are either PG or Adult
        /// <code>
        /// UUID searchID = StartDirPlacesSearch("foo bar", DirFindFlags.DwellSort | DirFindFlags.IncludePG | DirFindFlags.IncludeAdult, ParcelCategory.Any, 0);
        /// </code>
        /// </example>
        /// <remarks>        
        /// Additional information on the results can be obtained by using the ParcelManager.InfoRequest method
        /// </remarks>
        public UUID StartDirPlacesSearch(string searchText, DirFindFlags queryFlags, ParcelCategory category, int queryStart)
        {
            DirPlacesQueryPacket query = new DirPlacesQueryPacket();

            UUID queryID = UUID.Random();

            query.AgentData.AgentID = Client.Self.AgentID;
            query.AgentData.SessionID = Client.Self.SessionID;

            query.QueryData.Category = (sbyte)category;
            query.QueryData.QueryFlags = (uint)queryFlags;

            query.QueryData.QueryID = queryID;
            query.QueryData.QueryText = Utils.StringToBytes(searchText);
            query.QueryData.QueryStart = queryStart;
            query.QueryData.SimName = Utils.StringToBytes(string.Empty);

            Client.Network.SendPacket(query);

            return queryID;
        }
        /// <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();
        }
Example #11
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;
 }
        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;
 }
Example #14
0
 /// <summary>
 ///  Search Places 
 /// </summary>
 /// <param name="findFlags">One of the Values from the DirFindFlags struct, ie: AgentOwned, GroupOwned, etc.</param>
 /// <param name="searchCategory">One of the values from the SearchCategory Struct, ie: Any, Linden, Newcomer</param>
 /// <param name="groupID">LLUID of group you want to recieve results for</param>
 /// <param name="transactionID">Transaction (Query) ID which can be associated with results from your request.</param>
 /// <returns>Transaction (Query) ID which can be associated with results from your request.</returns>
 public UUID StartPlacesSearch(DirFindFlags findFlags, ParcelCategory searchCategory, UUID groupID, UUID transactionID)
 {
     return StartPlacesSearch(findFlags, searchCategory, String.Empty, String.Empty, groupID, transactionID);
 }
        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 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;
        }
Example #17
0
 /// <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;
 }
 /// <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();
 }
Example #19
0
 /// <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;
 }
        /// <summary>
        /// Search Places - All Options
        /// </summary>
        /// <param name="findFlags">One of the Values from the DirFindFlags struct, ie: AgentOwned, GroupOwned, etc.</param>
        /// <param name="searchCategory">One of the values from the SearchCategory Struct, ie: Any, Linden, Newcomer</param>
        /// <param name="searchText">A string containing a list of keywords to search for separated by a space character</param>
        /// <param name="simulatorName">String Simulator Name to search in</param>
        /// <param name="groupID">LLUID of group you want to recieve results for</param>
        /// <param name="transactionID">Transaction (Query) ID which can be associated with results from your request.</param>
        /// <returns>Transaction (Query) ID which can be associated with results from your request.</returns>
        public UUID StartPlacesSearch(DirFindFlags findFlags, ParcelCategory searchCategory, string searchText, string simulatorName, 
            UUID groupID, UUID transactionID)
        {
            PlacesQueryPacket find = new PlacesQueryPacket();
            find.AgentData.AgentID = Client.Self.AgentID;
            find.AgentData.SessionID = Client.Self.SessionID;
            find.AgentData.QueryID = groupID;

            find.TransactionData.TransactionID = transactionID;

            find.QueryData.QueryText = Utils.StringToBytes(searchText);
            find.QueryData.QueryFlags = (uint)findFlags;
            find.QueryData.Category = (sbyte)searchCategory;
            find.QueryData.SimName = Utils.StringToBytes(simulatorName);

            Client.Network.SendPacket(find);
            return transactionID;
        }
        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;
        }
        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);
        }
        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;
        }
Example #24
0
        public List <RouteResult> SearchRoute(City source, City end, double price, ParcelCategory category)
        {
            var citiesByName = context.City.Where(x => x.IsActive).ToList().ToDictionary(x => x.Name);
            var routes       = GetAllRoutes();
            var extraCharge  = category.ExtraCharge;
            var graph        = BuildGraph(routes);
            var result       = new List <RouteResult>();

            double WeightByTime(TaggedEdge <string, string> edge)
            {
                return(8);
            }

            IEnumerable <IEnumerable <TaggedEdge <string, string> > > shortestPath = null;

            try
            {
                shortestPath = graph.RankedShortestPathHoffmanPavley(WeightByTime, source.Name, end.Name, 4);
            }
            catch
            {
                return(result);
            }


            foreach (var shortPath in shortestPath)
            {
                var    parts       = new List <SegmentResult>();
                var    route       = new RouteResult();
                double time        = 0.0;
                double returnPrice = 0.0;
                foreach (var edge in shortPath)
                {
                    parts.Add(new SegmentResult
                    {
                        Departure = new Data.DataContracts.City.CityDTO {
                            Name = edge.Source.ToString()
                        },
                        Destination = new Data.DataContracts.City.CityDTO {
                            Name = edge.Target.ToString()
                        },
                        EstimatedDuration     = 8,
                        TransportationCompany = TransportationCompany.OA,
                        Price      = (Decimal)price,
                        TotalPrice = (Decimal)(price * (1 + extraCharge / 100)),
                        ExtraFee   = (Decimal)(price * extraCharge / 100),
                    });
                    time        += WeightByTime(edge);
                    returnPrice += price;
                }
                route.Segments      = parts;
                route.TotalDuration = time;
                route.TotalPrice    = returnPrice * (1 + extraCharge / 100);
                route.Departure     = new CityDTO {
                    Name = source.Name
                };
                route.Destination = new CityDTO {
                    Name = end.Name
                };
                route.GetDistinctTransportationCompany();

                result.Add(route);
            }
            return(result);
        }
Example #25
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);
        }