Ejemplo n.º 1
0
        protected MarketplaceItem(IReadOnlyPacket packet)
        {
            Id          = packet.ReadLegacyLong();
            UnknownInt2 = packet.ReadInt();

            int itemType = packet.ReadInt();

            switch (itemType)
            {
            case 1:
                Type = ItemType.Floor;
                Kind = packet.ReadInt();
                Data = StuffData.Parse(packet);
                break;

            case 2:
                Type = ItemType.Wall;
                Kind = packet.ReadInt();
                Data = new LegacyData()
                {
                    Value = packet.ReadString()
                };
                break;

            case 3:
                Type = ItemType.Floor;
                Kind = packet.ReadInt();
                Data = new LegacyData()
                {
                    Flags         = ItemDataFlags.IsLimitedRare,
                    LimitedNumber = packet.ReadInt(),
                    LimitedTotal  = packet.ReadInt()
                };
                break;

            default: throw new Exception($"Unknown MarketplaceItem type: {itemType}");
            }

            Price         = packet.ReadInt();
            TimeRemaining = packet.ReadInt();
            Average       = packet.ReadInt();
            Offers        = packet.ReadInt();
        }
Ejemplo n.º 2
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;
             *  }
             * }*/
        }