Esempio n. 1
0
        OSDMap GetRegion(OSDMap map)
        {
            OSDMap      resp       = new OSDMap();
            IRegionData regiondata = DataPlugins.RequestPlugin <IRegionData> ();

            if (regiondata != null && (map.ContainsKey("RegionID") || map.ContainsKey("Region")))
            {
                string regionName = map.ContainsKey("Region") ? map ["Region"].ToString().Trim() : "";
                UUID   regionID   = map.ContainsKey("RegionID") ? UUID.Parse(map ["RegionID"].ToString()) : UUID.Zero;
                // not used?? // UUID scopeID = map.ContainsKey ("ScopeID") ? UUID.Parse (map ["ScopeID"].ToString ()) : UUID.Zero;
                GridRegion region = null;
                if (regionID != UUID.Zero)
                {
                    region = regiondata.Get(regionID, null);
                }
                else if (regionName != string.Empty)
                {
                    var regionList = regiondata.GetList(regionName, null, null, null);
                    if (regionList.Count > 0)
                    {
                        region = regionList [0];
                    }
                }
                if (region != null)
                {
                    resp ["Region"] = region.ToOSD();
                }
            }
            return(resp);
        }