Exemplo n.º 1
0
        public HRoomEntry(HPacket packet)
            : base(packet)
        {
            Id   = packet.ReadInt32();
            Name = packet.ReadUTF8();

            OwnerId   = packet.ReadInt32();
            OwnerName = packet.ReadUTF8();

            DoorMode     = packet.ReadInt32();
            UserCount    = packet.ReadInt32();
            MaxUserCount = packet.ReadInt32();

            Description = packet.ReadUTF8();
            TradeMode   = packet.ReadInt32();
            Ranking     = packet.ReadInt32();
            Category    = packet.ReadInt32();
            Stars       = packet.ReadInt32();

            Tags = new string[packet.ReadInt32()];
            for (int i = 0; i < Tags.Length; i++)
            {
                Tags[i] = packet.ReadUTF8();
            }

            HRoomFlags roomEntryBitmask = (HRoomFlags)packet.ReadInt32();

            if (roomEntryBitmask.HasFlag(HRoomFlags.HasCustomThumbnail))
            {
                ThumbnailUrl = packet.ReadUTF8();
            }
            if (roomEntryBitmask.HasFlag(HRoomFlags.HasGroup))
            {
                GroupId        = packet.ReadInt32();
                GroupName      = packet.ReadUTF8();
                GroupBadgeCode = packet.ReadUTF8();
            }
            if (roomEntryBitmask.HasFlag(HRoomFlags.HasAdvertisement))
            {
                AdName             = packet.ReadUTF8();
                AdDescription      = packet.ReadUTF8();
                AdExpiresInMinutes = packet.ReadInt32();
            }

            ShowOwner   = roomEntryBitmask.HasFlag(HRoomFlags.ShowOwner);
            AllowPets   = roomEntryBitmask.HasFlag(HRoomFlags.AllowPets);
            ShowEntryAd = roomEntryBitmask.HasFlag(HRoomFlags.ShowRoomAd);
        }
Exemplo n.º 2
0
    public HRoomEntry(IHFormat format, ref ReadOnlySpan <byte> packetSpan)
    {
        Id   = format.Read <int>(ref packetSpan);
        Name = format.ReadUTF8(ref packetSpan);

        OwnerId   = format.Read <int>(ref packetSpan);
        OwnerName = format.ReadUTF8(ref packetSpan);

        DoorMode     = (HDoorMode)format.Read <int>(ref packetSpan);
        UserCount    = format.Read <int>(ref packetSpan);
        MaxUserCount = format.Read <int>(ref packetSpan);

        Description = format.ReadUTF8(ref packetSpan);
        TradeMode   = (HTradeMode)format.Read <int>(ref packetSpan);
        Ranking     = format.Read <int>(ref packetSpan);
        Stars       = format.Read <int>(ref packetSpan);
        Category    = (HRoomCategory)format.Read <int>(ref packetSpan);

        Tags = new string[format.Read <int>(ref packetSpan)];
        for (int i = 0; i < Tags.Length; i++)
        {
            Tags[i] = format.ReadUTF8(ref packetSpan);
        }

        HRoomFlags roomFlags = (HRoomFlags)format.Read <int>(ref packetSpan);

        if (roomFlags.HasFlag(HRoomFlags.HasCustomThumbnail))
        {
            ThumbnailUrl = format.ReadUTF8(ref packetSpan);
        }
        if (roomFlags.HasFlag(HRoomFlags.HasGroup))
        {
            GroupId        = format.Read <int>(ref packetSpan);
            GroupName      = format.ReadUTF8(ref packetSpan);
            GroupBadgeCode = format.ReadUTF8(ref packetSpan);
        }
        if (roomFlags.HasFlag(HRoomFlags.HasAdvertisement))
        {
            AdName             = format.ReadUTF8(ref packetSpan);
            AdDescription      = format.ReadUTF8(ref packetSpan);
            AdExpiresInMinutes = format.Read <int>(ref packetSpan);
        }

        ShowOwner   = roomFlags.HasFlag(HRoomFlags.ShowOwner);
        AllowPets   = roomFlags.HasFlag(HRoomFlags.AllowPets);
        ShowEntryAd = roomFlags.HasFlag(HRoomFlags.ShowRoomAd);
    }