Пример #1
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 = Helpers.FieldToUTF8String(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:
                            Client.Log("FIXME", Helpers.LogLevel.Error);
                            break;
                        case GridItemType.LandForSale:
                            //FIXME:
                            Client.Log("FIXME", Helpers.LogLevel.Error);
                            break;
                        case GridItemType.MatureEvent:
                        case GridItemType.PgEvent:
                            //FIXME:
                            Client.Log("FIXME", Helpers.LogLevel.Error);
                            break;
                        case GridItemType.Popular:
                            //FIXME:
                            Client.Log("FIXME", Helpers.LogLevel.Error);
                            break;
                        case GridItemType.Telehub:
                            //FIXME:
                            Client.Log("FIXME", Helpers.LogLevel.Error);
                            break;
                        default:
                            Client.Log("Unknown map item type " + type, Helpers.LogLevel.Warning);
                            break;
                    }
                }

                try { OnGridItems(type, items); }
                catch (Exception e) { Client.Log(e.ToString(), Helpers.LogLevel.Error); }
            }
        }
Пример #2
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 = Helpers.FieldToUTF8String(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); }
            }
        }