protected CatalogPageData(IReadOnlyPacket packet) : this() { Position = packet.ReadInt(); String1 = packet.ReadString(); String2 = packet.ReadString(); Type = packet.ReadInt(); switch (Type) { case 0: String3 = packet.ReadString(); break; case 1: Int3 = packet.ReadInt(); break; case 2: String4 = packet.ReadString(); break; default: break; } SecondsToExpiration = packet.ReadInt(); }
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(); } } } }
protected virtual void Initialize(IReadOnlyPacket packet) { if (Flags.HasFlag(ItemDataFlags.IsLimitedRare)) { LimitedNumber = packet.ReadInt(); LimitedTotal = packet.ReadInt(); } }
internal ChatSettings(IReadOnlyPacket packet) { Flow = (ChatFlow)packet.ReadInt(); BubbleWidth = (ChatBubbleWidth)packet.ReadInt(); ScrollSpeed = (ChatScrollSpeed)packet.ReadInt(); TalkHearingDistance = packet.ReadInt(); FloodProtection = (ChatFloodProtection)packet.ReadInt(); }
protected override void Initialize(IReadOnlyPacket packet) { Value = packet.ReadString(); Hits = packet.ReadInt(); Target = packet.ReadInt(); base.Initialize(packet); }
protected ActivityPoints(IReadOnlyPacket packet) { short n = packet.ReadLegacyShort(); for (int i = 0; i < n; i++) { var type = (ActivityPointType)packet.ReadInt(); dictionary[type] = packet.ReadInt(); } }
internal RoomUser(long id, int index, IReadOnlyPacket packet) : this(id, index) { Gender = H.ToGender(packet.ReadString()); GroupId = packet.ReadLegacyLong(); Int8 = packet.ReadInt(); GroupName = packet.ReadString(); FigureExtra = packet.ReadString(); AchievementScore = packet.ReadInt(); Bool1 = packet.ReadBool(); }
protected TradeOffer(IReadOnlyPacket packet) : this() { UserId = packet.ReadInt(); int n = packet.ReadInt(); for (int i = 0; i < n; i++) { Items.Add(TradeItem.Parse(packet)); } FurniCount = packet.ReadInt(); CreditCount = packet.ReadInt(); }
private void HandleTradeCompleted(IReadOnlyPacket packet) { if (!_roomManager.IsInRoom || !IsTrading) { return; } int userId = packet.ReadInt(); int reason = packet.ReadInt(); bool wasTrader = IsTrader; IRoomUser? self = Self; IRoomUser? partner = Partner; ITradeOffer?ownOffer = OwnOffer; ITradeOffer?partnerOffer = PartnerOffer; if (self == null || partner == null || ownOffer == null || partnerOffer == null) { return; } IRoomUser user; if (userId == self.Id) { user = self; } else if (userId == partner.Id) { user = partner; } else { DebugUtil.Log($"user id {userId} does not match self {Self} or partner {Partner} ids"); return; } ResetTrade(); if (reason == 0) { DebugUtil.Log($"complete {userId}, partner = {partner}"); OnComplete(wasTrader, self, partner, ownOffer, partnerOffer); } else { DebugUtil.Log($"stopped, reason = {reason} ({userId})"); OnStop(user, reason); } }
protected NavigatorSearchResultList(IReadOnlyPacket packet) { Category = packet.ReadString(); Text = packet.ReadString(); ActionAllowed = packet.ReadInt(); BoolA = packet.ReadBool(); ViewMode = packet.ReadInt(); short n = packet.ReadLegacyShort(); for (int i = 0; i < n; i++) { Add(RoomInfo.Parse(packet)); } }
internal Pet(long id, int index, IReadOnlyPacket packet) : this(id, index) { Breed = packet.ReadInt(); OwnerId = packet.ReadLegacyLong(); OwnerName = packet.ReadString(); RarityLevel = packet.ReadInt(); Bool1 = packet.ReadBool(); Bool2 = packet.ReadBool(); Bool3 = packet.ReadBool(); Bool4 = packet.ReadBool(); Bool5 = packet.ReadBool(); Bool6 = packet.ReadBool(); Level = packet.ReadInt(); Stance = packet.ReadString(); }
protected GroupMember(IReadOnlyPacket packet) { Type = (GroupMemberType)packet.ReadInt(); Id = packet.ReadLegacyLong(); Name = packet.ReadString(); Figure = packet.ReadString(); Joined = DateTime.Parse(packet.ReadString()); }
protected RollerUpdate(IReadOnlyPacket packet) : this() { LocationX = packet.ReadInt(); LocationY = packet.ReadInt(); TargetX = packet.ReadInt(); TargetY = packet.ReadInt(); int n = packet.ReadLegacyShort(); for (int i = 0; i < n; i++) { ObjectUpdates.Add(RollerObjectUpdate.Parse(packet)); } RollerId = packet.ReadLegacyLong(); if (packet.Available > 0) { Type = (RollerUpdateType)packet.ReadInt(); if (Type == RollerUpdateType.MovingEntity || Type == RollerUpdateType.StationaryEntity) { if (packet.Protocol == ClientType.Unity) { packet.ReadInt(); } // Entity index may have changed to long here // but it's int everywhere else ??? EntityIndex = packet.ReadInt(); EntityLocationZ = packet.ReadLegacyFloat(); EntityTargetZ = packet.ReadLegacyFloat(); } } }
protected UserData(IReadOnlyPacket packet) { Id = packet.ReadLegacyLong(); Name = packet.ReadString(); Figure = packet.ReadString(); Gender = H.ToGender(packet.ReadString()); Motto = packet.ReadString(); String4 = packet.ReadString(); Bool1 = packet.ReadBool(); TotalRespects = packet.ReadInt(); RespectsLeft = packet.ReadInt(); ScratchesLeft = packet.ReadInt(); Bool2 = packet.ReadBool(); LastLogin = packet.ReadString(); IsNameChangeable = packet.ReadBool(); IsSafetyLocked = packet.ReadBool(); Bool3 = packet.ReadBool(); }
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(); } }
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(); }
private void HandleTradeOpen(IReadOnlyPacket packet) { if (_profileManager.UserData == null) { DebugUtil.Log("user data not loaded"); return; } if (!_roomManager.IsInRoom || _roomManager.Room is null) { DebugUtil.Log("not in room"); return; } int traderId = packet.ReadInt(); int unknownA = packet.ReadInt(); // ? int tradeeId = packet.ReadInt(); int unknownB = packet.ReadInt(); // ? if (!_roomManager.Room.TryGetEntityById(traderId, out IRoomUser? trader)) { DebugUtil.Log($"failed to find user with id {traderId}"); return; } if (!_roomManager.Room.TryGetEntityById(tradeeId, out IRoomUser? tradee)) { DebugUtil.Log($"failed to find user with id {tradeeId}"); return; } ResetTrade(); IsTrader = _profileManager.UserData.Id == traderId; Self = IsTrader ? trader : tradee; Partner = IsTrader ? tradee : trader; IsTrading = true; OnStart(IsTrader, Partner); }
protected RoomData(bool isUpdating, IReadOnlyPacket packet) : base(packet) { IsUpdating = isUpdating; ForceLoad = packet.ReadBool(); // if IsUpdating == false Bool3 = packet.ReadBool(); BypassAccess = packet.ReadBool(); IsRoomMuted = packet.ReadBool(); Moderation = ModerationSettings.Parse(packet); ShowMuteButton = packet.ReadBool(); ChatSettings = ChatSettings.Parse(packet); if (packet.Protocol == ClientType.Unity) { UnknownInt1 = packet.ReadInt(); UnknownInt2 = packet.ReadInt(); } }
protected CatalogPageNode(IReadOnlyPacket packet) { IsVisible = packet.ReadBool(); Icon = packet.ReadInt(); Id = packet.ReadInt(); Name = packet.ReadString(); Text = packet.ReadString(); short n = packet.ReadLegacyShort(); for (int i = 0; i < n; i++) { OfferIds.Add(packet.ReadInt()); } n = packet.ReadLegacyShort(); for (int i = 0; i < n; i++) { Children.Add(Parse(packet)); } }
protected CatalogOffer(IReadOnlyPacket packet) { Id = packet.ReadInt(); FurniLine = packet.ReadString(); IsRentable = packet.ReadBool(); PriceInCredits = packet.ReadInt(); PriceInActivityPoints = packet.ReadInt(); ActivityPointType = (ActivityPointType)packet.ReadInt(); CanPurchaseAsGift = packet.ReadBool(); short n = packet.ReadLegacyShort(); for (int i = 0; i < n; i++) { Products.Add(CatalogProduct.Parse(packet)); } ClubLevel = packet.ReadInt(); CanPurchaseMultiple = packet.ReadBool(); IsPet = packet.ReadBool(); PreviewImage = packet.ReadString(); }
protected RoomInfo(IReadOnlyPacket packet) : this() { Id = packet.ReadLegacyLong(); Name = packet.ReadString(); OwnerId = packet.ReadLegacyLong(); OwnerName = packet.ReadString(); Access = (RoomAccess)packet.ReadInt(); Users = packet.ReadInt(); MaxUsers = packet.ReadInt(); Description = packet.ReadString(); Trading = (TradePermissions)packet.ReadInt(); Score = packet.ReadInt(); Ranking = packet.ReadInt(); Category = (RoomCategory)packet.ReadInt(); int n = packet.ReadLegacyShort(); for (int i = 0; i < n; i++) { Tags.Add(packet.ReadString()); } Flags = (RoomFlags)packet.ReadInt(); if (Flags.HasFlag(RoomFlags.HasOfficialRoomPic)) { OfficialRoomPicRef = packet.ReadString(); } if (Flags.HasFlag(RoomFlags.IsGroupHomeRoom)) { GroupId = packet.ReadLegacyLong(); GroupName = packet.ReadString(); GroupBadge = packet.ReadString(); } if (Flags.HasFlag(RoomFlags.HasEvent)) { EventName = packet.ReadString(); EventDescription = packet.ReadString(); EventMinutesLeft = packet.ReadInt(); } }
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(); } }
private void HandleTradeOpenFail(IReadOnlyPacket packet) { if (!_roomManager.IsInRoom) { DebugUtil.Log("not in room"); return; } int reason = packet.ReadInt(); string name = packet.ReadString(); ResetTrade(); OnStartFail(reason, name); }
private void HandleTradeAccept(IReadOnlyPacket packet) { if (!_roomManager.IsInRoom) { DebugUtil.Log("not in room"); return; } if (!IsTrading) { DebugUtil.Log("not trading"); return; } IRoomUser user; int userId = packet.ReadInt(); bool accepted = packet.ReadInt() == 1; if (userId == Self?.Id) { user = Self; HasAccepted = accepted; } else if (userId == Partner?.Id) { user = Partner; HasPartnerAccepted = accepted; } else { DebugUtil.Log($"user id {userId} does not match self {Self} or partner {Partner} ids"); return; } DebugUtil.Log($"user {user} {(accepted ? "" : "un")}accepted"); OnAccept(user, accepted); }
protected CatalogPage(IReadOnlyPacket packet) { Id = packet.ReadInt(); Mode = packet.ReadString(); LayoutCode = packet.ReadString(); short n = packet.ReadLegacyShort(); for (int i = 0; i < n; i++) { Images.Add(packet.ReadString()); } n = packet.ReadLegacyShort(); for (int i = 0; i < n; i++) { Texts.Add(packet.ReadString()); } n = packet.ReadLegacyShort(); for (int i = 0; i < n; i++) { Offers.Add(CatalogOffer.Parse(packet)); } UnknownIntA = packet.ReadInt(); AcceptSeasonCurrencyAsCredits = packet.ReadBool(); if (packet.Available > 0) { n = packet.ReadLegacyShort(); for (int i = 0; i < n; i++) { Data.Add(CatalogPageData.Parse(packet)); } } }
protected GroupData(IReadOnlyPacket packet, ClientType clientType) { Id = packet.ReadLong(); CanLeave = packet.ReadBool(); Type = (GroupType)packet.ReadInt(); Name = packet.ReadString(); Description = packet.ReadString(); Badge = packet.ReadString(); HomeRoomId = packet.ReadLong(); HomeRoomName = packet.ReadString(); MemberStatus = (GroupMemberStatus)packet.ReadInt(); MemberCount = packet.ReadInt(); IsFavourite = packet.ReadBool(); Created = packet.ReadString(); IsOwner = packet.ReadBool(); IsAdmin = packet.ReadBool(); OwnerName = packet.ReadString(); DisplayInClient = packet.ReadBool(); CanDecorateHomeRoom = packet.ReadBool(); PendingRequests = packet.ReadInt(); CanViewForum = packet.ReadBool(); // TODO extra 8 bytes }
public static StuffData Parse(IReadOnlyPacket packet) { int value = packet.ReadInt(); var type = (StuffDataType)(value & 0xFF); StuffData data = type switch { StuffDataType.Legacy => new LegacyData(), StuffDataType.Map => new MapData(), StuffDataType.StringArray => new StringArrayData(), StuffDataType.VoteResult => new VoteResultData(), StuffDataType.ItemData4 => new ItemData4(), StuffDataType.IntArray => new IntArrayData(), StuffDataType.HighScore => new HighScoreData(), StuffDataType.CrackableFurni => new CrackableFurniData(), _ => throw new Exception($"Unknown ItemData type: {type}"), }; data.Flags = (ItemDataFlags)(value >> 8); data.Initialize(packet); return(data); }
protected Badge(IReadOnlyPacket packet) { Id = packet.ReadInt(); Code = packet.ReadString(); }
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; * } * }*/ }
internal ModerationSettings(IReadOnlyPacket packet) { WhoCanMute = (ModerationPermissions)packet.ReadInt(); WhoCanKick = (ModerationPermissions)packet.ReadInt(); WhoCanBan = (ModerationPermissions)packet.ReadInt(); }