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; } }
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; } }
public virtual void HandleMapItemRequest(IClientAPI remoteClient, uint flags, uint EstateID, bool godlike, uint itemtype, ulong regionhandle) { IScenePresence presence = remoteClient.Scene.GetScenePresence(remoteClient.AgentId); if (presence == null || presence.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); } } } }