public multipleMapItemReply GetMapItems(ulong regionHandle, GridItemType gridItemType)
        {
            multipleMapItemReply reply = m_localService.GetMapItems(regionHandle, gridItemType);
            if (reply.items.Count == 0)
                reply = (multipleMapItemReply)DoRemoteForced(regionHandle, gridItemType);

            return reply;
        }
 public multipleMapItemReply GetMapItems(ulong regionHandle, GridItemType gridItemType)
 {
     return new multipleMapItemReply();
 }
Example #3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="regionHandle"></param>
        /// <param name="item"></param>
        /// <param name="layer"></param>
        /// <param name="timeoutMS"></param>
        /// <returns></returns>
        public List<GridItem> MapItems(ulong regionHandle, GridItemType item, GridLayerType layer, int timeoutMS)
        {
            List<GridItem> itemList = null;
            AutoResetEvent itemsEvent = new AutoResetEvent(false);

            GridItemsCallback callback =
                delegate(GridItemType type, List<GridItem> items)
                {
                    if (type == GridItemType.AgentLocations)
                    {
                        itemList = items;
                        itemsEvent.Set();
                    }
                };

            OnGridItems += callback;

            RequestMapItems(regionHandle, item, layer);
            itemsEvent.WaitOne(timeoutMS, false);

            OnGridItems -= callback;

            return itemList;
        }
Example #4
0
        private void MapItemReplyHandler(Packet packet, Simulator simulator)
        {
            if (OnGridItems != null)
            {
                MapItemReplyPacket reply = (MapItemReplyPacket)packet;
                GridItemType       type  = (GridItemType)reply.RequestData.ItemType;
                List <GridItem>    items = new List <GridItem>();

                for (int i = 0; i < reply.Data.Length; i++)
                {
                    string name = Utils.BytesToString(reply.Data[i].Name);

                    switch (type)
                    {
                    case GridItemType.AgentLocations:
                        GridAgentLocation location = new GridAgentLocation();
                        location.GlobalX     = reply.Data[i].X;
                        location.GlobalY     = reply.Data[i].Y;
                        location.Identifier  = name;
                        location.AvatarCount = reply.Data[i].Extra;

                        items.Add(location);

                        break;

                    case GridItemType.Classified:
                        //FIXME:
                        Logger.Log("FIXME", Helpers.LogLevel.Error, Client);
                        break;

                    case GridItemType.LandForSale:
                        //FIXME:
                        Logger.Log("FIXME", Helpers.LogLevel.Error, Client);
                        break;

                    case GridItemType.MatureEvent:
                    case GridItemType.PgEvent:
                        //FIXME:
                        Logger.Log("FIXME", Helpers.LogLevel.Error, Client);
                        break;

                    case GridItemType.Popular:
                        //FIXME:
                        Logger.Log("FIXME", Helpers.LogLevel.Error, Client);
                        break;

                    case GridItemType.Telehub:
                        //FIXME:
                        Logger.Log("FIXME", Helpers.LogLevel.Error, Client);
                        break;

                    default:
                        Logger.Log("Unknown map item type " + type, Helpers.LogLevel.Warning, Client);
                        break;
                    }
                }

                try { OnGridItems(type, items); }
                catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
            }
        }
        public multipleMapItemReply GetMapItems(ulong regionHandle, GridItemType gridItemType)
        {
            Dictionary<string, object> sendData = new Dictionary<string, object>();

            sendData["REGIONHANDLE"] = regionHandle;
            sendData["GRIDITEMTYPE"] = (int)gridItemType;
            sendData["METHOD"] = "getmapitems";

            string reqString = WebUtils.BuildQueryString(sendData);

            try
            {
                List<string> serverURIs = m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("GridServerURI");
                foreach (string m_ServerURI in serverURIs)
                {
                    string reply = SynchronousRestFormsRequester.MakeRequest("POST",
                            m_ServerURI,
                            reqString);
                    if (reply != string.Empty)
                    {
                        Dictionary<string, object> replyData = WebUtils.ParseXmlResponse(reply);

                        if (replyData != null)
                        {
                            multipleMapItemReply items = new multipleMapItemReply();
                            if (replyData.ContainsKey("Result") && (replyData["Result"].ToString().ToLower() == "failure"))
                                return items;

                            items = new multipleMapItemReply((replyData["MapItems"]) as Dictionary<string, object>);

                            // Success
                            return items;
                        }

                        else
                            m_log.DebugFormat("[GRID CONNECTOR]: GetMapItems {0} received null response",
                                regionHandle);
                    }
                }
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting server: {0}", e.Message);
            }

            return null;
        }
Example #6
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="regionHandle"></param>
        /// <param name="item"></param>
        /// <param name="layer"></param>
        /// <param name="timeoutMS"></param>
        /// <returns></returns>
        public List<MapItem> MapItems(ulong regionHandle, GridItemType item, GridLayerType layer, int timeoutMS)
        {
            List<MapItem> itemList = null;
            AutoResetEvent itemsEvent = new AutoResetEvent(false);

            EventHandler<GridItemsEventArgs> callback =
                delegate(object sender, GridItemsEventArgs e)
                {
                    if (e.Type == GridItemType.AgentLocations)
                    {
                        itemList = e.Items;
                        itemsEvent.Set();
                    }
                };

            GridItems += callback;

            RequestMapItems(regionHandle, item, layer);
            itemsEvent.WaitOne(timeoutMS, false);

            GridItems -= callback;

            return itemList;
        }
 public DnnGridImageCommandColumnTemplate(GridItemType itemType)
 {
     this.ItemType = itemType;
 }
Example #8
0
 public multipleMapItemReply GetMapItems(ulong regionHandle, GridItemType gridItemType)
 {
     multipleMapItemReply reply = m_localService.GetMapItems(regionHandle, gridItemType);
     if (reply.items.Count == 0)
     {
         reply = m_remoteService.GetMapItems(regionHandle, gridItemType);
     }
     return reply;
 }
Example #9
0
        /// <summary>Process an incoming packet and raise the appropriate events</summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The EventArgs object containing the packet data</param>
        protected void MapItemReplyHandler(object sender, PacketReceivedEventArgs e)
        {
            if (m_GridItems != null)
            {
                MapItemReplyPacket reply = (MapItemReplyPacket)e.Packet;
                GridItemType       type  = (GridItemType)reply.RequestData.ItemType;
                List <MapItem>     items = new List <MapItem>();

                for (int i = 0; i < reply.Data.Length; i++)
                {
                    string name = Utils.BytesToString(reply.Data[i].Name);

                    switch (type)
                    {
                    case GridItemType.AgentLocations:
                        MapAgentLocation location = new MapAgentLocation();
                        location.GlobalX     = reply.Data[i].X;
                        location.GlobalY     = reply.Data[i].Y;
                        location.Identifier  = name;
                        location.AvatarCount = reply.Data[i].Extra;
                        items.Add(location);
                        break;

                    case GridItemType.Classified:
                        //FIXME:
                        Logger.Log("FIXME", Helpers.LogLevel.Error, Client);
                        break;

                    case GridItemType.LandForSale:
                        MapLandForSale landsale = new MapLandForSale();
                        landsale.GlobalX = reply.Data[i].X;
                        landsale.GlobalY = reply.Data[i].Y;
                        landsale.ID      = reply.Data[i].ID;
                        landsale.Name    = name;
                        landsale.Size    = reply.Data[i].Extra;
                        landsale.Price   = reply.Data[i].Extra2;
                        items.Add(landsale);
                        break;

                    case GridItemType.MatureEvent:
                        MapMatureEvent matureEvent = new MapMatureEvent();
                        matureEvent.GlobalX     = reply.Data[i].X;
                        matureEvent.GlobalY     = reply.Data[i].Y;
                        matureEvent.Description = name;
                        matureEvent.Flags       = (DirectoryManager.EventFlags)reply.Data[i].Extra2;
                        items.Add(matureEvent);
                        break;

                    case GridItemType.PgEvent:
                        MapPGEvent PGEvent = new MapPGEvent();
                        PGEvent.GlobalX     = reply.Data[i].X;
                        PGEvent.GlobalY     = reply.Data[i].Y;
                        PGEvent.Description = name;
                        PGEvent.Flags       = (DirectoryManager.EventFlags)reply.Data[i].Extra2;
                        items.Add(PGEvent);
                        break;

                    case GridItemType.Popular:
                        //FIXME:
                        Logger.Log("FIXME", Helpers.LogLevel.Error, Client);
                        break;

                    case GridItemType.Telehub:
                        MapTelehub teleHubItem = new MapTelehub();
                        teleHubItem.GlobalX = reply.Data[i].X;
                        teleHubItem.GlobalY = reply.Data[i].Y;
                        items.Add(teleHubItem);
                        break;

                    case GridItemType.AdultLandForSale:
                        MapAdultLandForSale adultLandsale = new MapAdultLandForSale();
                        adultLandsale.GlobalX = reply.Data[i].X;
                        adultLandsale.GlobalY = reply.Data[i].Y;
                        adultLandsale.ID      = reply.Data[i].ID;
                        adultLandsale.Name    = name;
                        adultLandsale.Size    = reply.Data[i].Extra;
                        adultLandsale.Price   = reply.Data[i].Extra2;
                        items.Add(adultLandsale);
                        break;

                    case GridItemType.AdultEvent:
                        MapAdultEvent adultEvent = new MapAdultEvent();
                        adultEvent.GlobalX     = reply.Data[i].X;
                        adultEvent.GlobalY     = reply.Data[i].Y;
                        adultEvent.Description = Utils.BytesToString(reply.Data[i].Name);
                        adultEvent.Flags       = (DirectoryManager.EventFlags)reply.Data[i].Extra2;
                        items.Add(adultEvent);
                        break;

                    default:
                        Logger.Log("Unknown map item type " + type, Helpers.LogLevel.Warning, Client);
                        break;
                    }
                }

                OnGridItems(new GridItemsEventArgs(type, items));
            }
        }
Example #10
0
 public GridItemsEventArgs(GridItemType type, List <MapItem> items)
 {
     this.m_Type  = type;
     this.m_Items = items;
 }
Example #11
0
 public DnnGridItem(GridTableView ownerTableView, int itemIndex, int dataSetIndex, GridItemType itemType) : base(ownerTableView, itemIndex, dataSetIndex, itemType)
 {
 }
Example #12
0
 public multipleMapItemReply GetMapItems(ulong regionHandle, GridItemType gridItemType)
 {
     return(new multipleMapItemReply());
 }
Example #13
0
 public multipleMapItemReply GetMapItems(List <UUID> scopeIDs, ulong regionHandle, GridItemType gridItemType)
 {
     return(null);
 }
 public DnnGridImageCommandColumnTemplate(GridItemType itemType)
 {
     ItemType = itemType;
 }
 private static bool Initializable(GridItemType itemType)
 {
     return !(itemType == GridItemType.Item || itemType == GridItemType.EditItem || itemType == GridItemType.EditFormItem
         || itemType == GridItemType.AlternatingItem);
     //return
     //(itemType == GridItemType.FilteringItem || itemType == GridItemType.Header || itemType == GridItemType.Pager || itemType == GridItemType.Footer
     //|| itemType == GridItemType.GroupFooter || itemType == GridItemType.GroupHeader);
 }
        /// <summary>
        /// Creates a ImageCommandColumnTemplate
        /// </summary>
        /// <returns>A ImageCommandColumnTemplate</returns>
        private DnnGridImageCommandColumnTemplate CreateTemplate(GridItemType type)
        {
            bool isDesignMode = HttpContext.Current == null;
            var template = new DnnGridImageCommandColumnTemplate(type);
            if (type != GridItemType.Header)
            {
                template.ImageURL = ImageURL;
                if (!isDesignMode)
                {
                    template.CommandName = CommandName;
                    template.VisibleField = VisibleField;
                    template.KeyField = KeyField;
                }
            }
            template.EditMode = EditMode;
            template.NavigateURL = NavigateURL;
            template.NavigateURLFormatString = NavigateURLFormatString;
            template.OnClickJs = OnClickJs;
            template.ShowImage = ShowImage;
            template.Visible = Visible;

            template.Text = type == GridItemType.Header ? HeaderText : Text;

            //Set Design Mode to True
            template.DesignMode = isDesignMode;

            return template;
        }
Example #17
0
 private static bool Initializable(GridItemType itemType)
 {
     return itemType != GridItemType.Item && itemType != GridItemType.EditItem && itemType != GridItemType.EditFormItem && itemType != GridItemType.AlternatingItem;
 }
Example #18
0
 public DnnGridItem(GridTableView ownerTableView, int itemIndex, int dataSetIndex, GridItemType itemType) : base(ownerTableView, itemIndex, dataSetIndex, itemType)
 {
 }
 public multipleMapItemReply GetMapItems(List<UUID> scopeIDs, ulong regionHandle, GridItemType gridItemType)
 {
     return null;
 }
 protected static bool Initializable(GridItemType itemType)
 {
     return !(itemType == GridItemType.Item || itemType == GridItemType.EditItem || itemType == GridItemType.EditFormItem
         || itemType == GridItemType.AlternatingItem);
 }
Example #21
0
 public multipleMapItemReply GetMapItems(ulong regionHandle, GridItemType gridItemType)
 {
     throw new NotImplementedException();
 }
Example #22
0
 public GridItemsEventArgs(GridItemType type, List<MapItem> items)
 {
     this.m_Type = type;
     this.m_Items = items;
 }
 public multipleMapItemReply GetMapItems(ulong regionHandle, GridItemType gridItemType)
 {
     return m_GridService.GetMapItems(regionHandle, gridItemType);
 }
Example #24
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="regionHandle"></param>
        /// <param name="item"></param>
        /// <param name="layer"></param>
        public void RequestMapItems(ulong regionHandle, GridItemType item, GridLayerType layer)
        {
            MapItemRequestPacket request = new MapItemRequestPacket();
            request.AgentData.AgentID = Client.Self.AgentID;
            request.AgentData.SessionID = Client.Self.SessionID;
            request.AgentData.Flags = (uint)layer;
            request.AgentData.Godlike = false; // Filled in on the sim
            request.AgentData.EstateID = 0; // Filled in on the sim

            request.RequestData.ItemType = (uint)item;
            request.RequestData.RegionHandle = regionHandle;

            Client.Network.SendPacket(request);
        }
Example #25
0
 private GridItem(int value, GridItemType type, int health)
 {
     this.value = value;
     this.type = type;
     this.health = health;
 }