コード例 #1
0
        public static HPacket ToPacket(ushort packetId, HFormat format, IList <HWallItem> wallItems)
        {
            HPacket packet = format.CreatePacket(packetId);

            packet.Write(0);
            var owners = new Dictionary <int, string>();

            foreach (HWallItem wallItem in wallItems)
            {
                if (owners.ContainsKey(wallItem.OwnerId))
                {
                    continue;
                }
                owners.Add(wallItem.OwnerId, wallItem.OwnerName);

                packet.Write(wallItem.OwnerId);
                packet.Write(wallItem.OwnerName);
            }
            packet.Write(owners.Count, 0);

            packet.Write(wallItems.Count);
            foreach (HWallItem wallItem in wallItems)
            {
                wallItem.WriteTo(packet);
            }

            return(packet);
        }
コード例 #2
0
ファイル: HEntityUpdate.cs プロジェクト: scottstamp/HarbleNet
        public static HPacket ToPacket(ushort packetId, HFormat format, IList <HEntityUpdate> updates)
        {
            HPacket packet = format.CreatePacket(packetId);

            packet.Write(updates.Count);
            foreach (HEntityUpdate update in updates)
            {
                update.WriteTo(packet);
            }

            return(packet);
        }
コード例 #3
0
        public static HPacket ToPacket(ushort packetId, HFormat format, IList <HEntity> entities)
        {
            HPacket packet = format.CreatePacket(packetId);

            packet.Write(entities.Count);
            foreach (HEntity entity in entities)
            {
                entity.WriteTo(packet);
            }

            return(packet);
        }
コード例 #4
0
        public static HPacket ToPacket(ushort packetId, HFormat format, IList <HItem> items)
        {
            HPacket packet = format.CreatePacket(packetId);

            packet.Write(0);
            packet.Write(0);

            packet.Write(items.Count);
            foreach (HItem item in items)
            {
                item.WriteTo(packet);
            }

            return(packet);
        }
コード例 #5
0
ファイル: HFriendData.cs プロジェクト: scottstamp/HarbleNet
        public static HPacket ToPacket(ushort packetId, HFormat format, IList <HFriendData> friends)
        {
            HPacket packet = format.CreatePacket(packetId);

            packet.Write(0);
            packet.Write(0);

            packet.Write(friends.Count);
            foreach (HFriendData friend in friends)
            {
                friend.WriteTo(packet);
            }

            return(packet);
        }
コード例 #6
0
ファイル: HFloorItem.cs プロジェクト: scottstamp/HarbleNet
        public static HPacket ToPacket(ushort packetId, HFormat format, IList<HFloorItem> floorItems)
        {
            HPacket packet = format.CreatePacket(packetId);

            packet.Write(0);
            var owners = new Dictionary<int, string>();
            foreach (HFloorItem floorItem in floorItems)
            {
                if (owners.ContainsKey(floorItem.OwnerId)) continue;
                owners.Add(floorItem.OwnerId, floorItem.OwnerName);

                packet.Write(floorItem.OwnerId);
                packet.Write(floorItem.OwnerName);
            }
            packet.Write(owners.Count, 0);

            packet.Write(floorItems.Count);
            foreach (HFloorItem floorItem in floorItems)
            {
                floorItem.WriteTo(packet);
            }

            return packet;
        }