コード例 #1
0
        public multipleMapItemReply(Dictionary<string, object> KVP)
        {
            foreach (KeyValuePair<string, object> kvp in KVP)
            {
                ulong handle = ulong.Parse(kvp.Key.Split('A')[1]);
                mapItemReply item = new mapItemReply(kvp.Value as Dictionary<string, object>);

                if (!items.ContainsKey(handle))
                    items.Add(handle, new List<mapItemReply>());

                items[handle].Add(item);
            }
        }
コード例 #2
0
        public multipleMapItemReply(Dictionary <string, object> KVP)
        {
            foreach (KeyValuePair <string, object> kvp in KVP)
            {
                ulong        handle = ulong.Parse(kvp.Key.Split('A')[1]);
                mapItemReply item   = new mapItemReply(kvp.Value as Dictionary <string, object>);

                if (!items.ContainsKey(handle))
                {
                    items.Add(handle, new List <mapItemReply>());
                }

                items[handle].Add(item);
            }
        }
コード例 #3
0
 public override void FromOSD(OSDMap map)
 {
     foreach (KeyValuePair <string, OSD> kvp in map)
     {
         ulong               regionHandle = ulong.Parse(kvp.Key);
         OSDArray            array        = (OSDArray)kvp.Value;
         List <mapItemReply> replies      = new List <mapItemReply>();
         foreach (OSD o in array)
         {
             mapItemReply r = new mapItemReply();
             r.FromOSD((OSDMap)o);
             replies.Add(r);
         }
         items[regionHandle] = replies;
     }
 }
コード例 #4
0
ファイル: WorldMap.cs プロジェクト: satlanski2/Aurora-Sim
        public virtual void HandleMapItemRequest(IClientAPI remoteClient, uint flags,
            uint EstateID, bool godlike, uint itemtype, ulong regionhandle)
        {
            if (remoteClient.Scene.GetScenePresence (remoteClient.AgentId).IsChildAgent)
                return;//No child agent requests

            uint xstart;
            uint ystart;
            Utils.LongToUInts(m_scene.RegionInfo.RegionHandle, out xstart, out ystart);
            
            List<mapItemReply> mapitems = new List<mapItemReply>();
            int tc = Environment.TickCount;
            if (itemtype == (int)GridItemType.AgentLocations)
            {
                //If its local, just let it do it on its own.
                if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle)
                {
                    //Only one person here, send a zero person response
                    mapItemReply mapitem;
                    IEntityCountModule entityCountModule = m_scene.RequestModuleInterface<IEntityCountModule>();
                    if (entityCountModule != null && entityCountModule.RootAgents <= 1)
                    {
                        mapitem = new mapItemReply
                                      {
                                          x = xstart + 1,
                                          y = ystart + 1,
                                          id = UUID.Zero,
                                          name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()),
                                          Extra = 0,
                                          Extra2 = 0
                                      };
                        mapitems.Add(mapitem);
                        remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags);
                        return;
                    }
                    m_scene.ForEachScenePresence(delegate(IScenePresence sp)
                    {
                        // Don't send a green dot for yourself
                        if (!sp.IsChildAgent && sp.UUID != remoteClient.AgentId)
                        {
                            mapitem = new mapItemReply
                                          {
                                              x = (uint) (xstart + sp.AbsolutePosition.X),
                                              y = (uint) (ystart + sp.AbsolutePosition.Y),
                                              id = UUID.Zero,
                                              name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()),
                                              Extra = 1,
                                              Extra2 = 0
                                          };
                            mapitems.Add(mapitem);
                        }
                    });
                    remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags);
                }
                else
                {
                    List<mapItemReply> reply;
                    if (!m_mapItemCache.TryGetValue(regionhandle, out reply))
                    {
                        m_itemsToRequest.Enqueue(new MapItemRequester
                                                     {
                            flags = flags,
                            itemtype = itemtype,
                            regionhandle = regionhandle,
                            remoteClient = remoteClient
                        });

                        if(!itemRequesterIsRunning)
                            threadpool.QueueEvent(GetMapItems, 3);
                    }
                    else
                    {
                        remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags);
                    }
                }
            }
        }
コード例 #5
0
        public void HandleMapItemRequest(IClientAPI remoteClient, uint flags,
            uint EstateID, bool godlike, uint itemtype, ulong regionhandle)
        {
            //The following constant appears to be from GridLayerType enum
            //defined in OpenMetaverse/GridManager.cs of libopenmetaverse.
            if (itemtype == 7) //(land sales)
            {
                int tc = Environment.TickCount;
                Hashtable ReqHash = new Hashtable();

                //The flags are: SortAsc (1 << 15), PerMeterSort (1 << 17)
                ReqHash["flags"] = "163840";
                ReqHash["type"] = "4294967295"; //This is -1 in 32 bits
                ReqHash["price"] = "0";
                ReqHash["area"] = "0";
                ReqHash["query_start"] = "0";

                Hashtable result = GenericXMLRPCRequest(ReqHash,
                                                        "dir_land_query");

                if (!Convert.ToBoolean(result["success"]))
                {
                    remoteClient.SendAgentAlertMessage(
                        result["errorMessage"].ToString(), false);
                    return;
                }

                ArrayList dataArray = (ArrayList)result["data"];

                int count = dataArray.Count;
                if (count > 100)
                    count = 101;

                DirLandReplyData[] Landdata = new DirLandReplyData[count];

                int i = 0;
                string[] ParcelLandingPoint = new string[count];
                string[] ParcelRegionUUID = new string[count];
                foreach (Object o in dataArray)
                {
                    Hashtable d = (Hashtable)o;

                    if (d["name"] == null)
                        continue;
                    Landdata[i] = new DirLandReplyData();
                    Landdata[i].parcelID = new UUID(d["parcel_id"].ToString());
                    Landdata[i].name = d["name"].ToString();
                    Landdata[i].auction = Convert.ToBoolean(d["auction"]);
                    Landdata[i].forSale = Convert.ToBoolean(d["for_sale"]);
                    Landdata[i].salePrice = Convert.ToInt32(d["sale_price"]);
                    Landdata[i].actualArea = Convert.ToInt32(d["area"]);
                    ParcelLandingPoint[i] = d["landing_point"].ToString();
                    ParcelRegionUUID[i] = d["region_UUID"].ToString();
                    i++;
                    if (i >= count)
                        break;
                }
                i = 0;
                int locX = 0;
                int locY = 0;

                List<mapItemReply> mapitems = new List<mapItemReply>();

                foreach (DirLandReplyData landDir in Landdata)
                {
                    foreach(IScene scene in m_Scenes)
                    {
                        if(scene.RegionInfo.RegionID.ToString() == ParcelRegionUUID[i])
                        {
                            locX = scene.RegionInfo.RegionLocX;
                            locY = scene.RegionInfo.RegionLocY;
                        }
                    }
                    string[] landingpoint = ParcelLandingPoint[i].Split('/');
                    mapItemReply mapitem = new mapItemReply();
                    mapitem.x = (uint)((locX * 256 ) + Convert.ToDecimal(landingpoint[0]));
                    mapitem.y = (uint)((locY * 256 ) + Convert.ToDecimal(landingpoint[1]));
                    mapitem.id = landDir.parcelID;
                    mapitem.name = landDir.name;
                    mapitem.Extra = landDir.actualArea;
                    mapitem.Extra2 = landDir.salePrice;
                    mapitems.Add(mapitem);
                    i++;
                }
                remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags);
                mapitems.Clear();
            }
        }
コード例 #6
0
 public override void FromOSD(OSDMap map)
 {
     foreach (KeyValuePair<string, OSD> kvp in map)
     {
         ulong regionHandle = ulong.Parse(kvp.Key);
         OSDArray array = (OSDArray)kvp.Value;
         List<mapItemReply> replies = new List<mapItemReply>();
         foreach(OSD o in array)
         {
             mapItemReply r = new mapItemReply();
             r.FromOSD((OSDMap)o);
             replies.Add(r);
         }
         items[regionHandle] = replies;
     }
 }