Exemple #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:
                            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); }
            }
        }
        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); }
            }
        }