示例#1
0
        protected CatalogProduct(IReadOnlyPacket packet)
        {
            Type = packet.Protocol switch
            {
                ClientType.Flash => H.ToItemType(packet.ReadString()),
                ClientType.Unity => H.ToItemType(packet.ReadShort()),
                _ => throw new Exception($"Unknown client protocol: {packet.Protocol}.")
            };

            if (Type == ItemType.Badge)
            {
                Variant = packet.ReadString();
                Count   = 0;
            }
            else
            {
                Kind    = packet.ReadInt();
                Variant = packet.ReadString();
                Count   = packet.ReadInt();
                // int ?
                IsLimited = packet.ReadBool();
                if (IsLimited)
                {
                    LimitedTotal     = packet.ReadInt();
                    LimitedRemaining = packet.ReadInt();
                }
            }
        }
    }
示例#2
0
        protected UserProfile(IReadOnlyPacket packet)
            : this()
        {
            if (packet.Protocol == ClientType.Flash)
            {
                Id                  = packet.ReadInt();
                Name                = packet.ReadString();
                Figure              = packet.ReadString();
                Motto               = packet.ReadString();
                Created             = packet.ReadString();
                ActivityPoints      = packet.ReadInt();
                Friends             = packet.ReadInt();
                IsFriend            = packet.ReadBool();
                IsFriendRequestSent = packet.ReadBool();
                IsOnline            = packet.ReadBool();

                int n = packet.ReadInt();
                for (int i = 0; i < n; i++)
                {
                    Groups.Add(GroupInfo.Parse(packet));
                }

                LastLogin       = TimeSpan.FromSeconds(packet.ReadInt());
                DisplayInClient = packet.ReadBool();
            }
            else
            {
                Id      = packet.ReadLong();
                Name    = packet.ReadString();
                Figure  = packet.ReadString();
                Motto   = packet.ReadString();
                Created = packet.ReadString();
                // ActivityPoints = packet.ReadInt();
                Friends  = packet.ReadInt();
                IsFriend = packet.ReadBool();
                // IsFriendRequestSent = packet.ReadBool();
                // IsOnline = packet.ReadBool();

                // long secondsSinceLastLogin
                // bool showInClient ???
                // bool ?
                // int ?
                // int ?
                // int ?
                // bool ?
                // bool ?

                short n = packet.ReadShort();
                for (int i = 0; i < n; i++)
                {
                    Groups.Add(GroupInfo.Parse(packet));
                }

                LastLogin       = TimeSpan.FromSeconds(packet.ReadInt());
                DisplayInClient = packet.ReadBool();
            }
        }
示例#3
0
        private Heightmap(IReadOnlyPacket packet)
        {
            Width = packet.ReadInt();
            short n = packet.ReadLegacyShort();

            Length = n / Width;

            Values = new short[n];
            for (int i = 0; i < n; i++)
            {
                Values[i] = packet.ReadShort();
            }
        }
示例#4
0
        public Bot(EntityType type, long id, int index, IReadOnlyPacket packet)
            : this(type, id, index)
        {
            if (type == EntityType.PrivateBot)
            {
                Gender    = H.ToGender(packet.ReadString());
                OwnerId   = packet.ReadLegacyLong();
                OwnerName = packet.ReadString();

                short n = packet.ReadLegacyShort();
                for (int i = 0; i < n; i++)
                {
                    Data.Add(packet.ReadShort());
                }
            }
        }
示例#5
0
 protected Achievement(IReadOnlyPacket packet)
 {
     Id              = packet.ReadInt();
     Level           = packet.ReadInt();
     BadgeName       = packet.ReadString();
     BaseProgress    = packet.ReadInt();
     MaxProgress     = packet.ReadInt();
     Int5            = packet.ReadInt();
     Int6            = packet.ReadInt();
     CurrentProgress = packet.ReadInt();
     IsCompleted     = packet.ReadBool();
     Category        = packet.ReadString();
     String3         = packet.ReadString();
     MaxLevel        = packet.ReadInt();
     Int9            = packet.ReadInt();
     _Short1         = packet.ReadShort();
 }
示例#6
0
        protected InventoryItem(IReadOnlyPacket packet)
            : this()
        {
            ItemId = packet.ReadLegacyLong();

            if (packet.Protocol == ClientType.Flash)
            {
                Type = H.ToItemType(packet.ReadString());
            }
            else
            {
                Type = H.ToItemType(packet.ReadShort());
            }

            Id                   = packet.ReadLegacyLong();
            Kind                 = packet.ReadInt();
            Category             = (FurniCategory)packet.ReadInt();
            Data                 = StuffData.Parse(packet);
            _Bool1               = packet.ReadBool();
            IsTradeable          = packet.ReadBool();
            IsGroupable          = packet.ReadBool();
            IsSellable           = packet.ReadBool();
            SecondsToExpiration  = packet.ReadInt();
            HasRentPeriodStarted = packet.ReadBool();
            RoomId               = packet.ReadLegacyLong();

            if (packet.Protocol == ClientType.Unity)
            {
                // - Seems to be consistent
                _String1 = packet.ReadString(); // string ""
                _String2 = packet.ReadString(); // string "r" / "s"
                _Int3    = packet.ReadInt();    // int 1187551480
            }

            if (Type == ItemType.Floor)
            {
                if (packet.Protocol == ClientType.Flash)
                {
                    _String2 = packet.ReadString();
                    Extra    = packet.ReadInt();
                }
                else
                {
                    // 10 bytes ?
                    _String3 = packet.ReadString();
                    Extra    = packet.ReadInt();
                    _Int5    = packet.ReadInt();
                }
            }
            else
            {
                _String3 = string.Empty;
            }

            /*if (clientType == ClientType.Flash)
             * {
             *  ItemId = packet.ReadInt();
             *  Type = H.ToItemType(packet.ReadString());
             *  Id = packet.ReadInt();
             *  Kind = packet.ReadInt();
             *  Category = (FurniCategory)packet.ReadInt();
             *  Data = StuffData.Parse(packet, clientType);
             *  _Bool1 = packet.ReadBool();
             *  IsTradeable = packet.ReadBool();
             *  IsGroupable = packet.ReadBool();
             *  IsSellable = packet.ReadBool();
             *  SecondsToExpiration = packet.ReadInt();
             *  HasRentPeriodStarted = packet.ReadBool();
             *  RoomId = packet.ReadInt();
             *
             *  if (Type == ItemType.Floor)
             *  {
             *      _String2 = packet.ReadString();
             *      Extra = packet.ReadInt();
             *  }
             * }
             * else
             * {
             *  ItemId = packet.ReadLong();
             *  Type = H.ToItemType(packet.ReadShort());
             *  Id = packet.ReadLong();
             *  Kind = packet.ReadInt();
             *  Category = (FurniCategory)packet.ReadInt();
             *  Data = StuffData.Parse(packet, clientType);
             *  _Bool1 = packet.ReadBool();
             *  IsTradeable = packet.ReadBool();
             *  IsGroupable = packet.ReadBool();
             *  IsSellable = packet.ReadBool();
             *  SecondsToExpiration = packet.ReadInt();
             *  HasRentPeriodStarted = packet.ReadBool();
             *  RoomId = packet.ReadLong();
             *
             *  // - Seems to be consistent
             *  _String1 = packet.ReadString(); // string ""
             *  _String2 = packet.ReadString(); // string "r" / "s"
             *  _Int3 = packet.ReadInt(); // int 1187551480
             *
             *  if (Type == ItemType.Floor)
             *  {
             *      // 10 bytes ?
             *      _String3 = packet.ReadString();
             *      Extra = packet.ReadInt();
             *      _Int5 = packet.ReadInt();
             *  }
             *  else
             *  {
             *      _String3 = string.Empty;
             *  }
             * }*/
        }