Ejemplo n.º 1
0
        public static IReadOnlyList <HFurniture> Parse(HMessage packet)
        {
            int ownersCount = packet.ReadInteger();
            var owners      = new Dictionary <int, string>(ownersCount);

            for (int i = 0; i < ownersCount; i++)
            {
                int    ownerId   = packet.ReadInteger();
                string ownerName = packet.ReadString();

                owners.Add(ownerId, ownerName);
            }

            int furnitureCount = packet.ReadInteger();
            var furnitureList  = new List <HFurniture>(furnitureCount);

            for (int i = 0; i < furnitureList.Capacity; i++)
            {
                int id     = packet.ReadInteger();
                int typeId = packet.ReadInteger();

                int x         = packet.ReadInteger();
                int y         = packet.ReadInteger();
                var direction = (HDirection)packet.ReadInteger();
                var z         = double.Parse(packet.ReadString(), CultureInfo.InvariantCulture);

                packet.ReadString();
                packet.ReadInteger();

                int category = packet.ReadInteger();
                HStuffData.ReadStuffData(category, packet);

                packet.ReadInteger();
                packet.ReadInteger();

                int ownerId = packet.ReadInteger();
                if (typeId < 0)
                {
                    packet.ReadString();
                }

                var furniture = new HFurniture(id, typeId, ownerId,
                                               owners[ownerId], new HPoint(x, y, z), direction);

                furnitureList.Add(furniture);
            }
            return(furnitureList);
        }
Ejemplo n.º 2
0
        public static IReadOnlyList<HFurniture> Parse(HMessage packet)
        {
            int ownersCount = packet.ReadInteger();
            var owners = new Dictionary<int, string>(ownersCount);

            for (int i = 0; i < ownersCount; i++)
            {
                int ownerId = packet.ReadInteger();
                string ownerName = packet.ReadString();

                owners.Add(ownerId, ownerName);
            }

            int furnitureCount = packet.ReadInteger();
            var furnitureList = new List<HFurniture>(furnitureCount);

            for (int i = 0; i < furnitureList.Capacity; i++)
            {
                int id = packet.ReadInteger();
                int typeId = packet.ReadInteger();

                int x = packet.ReadInteger();
                int y = packet.ReadInteger();
                var direction = (HDirection)packet.ReadInteger();
                var z = double.Parse(packet.ReadString(), CultureInfo.InvariantCulture);

                packet.ReadString();
                packet.ReadInteger();

                int category = packet.ReadInteger();
                HStuffData.ReadStuffData(category, packet);

                packet.ReadInteger();
                packet.ReadInteger();

                int ownerId = packet.ReadInteger();
                if (typeId < 0) packet.ReadString();

                var furniture = new HFurniture(id, typeId, ownerId,
                    owners[ownerId], new HPoint(x, y, z), direction);

                furnitureList.Add(furniture);
            }
            return furnitureList;
        }
Ejemplo n.º 3
0
        public static HFurniture[] Parse(HMessage packet)
        {
            int ownersCount = packet.ReadInteger();
            var owners      = new Dictionary <int, string>(ownersCount);

            for (int i = 0; i < ownersCount; i++)
            {
                owners.Add(packet.ReadInteger(), packet.ReadString());
            }

            var furniture = new HFurniture[packet.ReadInteger()];

            for (int i = 0; i < furniture.Length; i++)
            {
                var furni = new HFurniture(packet);
                furni.OwnerName = owners[furni.OwnerId];

                furniture[i] = furni;
            }
            return(furniture);
        }
Ejemplo n.º 4
0
        public static IReadOnlyList <HFurniture> Parse(HMessage packet)
        {
            int ownersCount = packet.ReadInteger();
            var owners      = new Dictionary <int, string>(ownersCount);

            for (int i = 0; i < ownersCount; i++)
            {
                int    ownerId   = packet.ReadInteger();
                string ownerName = packet.ReadString();

                owners.Add(ownerId, ownerName);
            }

            int furnitureCount = packet.ReadInteger();
            var furnitureList  = new List <HFurniture>(furnitureCount);

            for (int i = 0; i < furnitureList.Capacity; i++)
            {
                int id     = packet.ReadInteger();
                int typeId = packet.ReadInteger();

                int    x         = packet.ReadInteger();
                int    y         = packet.ReadInteger();
                var    direction = (HDirection)packet.ReadInteger();
                double z         = double.Parse(packet.ReadString());

                packet.ReadString();
                packet.ReadInteger();

                int categoryId = (packet.ReadInteger() & 0xFF);
                #region Switch Statement: categoryId
                switch (categoryId)
                {
                case 0:
                {
                    packet.ReadString();
                    break;
                }

                case 1:
                {
                    int count = packet.ReadInteger();
                    for (int j = 0; j < count; j++)
                    {
                        packet.ReadString();
                        packet.ReadString();
                    }
                    break;
                }

                case 2:
                {
                    int count = packet.ReadInteger();
                    for (int j = 0; j < count; j++)
                    {
                        packet.ReadString();
                    }
                    break;
                }

                case 3:
                {
                    packet.ReadString();
                    packet.ReadInteger();
                    break;
                }

                case 5:
                {
                    int count = packet.ReadInteger();
                    for (int j = 0; j < count; j++)
                    {
                        packet.ReadInteger();
                    }
                    break;
                }

                case 6:
                {
                    packet.ReadString();
                    packet.ReadInteger();
                    packet.ReadInteger();

                    int count = packet.ReadInteger();
                    for (int j = 0; j < count; j++)
                    {
                        int subCount = packet.ReadInteger();
                        for (int k = 0; k < subCount; k++)
                        {
                            packet.ReadString();
                        }
                    }
                    break;
                }

                case 7:
                {
                    packet.ReadString();
                    packet.ReadInteger();
                    packet.ReadInteger();
                    break;
                }
                }
                #endregion

                packet.ReadInteger();
                packet.ReadInteger();

                int ownerId = packet.ReadInteger();
                if (typeId < 0)
                {
                    packet.ReadString();
                }

                var furniture = new HFurniture(id, typeId, ownerId,
                                               owners[ownerId], new HPoint(x, y, z), direction);

                furnitureList.Add(furniture);
            }

            return(furnitureList);
        }
Ejemplo n.º 5
0
        public static IReadOnlyList<HFurniture> Parse(HMessage packet)
        {
            int ownersCount = packet.ReadInteger();
            var owners = new Dictionary<int, string>(ownersCount);

            for (int i = 0; i < ownersCount; i++)
            {
                int ownerId = packet.ReadInteger();
                string ownerName = packet.ReadString();

                owners.Add(ownerId, ownerName);
            }

            int furnitureCount = packet.ReadInteger();
            var furnitureList = new List<HFurniture>(furnitureCount);

            for (int i = 0; i < furnitureList.Capacity; i++)
            {
                int id = packet.ReadInteger();
                int typeId = packet.ReadInteger();

                int x = packet.ReadInteger();
                int y = packet.ReadInteger();
                var direction = (HDirection)packet.ReadInteger();
                double z = double.Parse(packet.ReadString());

                packet.ReadString();
                packet.ReadInteger();

                int categoryId = (packet.ReadInteger() & 0xFF);
                #region Switch Statement: categoryId
                switch (categoryId)
                {
                    case 0:
                    {
                        packet.ReadString();
                        break;
                    }
                    case 1:
                    {
                        int count = packet.ReadInteger();
                        for (int j = 0; j < count; j++)
                        {
                            packet.ReadString();
                            packet.ReadString();
                        }
                        break;
                    }
                    case 2:
                    {
                        int count = packet.ReadInteger();
                        for (int j = 0; j < count; j++)
                        {
                            packet.ReadString();
                        }
                        break;
                    }
                    case 3:
                    {
                        packet.ReadString();
                        packet.ReadInteger();
                        break;
                    }
                    case 5:
                    {
                        int count = packet.ReadInteger();
                        for (int j = 0; j < count; j++)
                        {
                            packet.ReadInteger();
                        }
                        break;
                    }
                    case 6:
                    {
                        packet.ReadString();
                        packet.ReadInteger();
                        packet.ReadInteger();

                        int count = packet.ReadInteger();
                        for (int j = 0; j < count; j++)
                        {
                            int subCount = packet.ReadInteger();
                            for (int k = 0; k < subCount; k++)
                            {
                                packet.ReadString();
                            }
                        }
                        break;
                    }
                    case 7:
                    {
                        packet.ReadString();
                        packet.ReadInteger();
                        packet.ReadInteger();
                        break;
                    }
                }
                #endregion

                packet.ReadInteger();
                packet.ReadInteger();

                int ownerId = packet.ReadInteger();
                if (typeId < 0) packet.ReadString();

                var furniture = new HFurniture(id, typeId, ownerId,
                    owners[ownerId], new HPoint(x, y, z), direction);

                furnitureList.Add(furniture);
            }
            
            return furnitureList;
        }
Ejemplo n.º 6
0
 public void Update(HFurniture furni)
 {
     Tile   = furni.Tile;
     Stuff  = furni.Stuff;
     Facing = furni.Facing;
 }